drio
Open app

MongoDB MCP Server

Source

A Model Context Protocol server for MongoDB integration with Claude

Catalog onlyCatalog onlySTDIO

Overview

MongoDB MCP Server is a Model Context Protocol server that enables Claude to interact with MongoDB databases, allowing for data analysis and query execution directly through conversations.

To use the MongoDB MCP Server, set it up with Claude Desktop by configuring the MCP server settings and connecting to your MongoDB instance using environment variables for credentials.

  • Executes complex MongoDB aggregation pipelines. - Retrieves random document samples from collections. - Analyzes query performance with execution plans. - Secure connection to MongoDB Atlas using environment variables. - Simple integration with Claude Desktop through the MCP system.
  1. Sampling random documents for quick insights.
  2. Running aggregations to summarize data.
  3. Analyzing query performance to optimize database operations.

Add to your AI client

Use these steps to connect MongoDB MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.

Cursor

Add this to your .cursor/mcp.json file in your project root, then restart Cursor.

.cursor/mcp.json

{
  "mcpServers": {
    "mongodb-mcp-server-ryaker": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

Claude Desktop

Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

{
  "mcpServers": {
    "mongodb-mcp-server-ryaker": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

Claude Code

Add this to your project's .mcp.json file. Claude Code will detect it automatically.

.mcp.json (project root)

{
  "mcpServers": {
    "mongodb-mcp-server-ryaker": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

VS Code (Copilot)

Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.

.vscode/mcp.json

{
  "servers": {
    "mongodb-mcp-server-ryaker": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

Windsurf

Add this to your Windsurf MCP config file, then restart Windsurf.

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "mongodb-mcp-server-ryaker": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

Cline

Open Cline settings, navigate to MCP Servers, and add this server configuration.

Cline MCP Settings (via UI)

{
  "mcpServers": {
    "mongodb-mcp-server-ryaker": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-server-ryaker"
      ]
    }
  }
}

FAQ

Can I use MongoDB MCP Server with any MongoDB instance?

Yes! It can connect to any MongoDB server or MongoDB Atlas.

Is there a specific version of Node.js required?

Yes, Node.js version 14 or newer is required.

How do I troubleshoot connection issues?

Verify your connection string and ensure the MongoDB user has the necessary permissions.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":2762,"uuid":"014c9f56-0492-4f80-8bbf-c392857a38d3","name":"mongodb-mcp-server","title":"MongoDB MCP Server","description":"A Model Context Protocol server for MongoDB integration with Claude","avatar_url":"https://avatars.githubusercontent.com/u/947669?v=4","created_at":"2025-03-14T01:03:27.413Z","updated_at":"2025-03-14T01:26:05.023Z","status":"created","author_name":"ryaker","author_avatar_url":"https://avatars.githubusercontent.com/u/947669?v=4","tags":"[]","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/ryaker/mongodb-mcp-server","target":"_self","content":"$29","summary":"$2a","img_url":null,"type":null,"metadata":"{\"star\":\"0\",\"license\":\"MIT license\",\"language\":\"JavaScript\",\"is_official\":false,\"latest_commit_time\":\"2025-04-12 21:00:26\"}","user_uuid":null,"tools":null,"sse_url":null,"sse_provider":null,"sse_params":null,"is_official":false,"server_command":null,"server_params":null,"server_config":null,"allow_call":false,"is_innovation":false,"is_dxt":false,"dxt_manifest":null,"dxt_file_url":null,"is_audit":false},"randomProjects":[],"currentServerKey":"$undefined"}]]}]