drio
Open app

MongoDB MCP Server

Source

MongoDB MCP Server

Catalog onlyCatalog onlySTDIO

Overview

MongoDB MCP Server is a Model Context Protocol server that provides read-only access to MongoDB databases through standardized MCP tools and resources, enabling AI assistants to query and analyze data safely.

To use the MongoDB MCP Server, set up the environment variables with your MongoDB connection string, build the server from source, and integrate it with applications like Claude Desktop or Claude Web.

  • Database exploration and schema discovery - Query execution with filtering, projection, sorting, and limiting - Read-only aggregation pipelines and full-text search - Geospatial queries and document operations - Data analysis and performance insights - Format conversion for query results
  1. Enabling AI assistants to perform data analysis without write access.
  2. Providing safe data exploration capabilities for developers.
  3. Integrating with applications for enhanced data querying.

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-jonfreeland": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-jonfreeland"
      ]
    }
  }
}

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-jonfreeland": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-jonfreeland"
      ]
    }
  }
}

Claude Code

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

.mcp.json (project root)

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

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-jonfreeland": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-mongodb-mcp-jonfreeland"
      ]
    }
  }
}

Windsurf

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

~/.codeium/windsurf/mcp_config.json

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

Cline

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

Cline MCP Settings (via UI)

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

FAQ

Is MongoDB MCP Server secure?

Yes, it is designed to provide read-only access to ensure data safety.

What are the prerequisites for using MongoDB MCP Server?

You need network access to a MongoDB server and appropriate read permissions.

Can I use MongoDB MCP Server with any MongoDB instance?

Yes, as long as you have the correct connection string and permissions.7:["$","div",null,{"className":"container mx-auto flex flex-col gap-4","children":["$L26","$L27",["$","$L28",null,{"currentProject":{"id":1769,"uuid":"e5dbebe0-3f2b-4fe3-bb04-f2977da9455b","name":"mongodb-mcp","title":"MongoDB MCP Server","description":"MongoDB MCP Server","avatar_url":"https://avatars.githubusercontent.com/u/264100?v=4","created_at":"2025-03-05T05:15:54.393Z","updated_at":"2025-03-12T10:20:53.845Z","status":"created","author_name":"jonfreeland","author_avatar_url":"https://avatars.githubusercontent.com/u/264100?v=4","tags":"model-context-protocol,mcp-server","category":"developer-tools","is_featured":false,"sort":1,"url":"https://github.com/jonfreeland/mongodb-mcp","target":"_self","content":"$29","summary":"$2a","img_url":"https://camo.githubusercontent.com/d0b5e0981d8f49ec17312ce822b1033a45c6f36651957f6caa4467ead4efb7e5/68747470733a2f2f676c616d612e61692f6d63702f736572766572732f636d7977657a7531736e2f6261646765","type":null,"metadata":"{\"star\":\"2\",\"license\":\"MIT license\",\"language\":\"JavaScript\",\"is_official\":false,\"latest_commit_time\":\"2025-03-25 12:22:04\"}","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"}]]}]