Set it up
- 1
Turn on MongoDB in your AI
In Claude: open Settings → Connectors and add MongoDB. In ChatGPT: Settings → Apps & Connectors.
- 2
Add it to your app once
Copy the short config below into your app. It just tells your AI where to find MongoDB.
- 3
Just ask
Tell it what you want in plain words — no special commands.
For example, say
“List all collections in my MongoDB database and show their document counts”
Need the exact config? Show it +
Add to your client
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": ["-y", "mongodb-mcp-server", "--connectionString", "mongodb://localhost:27017"]
}
}
}Paste into your client's MCP configuration file.
Get the skill
A ready-made skill that teaches your AI agent to use MongoDB well. MongoDB's official skills — connections, schema design, query optimization, Atlas.
npx skills add mongodb/agent-skills Quick skills
Copy one, paste it to your AI, watch it work.
Collection Exploration
“List collections in the app database and show me 3 sample documents from each”
Aggregation Pipeline Drafting
“Write an aggregation to count orders per customer, sorted by total spend descending, top 10”
Data Investigation
“Find users where lastLogin is older than 90 days and account status is active”
Good to know
- · Use a database user with readOnly role for AI queries — never grant admin or write access casually
- · Large find() queries without limit can stream massive amounts of data into your context
- · Aggregation pipelines on production can be expensive — test them on a dev replica first
When to use
- ✓ You're working with a MongoDB database and want to run queries conversationally
- ✓ You need to explore an unfamiliar collection's document shape
- ✓ You're debugging aggregation pipelines and want AI to draft them
- ✓ You want quick read-only access to production data for support
When not to use
- × You use Postgres, MySQL, or DynamoDB (use those specific servers)
- × You want to give AI write access to production without review
- × You need Atlas Search, Change Streams, or advanced Atlas-only features
About
Imagine asking your AI: 'Find all users in my MongoDB who signed up this month' or 'What collections exist in the orders database?' — and it queries MongoDB directly. This server connects your AI to MongoDB so it can query collections, run aggregations, and inspect schemas through conversation.
The official MongoDB MCP server provides AI assistants with access to MongoDB databases and MongoDB Atlas. Query collections, inspect schemas, insert and update documents, run aggregations, and analyze data — through natural language.
Maintained by MongoDB with Atlas integration. Supports both local MongoDB instances and cloud Atlas clusters.
Workflows That Use MongoDB MCP
Works With
Also Consider
FAQ
What does MongoDB MCP do? +
Imagine asking your AI: 'Find all users in my MongoDB who signed up this month' or 'What collections exist in the orders database?' — and it queries MongoDB directly. This server connects your AI to MongoDB so it can query collections, run aggregations, and inspect schemas through conversation.
Do I need to know how to code? +
No. Turn it on in your AI's settings and ask in plain English — no terminal, no coding.
When should I use MongoDB MCP? +
Reach for it when you need to: You're working with a MongoDB database and want to run queries conversationally; You need to explore an unfamiliar collection's document shape; You're debugging aggregation pipelines and want AI to draft them; You want quick read-only access to production data for support.
When should I avoid MongoDB MCP? +
Skip it when: You use Postgres, MySQL, or DynamoDB (use those specific servers); You want to give AI write access to production without review; You need Atlas Search, Change Streams, or advanced Atlas-only features.
How do I install MongoDB MCP? +
In Claude Code, run: claude mcp add mongodb -- npx -y mongodb-mcp-server --connectionString mongodb://localhost:27017. Copy-paste configs for Claude Desktop, Cursor, and Windsurf are at the top of this page.