How to Connect MongoDB Remote MCP to Claude Code
Add MongoDB's remote MCP server to Claude Code in about a minute.
Step-by-step
- Run the add command
claude mcp add --transport http mongodbhttps://mcp.mongodb.com/mcp``. - AuthorizeOn first use your client opens a MongoDB OAuth consent screen โ approve it and tools become available. Run
/mcpinside Claude Code to trigger the OAuth flow. - Verify statusRun
claude mcp listโ the server should show as connected. If the OAuth callback never completes, remove it withclaude mcp remove mongodb, re-add, and make sure the browser can reach the callback URL. Verify in the browser: pastehttps://mcp.mongodb.com/mcpinto remotemcp.net/inspector and run initialize + tools/list.
Troubleshooting OAuth / 401
- A
401 Unauthorizedon first connect is normal โ the endpoint is OAuth-protected; let Claude Code finish the browser consent flow. - If the consent window never opens, remove and re-add the server, then retry.
- Check the exact challenge at our OAuth debugger.
- Run the live endpoint through the online inspector to see the raw JSON-RPC exchange.
Or add to ~/.cursor/mcp.json:
{
"mcpServers": {
"mongodb": {
"url": "https://mcp.mongodb.com/mcp"
}
}
}claude mcp add --transport http mongodb https://mcp.mongodb.com/mcp
Or add to .vscode/mcp.json:
{
"servers": {
"mongodb": {
"type": "http",
"url": "https://mcp.mongodb.com/mcp"
}
}
}- Open Settings โ Connectors (Integrations) โ Add Custom Connector.
- Paste the endpoint URL:
https://mcp.mongodb.com/mcp - Complete the browser OAuth 2.1 login flow when prompted.
Bridge the remote endpoint into stdio with mcp-remote in claude_desktop_config.json:
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mcp.mongodb.com/mcp"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"mongodb": {
"serverUrl": "https://mcp.mongodb.com/mcp"
}
}
}Add to ~/.kiro/settings/mcp.json (or .kiro/settings/mcp.json in your workspace), then reopen Kiro's Agent panel to pick up the server:
{
"mcpServers": {
"mongodb": {
"url": "https://mcp.mongodb.com/mcp"
}
}
}Add to ~/.codex/config.toml โ Codex reads remote HTTP servers from [mcp_servers.*] tables:
[mcp_servers.mongodb] url = "https://mcp.mongodb.com/mcp"
Add to cline_mcp_settings.json (Cline โ MCP Servers โ Configure), or paste it via Cline's MCP marketplace file:
{
"mcpServers": {
"mongodb": {
"type": "streamableHttp",
"url": "https://mcp.mongodb.com/mcp"
}
}
}Add to ~/.gemini/settings.json under mcpServers โ httpUrl for Streamable HTTP, url for legacy SSE:
{
"mcpServers": {
"mongodb": {
"httpUrl": "https://mcp.mongodb.com/mcp"
}
}
}Tools exposed by MongoDB (36)
| Tool | Safety | Description | Parameters |
|---|---|---|---|
| list-connections ~32 tok | ๐ข Read | List configured MongoDB connections. | โ |
| connect ~33 tok | ๐ข Read | Connect to a MongoDB instance or Atlas cluster. | โ |
| list-databases ~31 tok | ๐ข Read | List databases of a connection. | โ |
| list-collections ~31 tok | ๐ข Read | List collections of a database. | โ |
| collection-indexes ~31 tok | ๐ข Read | List indexes of a collection. | โ |
| collection-schema ~32 tok | ๐ข Read | Infer the schema of a collection. | โ |
| collection-storage-size ~33 tok | ๐ข Read | Get storage size of a collection. | โ |
| db-stats ~27 tok | ๐ข Read | Get database statistics. | โ |
| count ~29 tok | ๐ข Read | Count documents matching a filter. | โ |
| find ~29 tok | ๐ข Read | Run a find query on a collection. | โ |
| aggregate ~29 tok | ๐ข Read | Run an aggregation pipeline. | โ |
| explain ~31 tok | ๐ข Read | Explain a find or aggregate query plan. | โ |
| insert-one ~28 tok | ๐ Write | Insert a single document. | โ |
| insert-many ~29 tok | ๐ Write | Insert multiple documents. | โ |
| update-one ~28 tok | ๐ Write | Update a single document. | โ |
| update-many ~29 tok | ๐ Write | Update multiple documents. | โ |
| rename-collection ~29 tok | ๐ Write | Rename a collection. | โ |
| delete-one ~28 tok | ๐ด Destructive | Delete a single document. | โ |
| delete-many ~29 tok | ๐ด Destructive | Delete multiple documents. | โ |
| drop-collection ~28 tok | ๐ด Destructive | Drop a collection. | โ |
| drop-database ~27 tok | ๐ด Destructive | Drop a database. | โ |
| create-index ~30 tok | ๐ Write | Create an index on a collection. | โ |
| export ~29 tok | ๐ข Read | Export query results to a file. | โ |
| mongodb-logs ~30 tok | ๐ข Read | Retrieve MongoDB server logs. | โ |
| atlas-list-orgs ~31 tok | ๐ข Read | List MongoDB Atlas organizations. | โ |
| atlas-list-projects ~29 tok | ๐ข Read | List Atlas projects. | โ |
| atlas-list-clusters ~29 tok | ๐ข Read | List Atlas clusters. | โ |
| atlas-inspect-cluster ~31 tok | ๐ข Read | Inspect an Atlas cluster. | โ |
| atlas-create-cluster ~30 tok | ๐ Write | Create an Atlas cluster. | โ |
| atlas-create-free-cluster ~34 tok | ๐ Write | Create a free-tier Atlas cluster. | โ |
| atlas-list-db-users ~31 tok | ๐ข Read | List Atlas database users. | โ |
| atlas-create-db-user ~32 tok | ๐ Write | Create an Atlas database user. | โ |
| atlas-list-access-list ~33 tok | ๐ข Read | List Atlas IP access list entries. | โ |
| atlas-create-access-list ~33 tok | ๐ Write | Add an Atlas access list entry. | โ |
| atlas-inspect-access-list ~33 tok | ๐ข Read | Inspect the Atlas access list. | โ |
| atlas-connect-cluster ~34 tok | ๐ข Read | Get connection details for a cluster. | โ |
Connect MongoDB to another client
Other servers for Claude Code
GitHub's official remote MCP server hosted at api.githubcopilot.com. Gives AI agents first-party access to repositories, issues, pull requests and code search.
Notion's official hosted MCP server. Agents can search your workspace, read and create pages, and query databases over Streamable HTTP or SSE.
Linear's official remote MCP server. Agents can search, create and update issues and query your team's workflow over Streamable HTTP or SSE.
Figma's official remote MCP server. Agents can pull design context, variables, Code Connect mappings and screenshots from your Figma files.
AWS Knowledge's hosted remote MCP server. AWS's fully-managed public knowledge MCP gives agents access to the latest AWS documentation, API references, What's New posts and architectural guidance across all AWS services. It is public and unauthenticated โ connect and call tools immediately.
Stripe's official remote MCP server at mcp.stripe.com. Agents can query customers, payment intents and subscriptions and invoke Stripe API operations with OAuth.