mcpservers.md

MongoDB MCP

Official MongoDB MCP server — query collections, inspect schemas, and manage documents through AI-powered natural language.

TRUSTED · Official
{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server", "--connectionString", "mongodb://localhost:27017"]
    }
  }
}

Paste into your client's MCP configuration file.

"List all collections in my MongoDB database and show their document counts"

Easy Setup

API key or simple config

Light usage
  • 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
  • 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
1

Collection Exploration

See what collections exist and inspect sample documents.

"List collections in the app database and show me 3 sample documents from each"

2

Aggregation Pipeline Drafting

Let AI write complex aggregation pipelines based on what you want to know.

"Write an aggregation to count orders per customer, sorted by total spend descending, top 10"

3

Data Investigation

Query live data to answer product or debugging questions.

"Find users where lastLogin is older than 90 days and account status is active"

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.

GitHub 2.6kUpdated Feb 14, 2025Apache-2.0
Claude Cursor Cline
#mongodb#nosql#database#atlas#official