MCP server
MongoDB MCP server
MongoDB's official MCP server lets AI query collections, run aggregations and manage Atlas clusters, with a read-only flag for safe use.
- Official server
- Databases
At a glance
- Maintained by
- MongoDB
- Tools exposed
- 10 listed below
- Reviewed
- September 24, 2026
Why it matters
What it does and why it matters
MongoDB stores data as flexible documents, which is common in modern web and mobile apps. Its official MCP server lets an AI assistant find documents, count them, run aggregation pipelines and describe a collection's schema. It can also list and manage Atlas clusters when given Atlas credentials.
For business teams, this turns questions about app data into plain-English requests. For developers, it speeds up exploring data and writing aggregation pipelines, which are powerful but hard to write by hand.
The server has a read-only flag that limits it to read, connect and metadata tools. We use that flag for everything except development work. Atlas management tools use a service account, so keep those credentials separate from data access and give them the smallest role that works.
Use cases
Best business use cases
App analytics
Aggregation help
Schema discovery
Atlas overview
Support lookups
Tools
Available tools
Tool names as published by the maintainer at review time. Versions change, so check the repository for the current list.
Read and write: Read and write for databases and Atlas; the --readOnly flag limits it to read, connect and metadata tools.
-
findRuns a query against a collection.
-
aggregateRuns an aggregation pipeline.
-
countCounts documents that match a filter.
-
insert-manyInserts many documents into a collection.
-
update-manyUpdates all documents that match a filter.
-
delete-manyDeletes documents that match a filter.
-
list-databasesLists databases on the connection.
-
list-collectionsLists collections in a database.
-
collection-schemaDescribes the schema of a collection.
-
atlas-list-clustersLists Atlas clusters in a project.
Workflows
Example workflows
Weekly signup report
-
1
Start the server with the read-only flag.
-
2
Ask for signups by source for the last four weeks.
-
3
The assistant builds an aggregation pipeline.
-
4
It runs it and presents a table.
-
5
You ask for the trend compared with last month.
Understand a new collection
-
1
A developer joins a project.
-
2
They ask the assistant to describe each collection.
-
3
It samples documents and reports the schema.
-
4
It highlights fields that vary between documents.
-
5
The developer writes queries with that knowledge.
Prompts
Example prompts
“How many new users signed up each week this month, grouped by signup source?”
“Describe the schema of the orders collection and any fields that vary.”
“List our Atlas clusters and their tiers.”
Setup
Installation and configuration
Examples for Claude Desktop and Claude Code. Replace the placeholder values with your own keys, and store secrets outside version control.
Claude Desktop: claude_desktop_config.json
{
"mcpServers": {
"MongoDB": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server@latest",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
}
}
}
}
Claude Code: terminal
claude mcp add mongodb -e MDB_MCP_CONNECTION_STRING="mongodb://localhost:27017/myDatabase" -- npx -y mongodb-mcp-server@latest --readOnly
- Local server: stdio. npm: mongodb-mcp-server.
- Needs: MDB_MCP_CONNECTION_STRING (database connection string); or for Atlas: MDB_MCP_API_CLIENT_ID and MDB_MCP_API_CLIENT_SECRET (service account).
Security
Security considerations
-
Least privilege
Create a dedicated database user that can read only the tables the assistant needs.
-
Use a replica
Point the server at a read replica or copy, not the primary production database.
-
Log every query
Keep a log of the queries the assistant runs, and review it in the first weeks.
-
Watch for sensitive data
Use the read-only flag and a database user limited to the collections the assistant needs.
Related servers
Servers that pair well with it
PostgreSQL
Lets AI assistants explore a PostgreSQL database, run SQL in a restricted read-only mode and check query performance and database health.
Redis
Redis's official MCP server lets AI read and write Redis data structures, search vector indexes and inspect server information.
Supabase
Supabase's official hosted MCP server lets AI work with your Supabase projects: tables, SQL, migrations, edge functions, branches and docs.
Keep exploring
Solutions and services that use it
Related services
View all related services- MCP integration Connect AI assistants to your CRM, files, databases and tools through Model Context Protocol servers, with safe permissions.
- Database design Data models that stay fast and correct as your business grows, with backups and access rules in place.
- Multi-tenant architecture One product serving many customer accounts, with each account's data kept separate and secure.
- Product scaling Keep a growing product fast and stable as users, data and features increase.
- Web applications Custom browser-based software for the work your team does every day, from booking tools to operations systems.
- Dashboards and reporting Dashboards that pull numbers from the systems you already use and show what matters without a spreadsheet.
Solutions
View all solutions- Automated reporting Reports that build themselves from your systems on schedule, with a plain-language summary of what changed.
- Knowledge assistant (RAG) Ask a question in plain words and get an answer from your own documents, with links to the sources.
- Forecasting dashboards Forecast demand from your sales history and seasonality, and flag items to reorder before they run out.
- Payroll automation Turn pay rules, attendance and leave into tested software so the monthly run becomes a review and payslips go out in one batch.
- AI sales research agent Short, sourced briefings on each prospect before a call, drafted by an AI agent from public information and your CRM.
- AI automation and integrations Connect the tools you already use so data moves once, correctly, and AI reads the parts that arrive as text or documents.
Industries
View all industriesCase studies
View all case studiesGuides and articles
View all guides and articles- How to connect AI to your database safely Let staff ask questions of your data in plain English without risking production systems or sensitive records.
- PostgreSQL vs MySQL The two most popular open-source databases compared for business applications.
- What are AI agents and how do businesses use them? What AI agents are, real business uses, the controls they need and how to start with one safely.
- How to build an AI workflow with MCP servers Plan, connect and test an AI workflow that uses MCP servers, from a single task to a reliable process.
- How to automate reporting with AI and MCP Build reports that assemble themselves from your systems through MCP, with a written summary people can trust.
- How to set up automated reporting Replace manual weekly and monthly reports with dashboards and summaries that update themselves.
AI models
View all ai models- text-embedding-3-large OpenAI's most capable embedding model for search and retrieval, with 3,072-dimension vectors and support for English and other languages.
- text-embedding-3-small OpenAI's efficient, lowest-cost embedding model, with 1,536-dimension vectors for search, retrieval and similarity at scale.
- Cohere Embed v4 Cohere's multimodal embedding model for enterprise search, embedding text, images and mixed documents, with flexible vector sizes and long inputs.
- Voyage 4 Voyage AI's current embedding series, now part of MongoDB, with large, standard and lite models that share one embedding space.
- Embeddings Models that turn text into vectors for search, retrieval, clustering and recommendations.
- Claude Opus 5.5 Anthropic's recommended starting point for most serious work: long-running agentic coding and knowledge work, with a 1M token context window.
Glossary terms
View all glossary terms- Database A database is an organized store of data that software can search, update and keep consistent, such as customers, orders or bookings.
- AI agent An AI agent is software that uses a language model to plan steps, call tools and act toward a goal, instead of only answering one question.
- MCP server An MCP server is a program or hosted service that exposes a system's data and actions as tools that AI assistants can use through the Model Context Protocol.
- Model Context Protocol The Model Context Protocol, or MCP, is an open standard for connecting AI assistants to external tools and data in a consistent way.
- Vector database A vector database stores embeddings, lists of numbers that represent meaning, and quickly finds the ones most similar to a query.
- Backend The backend is the part of an application that runs on servers, storing data, applying business rules and serving the frontend through APIs.
FAQ
Questions people ask us
Have a question that is not here? Ask us directly.
Yes. It is maintained by MongoDB.
Yes. The read-only flag limits it to read, connect and metadata tools.
It connects to any database with a connection string, and can manage Atlas with a service account.