MongoDB MCP Server
Official server that lets your AI query MongoDB databases and Atlas clusters, inspect collections and indexes, with a read-only mode for safety.
Use it with Claude or any AI tool. Copy the prompt and paste it in. The link inside gives the AI the whole page as Markdown.
Install
claude mcp add-json mongodb '{"command":"npx","args":["-y","mongodb-mcp-server@latest","--readOnly"],"env":{"MDB_MCP_CONNECTION_STRING":"mongodb://localhost:27017/myDatabase"}}'
Adds the server to Claude Code. For other apps, copy the config below.
About
The official MongoDB server connects your AI tool to a database or an Atlas cluster. It can list collections, read schemas and indexes, run queries and aggregations, and help you design better queries.
Start with the –readOnly flag so the AI can look but not change anything. Use a connection string for a development database, not production, until you trust the setup.
Files and links
-
Check it before you connect it. This server runs with your permissions:
npx -y mongodb-mcp-server@latest --readOnlyIt needs MDB_MCP_CONNECTION_STRING. Use your own and never share them.claude mcp add-json mongodb '{"command":"npx","args":["-y","mongodb-mcp-server@latest","--readOnly"],"env":{"MDB_MCP_CONNECTION_STRING":"mongodb://localhost:27017/myDatabase"}}' -