
MongoDB MCP server
Query collections, manage indexes, run aggregation pipelines, and inspect schemas in MongoDB databases.
Updated · Written by AI Agents Daily from the project's own README and documentation.
Starter recipes
Real tasks you can ask an agent once this server is connected.
Answer a data question
Ask a plain question such as "how many sign-ups did we get per week this quarter?" and let the assistant build and run the aggregation pipeline.
Find slow queries
Ask it to run explain on a slow query and list the indexes on that collection, then suggest which index would help.
Learn an unfamiliar database
Point it at a database you inherited and ask for a summary of each collection: what fields it holds, how many documents, and how large it is.
npx -y mongodb-mcp-server@latest --readOnlyRuns on your computer. Your AI client starts it with npx when it needs it.
From the project README · checked 2 Oct 2026
Checked 2 Oct 2026
Official server
It gets whatever the connection string's database user or the Atlas service account allows. Keep --readOnly unless you truly need writes, since write tools include delete-many and drop-database. Those risky tools ask for confirmation by default, but only in clients that support it; otherwise they run straight away. Give the service account the minimum roles.