---
title: "MongoDB MCP — Claude & ChatGPT Connector"
method: POST
path: "/api/mcp/mongodb"
tags: ["MCP Server"]
---

# MongoDB MCP — Claude & ChatGPT Connector

`POST /api/mcp/mongodb`

**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:**
```json
{ "jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 1 }
```

**Example — Call tool:**
```json
{
  "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)

## Headers

- `Mcp-Session-Id` string, nullable

## Request body

- MCPRequest
  - `jsonrpc` string — JSON-RPC version. Always '2.0'
  - `method` string — MCP method: initialize | tools/list | tools/call
  - `params` object, nullable — Method parameters. For tools/call: { name, arguments }
  - `id` integer, nullable — Request ID. Echoed back in response.

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi.md) · [All operations](https://skmtc.dev/leapsurgebi/apis/leapsurgeapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/leapsurgebi/leapsurgeapi/revisions/5a6b1464bfeb/schema)
