Set up MongoDB
Query and administer MongoDB databases and Atlas clusters, using a connection string or an Atlas service account.
- Publisher
- MongoDB Official
- Run locally
npx -y mongodb-mcp-server@latest --readOnly- Transports
- stdio, streamable-http
- Authentication
- A connection string, an Atlas service account with client ID and secret, or both.
- Environment
MDB_MCP_CONNECTION_STRINGMDB_MCP_API_CLIENT_IDMDB_MCP_API_CLIENT_SECRET- What it can touch
- Read and write; --readOnly limits it to reads.
- Licence
- Apache-2.0
- Source
- github.com/mongodb-js/mongodb-mcp-server
- Status
- Active
Install
This server runs on your machine as a child process of the client. You need the runtime its command uses, such as Node.js for npx, uv for uvx or Docker, plus any variables listed under Environment.
Claude Code
claude mcp add --scope project --env MDB_MCP_CONNECTION_STRING='<MDB_MCP_CONNECTION_STRING>' --env MDB_MCP_API_CLIENT_ID='<MDB_MCP_API_CLIENT_ID>' --env MDB_MCP_API_CLIENT_SECRET='<MDB_MCP_API_CLIENT_SECRET>' mongodb -- npx -y mongodb-mcp-server@latest --readOnly
Cursor
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "${env:MDB_MCP_CONNECTION_STRING}",
"MDB_MCP_API_CLIENT_ID": "${env:MDB_MCP_API_CLIENT_ID}",
"MDB_MCP_API_CLIENT_SECRET": "${env:MDB_MCP_API_CLIENT_SECRET}"
}
}
}
}
Codex
[mcp_servers.mongodb]
command = "npx"
args = ["-y", "mongodb-mcp-server@latest", "--readOnly"]
env_vars = ["MDB_MCP_CONNECTION_STRING", "MDB_MCP_API_CLIENT_ID", "MDB_MCP_API_CLIENT_SECRET"]
The generated command keeps --readOnly; drop it only if the agent should write.
Other servers in data
Airtable
Query, create and update records in Airtable bases, limited to the bases you authorise.
BigQuery
Google-hosted endpoint to explore BigQuery datasets and run SQL. Cloud SQL and Spanner have their own.
MCP Toolbox for Databases
One server with prebuilt tool sets for Postgres, MySQL, BigQuery, AlloyDB, Spanner and other databases.
Supabase
Manage Supabase projects from an agent: run SQL, apply migrations, read logs and deploy Edge Functions.
Neon
Create Neon Postgres projects and branches, run SQL and do branch-based migrations. Meant for development use.
Redis
Lets an agent work with Redis data structures, search and vector indexes in plain language.