MongoDB MCP
Official MongoDB MCP server — query collections, inspect schemas, and manage documents through AI-powered natural language.
// 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.
// Try it now
"List all collections in my MongoDB database and show their document counts"
- ! 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
API key or simple config
// 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
// Usage Scenarios
Collection Exploration
See what collections exist and inspect sample documents.
Example prompt
"List collections in the app database and show me 3 sample documents from each"
Aggregation Pipeline Drafting
Let AI write complex aggregation pipelines based on what you want to know.
Example prompt
"Write an aggregation to count orders per customer, sorted by total spend descending, top 10"
Data Investigation
Query live data to answer product or debugging questions.
Example prompt
"Find users where lastLogin is older than 90 days and account status is active"
// About
Plain English
MongoDB is a popular database for storing app data — users, orders, posts, anything that doesn't fit neatly into spreadsheet-style tables. Querying it normally means writing code or using a shell with its own special syntax. This server lets you ask MongoDB questions in plain English. Connect it once to your database and you can ask Claude things like 'how many users signed up this month,' 'what collections exist,' 'find the five most recent orders that haven't shipped,' or 'what's the average rating for products in the kitchen category.' The AI translates your question into the right query, runs it, and reads the answer back. It's especially useful for product managers who want to pull a quick number without bothering an engineer, for developers exploring an unfamiliar database, and for anyone who needs a one-off lookup but doesn't query MongoDB often enough to remember the syntax. The strong recommendation: connect with a read-only database user. AI is fast and confident, and you don't want a misunderstood prompt to delete a collection. Test on a development copy before pointing it at production.
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.
// Use Cases
- Query MongoDB collections with natural language
- Explore document schemas without writing code
- Run complex aggregation pipelines through conversation
- Manage Atlas clusters and configurations
// Works With
// Also Consider
// Related Servers
PostgreSQL MCP
Official PostgreSQL MCP server — query and inspect Postgres databases with read-only access for safe AI-powered data analysis.
SQLite MCP
Official SQLite server — query, analyze, and modify local SQLite databases through natural language with full SQL support.
Supabase MCP
Official Supabase MCP server — manage your Supabase projects, run SQL, handle migrations, and interact with Edge Functions via AI.