> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up MongoDB MCP Server

> Connect MongoDB Atlas to TrueFoundry by running the MongoDB MCP server with a dedicated connection string.

The MongoDB MCP server lets agents query databases, inspect schemas, and manage collections or indexes. Use a dedicated Atlas database user and allow network access from the environment that runs the MCP server.

## Prerequisites

* A TrueFoundry account with permission to add MCP servers.
* A MongoDB Atlas project and cluster.

## Create a Connection String

In Atlas, open **Database** > **Connect** > **Drivers** and copy the connection string. Create a dedicated database user under **Database Access** and grant the minimum role, such as read-only access for exploration workflows.

## Run and Register the MCP Server

Deploy the MongoDB MCP server on TrueFoundry or your own infrastructure with the connection string configured as `MDB_MCP_CONNECTION_STRING`. Then add the resulting MCP URL in **MCP Gateway** as a remote MCP server.

If you run a hosted stdio version, configure `MDB_MCP_CONNECTION_STRING` as an environment variable and keep credentials in a secret store.

## Configure Atlas Network Access

Atlas must allow traffic from wherever the MCP server runs. Add the egress IP of your TrueFoundry deployment or hosting environment under **Security** > **Network Access** in Atlas.

## Security Notes

Use a dedicated database user, avoid embedding personal credentials in the connection string, and expose write-capable MongoDB tools only through curated virtual MCP servers.
