MCP Server

MongoDB MCP — Claude & ChatGPT Connector

MCP MongoDB Endpoint (ChatGPT & Claude Connector)

URL: POST /api/mcp/mongodb

Header:

  • Mcp-Session-Id (optional but recommended) — will be echoed back in every response.

Methods Supported (method):

  • initialize
  • notifications/initialized
  • ping
  • tools/list
  • tools/call

Example — List tools:

{ "jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1 }

Example — Call tool:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": { "name": "mongodb_find", "arguments": { "database": "mydb", "collection": "orders", "filter_json": "{"status": "active"}", "limit": 50 } },
  "id": 1
}

Tools

  • mongodb_list_databases
  • mongodb_list_collections
  • mongodb_describe_collection
  • mongodb_find
  • mongodb_aggregate
  • mongodb_count_documents
  • mongodb_get_collection_stats
  • mongodb_search_collections

Security

  • Read-only enforced ($out and $merge pipeline stages blocked)
  • Write operators blocked in filters
  • Max documents limited
  • Session header echoed to prevent ChatGPT link expiry

Required env vars: MONGODB_URI, MONGODB_DATABASE (optional default db)

post/api/mcp/mongodb

Headers

Mcp-Session-Idstring nullable

Request body

jsonrpcstring

JSON-RPC version. Always '2.0'

methodstring

MCP method: initialize | tools/list | tools/call

paramsobject nullable

Method parameters. For tools/call: { name, arguments }

idinteger nullable

Request ID. Echoed back in response.

Response

Successful Response

{"stackTrail":"paths:/api/mcp/mongodb:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}

Changes

No recorded changes to this endpoint across all 1 revision of this API.