mongodb-js/mongodb-mcp-server
A Model Context Protocol server to connect to MongoDB databases and MongoDB Atlas Clusters.
MongoDB MCP Server – Quick Overview
What it is – A Model Context Protocol (MCP) server that lets AI agents talk to MongoDB databases (both self‑hosted and MongoDB Atlas). It implements a standard protocol so tools like Claude, Cursor, GitHub Copilot, Grok, etc., can issue database commands (find, aggregate, create‑index, etc.) without the agent having to embed raw connection logic.
Why it matters – Enables “data‑aware” LLM agents: the model can ask the server for data, run queries, or even create resources in Atlas, all through a safe, read‑only‑by‑default interface.
Key Features (as described in the README)
| Feature | Details |
|---|---|
| Supported AI client integrations | Official plugins for Cursor, VS Code, Claude, Codex, GitHub Copilot CLI, Grok, Gemini. Two plugins are shipped: mongodb-atlas (remote Atlas MCP via OAuth) and mongodb (local server for any MongoDB deployment). |
| Command‑line / Docker deployment | Run locally with npx -y mongodb-mcp-server@latest --readOnly or via Docker (mongodb/mongodb-mcp-server:latest). Environment variables supply either a MongoDB connection string or Atlas Service Account credentials. |
| Read‑only default | The server starts with --readOnly to protect data; remove the flag to enable writes. |
| Rich toolset | Exposes many MongoDB operations as MCP tools (e.g., find, aggregate, create-index, atlas-create-cluster, atlas-get-performance-advisor, etc.). |
| Security recommendations | Prefer environment variables for secrets, grant minimal Atlas API permissions, and keep the server in read‑only mode unless writes are explicitly needed. |
| Configuration flexibility | Supports JSON‑style MCP configuration files, command‑line args, env vars, and a Docker‑based launch. |
| HTTP compatibility | A separate library guide describes how custom HTTP clients can talk to the server (headers, redirects, payload limits). |
| Cloud deployment | Mention of Azure deployment (details in the docs). |
Typical Workflow
- Install the appropriate plugin for your AI assistant (e.g.,
mongodb-atlasin Claude Marketplace). - Provide credentials – either a MongoDB URI (
MDB_MCP_CONNECTION_STRING) or Atlas Service Account client ID/secret (MDB_MCP_API_CLIENT_ID/MDB_MCP_API_CLIENT_SECRET). - Start the server – via
npxor Docker. The server runs as a subprocess that the AI client talks to using the MCP protocol. - Issue commands – The agent can call tools like
find,aggregate-db,atlas-create-cluster, etc., and receive structured JSON results. - Optional write access – Remove
--readOnlyif the agent needs to modify data, after confirming security policies.
Who Might Use This?
- Developers building AI‑augmented applications that need to fetch or manipulate data stored in MongoDB.
- Data‑science teams wanting LLMs to explore their MongoDB datasets safely.
- Ops teams that let AI agents provision or inspect Atlas clusters via the
atlas‑*tools.
Getting Started (quick commands)
# Quick local start (read‑only)
npx -y mongodb-mcp-server@latest setup # interactive wizard
# Or run directly
npx -y mongodb-mcp-server@latest --readOnly
# Docker alternative
docker run --rm -i -e MDB_MCP_CONNECTION_STRING='mongodb://localhost:27017/myDb' \
-e MDB_MCP_READ_ONLY='true' mongodb/mongodb-mcp-server:latest
Where to Learn More
- Full documentation:
https://www.mongodb.com/docs/mcp-server/ - Plugin marketplaces: Cursor, Claude, GitHub Copilot, Grok, Gemini.
- Library guide for custom HTTP clients:
MCP_SERVER_LIBRARY.md.
All information above is taken directly from the repository’s README; no additional features have been inferred.
Related
- Project
- Project
- Project
- Project
- Project