MongoDB MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "MDB_MCP_CONNECTION_STRING=${MDB_MCP_CONNECTION_STRING}" mongodb-mcp -- npx -y mongodb-mcp-server
Required:MDB_MCP_CONNECTION_STRING+ 1 optional
README.md

A Model Context Protocol server for interacting with MongoDB Databases

MongoDB MCP Server

A Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas.

📚 Table of Contents

Prerequisites

  • Node.js
    • At least 20.19.0
    • When using v22 then at least v22.12.0
    • Otherwise any version 23+

`

Tools (2)

mongodb_queryExecute queries against a MongoDB database
mongodb_atlas_list_clustersList MongoDB Atlas clusters

Environment Variables

MDB_MCP_CONNECTION_STRINGrequiredThe MongoDB connection string for database access
MDB_MCP_ATLAS_API_KEYAPI key for MongoDB Atlas management

Configuration

claude_desktop_config.json
{"mcpServers": {"mongodb": {"command": "npx", "args": ["-y", "mongodb-mcp-server"], "env": {"MDB_MCP_CONNECTION_STRING": "mongodb+srv://user:password@cluster.mongodb.net/"}}}}

Try it

Query the 'users' collection in the 'production' database to find all active accounts.
List all my MongoDB Atlas clusters and their current status.
Find the document in the 'logs' collection where the error code is 500.
Count the number of documents in the 'orders' collection created in the last 24 hours.

Frequently Asked Questions

What are the key features of MongoDB MCP Server?

Support for both local and cloud-based MongoDB deployments. Direct querying of MongoDB databases via connection strings. Integration with MongoDB Atlas for cluster management. Configurable read-only mode for secure data access.

What can I use MongoDB MCP Server for?

Quickly querying production database logs to debug application issues. Managing and monitoring MongoDB Atlas cluster health directly from the AI interface. Extracting data from MongoDB collections to perform analysis or generate reports. Automating database administrative tasks through natural language commands.

How do I install MongoDB MCP Server?

Install MongoDB MCP Server by running: npx -y mongodb-mcp-server

What MCP clients work with MongoDB MCP Server?

MongoDB MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MongoDB MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare