MongoDB MCP

Exposes collections, indexes, and aggregation pipelines so an agent can inspect a database instead of guessing its shape.

Official TypeScript stdio

What it does

Exposes collections, indexes, and aggregation pipelines so an agent can inspect a database instead of guessing its shape. The setup command writes credentials to a local config, which is convenient and worth reading before you point it at production. Aggregation stages fail quietly, so verify counts rather than trusting plausible output.

Install

Terminal
npx -y mongodb-mcp-server@latest setup

Client configuration

Paste this into your MCP client config (Claude Desktop, Cursor, or any client that reads mcpServers), then restart the client.

mcp.json
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "setup"
      ]
    }
  }
}

When to use it

Reach for this when the task needs database inside the agent loop. Skip it if a plain shell command or a one-off script is enough — every server you add costs context and adds a failure mode.

Other TypeScript servers

  • Filesystem — Gives an agent scoped read, write, and search access to directories you explicitly allow
  • Memory — A persistent knowledge graph stored in a local JSON file, exposed through entities, relations, and observations
  • Sequential Thinking — Gives the model a scratchpad for structured, revisable reasoning: numbered thoughts that can branch, revise, and conclude