
MongoDB MCP Server
Let LLMs query, inspect, and manage MongoDB databases through natural language.
Add to your client
Copy the config for your MCP client and paste it into its config file.
npx -y @smithery/cli install mongo-mcp --client claudePaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"mongodb-mcp-server": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}Step-by-step guides: Add to Claude Desktop · Add to Cursor · Add to Windsurf
Before you start
- Node.js 18+
- npx
- A MongoDB connection URI (or Docker and Docker Compose for the local sandbox)
- An MCP client such as the Claude Desktop app
About MongoDB MCP Server
MongoDB MCP Server lets LLMs interact directly with MongoDB databases over the Model Context Protocol. It supports collection schema inspection, document querying and filtering, index management, and document operations (insert, update, delete). The connection URI is supplied as a command argument, and the server runs over stdio for use with Claude Desktop and similar MCP clients. A Docker Compose sandbox plus a seed script provide sample Users, Products, and Orders collections for local experimentation.
Tools & capabilities (8)
findQuery documents with filtering and projection.
listCollectionsList available collections.
insertOneInsert a single document.
updateOneUpdate a single document.
deleteOneDelete a single document.
createIndexCreate a new index.
dropIndexRemove an index.
indexesList indexes for a collection.
When to use it
- Explore available collections and inspect a collection's schema in natural language
- Run filtered queries such as finding all in-stock electronics under a price threshold
- Insert, update, or delete individual documents conversationally
- Inspect, create, and drop indexes to tune query performance
Security notes
The MongoDB connection URI — including username and password — is passed as a plaintext command-line argument in the client config. Store credentials carefully and prefer a least-privilege database user. The server can insert, update, and delete documents and modify indexes, so connecting with write-capable credentials grants the LLM full mutation access to the database.
MongoDB MCP Server FAQ
How do I connect to my MongoDB database?
Add the mongoServers config to your Claude Desktop config file with the command 'npx', and pass 'mongo-mcp' plus your MongoDB connection URI (e.g. mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin) as args.
Can I try it without my own MongoDB server?
Yes. The repo includes a Docker Compose sandbox. Run 'docker-compose up -d' to start MongoDB, then 'npm run seed' to load sample Users, Products, and Orders collections, and point the config at mongodb://root:example@localhost:27017/test?authSource=admin.
What operations can the LLM perform?
It can query and list collections, inspect and manage indexes, and perform single-document insert, update, and delete operations.
Is there an automated install option?
Yes. You can install it for Claude Desktop via Smithery using 'npx -y @smithery/cli install mongo-mcp --client claude'.
Alternatives to MongoDB MCP Server
Compare all alternatives →Google's official MCP server with prebuilt BigQuery tools, querying datasets via Application Default Credentials.
Read/write Postgres access plus index tuning, EXPLAIN plans, and database health analysis for AI agents.
Official Supabase server: manage tables, run SQL, branches, configs and edge functions from your AI client.
Compare MongoDB MCP Server with: