mongodb-mcp-server
Copilot instructions1.1k starsChanged 19 months agoApache-2.0View on GitHub
This project is a monorepo implementing the MCP (Model Context Protocol) server that lets users interact with their MongoDB clusters and MongoDB Atlas accounts. It is built using TypeScript, Node.js, pnpm workspaces, and the official @modelcontextprotocol v2 SDK packages (client, server, core, node). The server ships as the v3 API: a set of scoped @mongodb-js/mcp-* packages. The mongodb-mcp-server package is the binary CLI distribution (npx mongodb-mcp-server / MCPB) — library embedding uses the scoped packages. This project uses pnpm workspaces…
Trending
Less talk lately.about the whole repository
Who's talking about mongodb-js/mongodb-mcp-server
- EnduranceLabs/journal-bastion“chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.5”GitHub · Oct 5, 2026
- EnduranceLabs/journal-bastion“chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.4”GitHub · Sep 28, 2026
- forgeprint/forgeprint“feat(mongodb-mcp): read-only MongoDB, pinned at 3.0.4”GitHub · Sep 24, 2026
- EnduranceLabs/journal-bastion“chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.3”GitHub · Sep 21, 2026
- tmasjc/screen-job-resume-skill“Major revamp”GitHub · Sep 12, 2026
The biggest 5 of 29 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 29
Talked about on GitHub (29 times).
On GitHub · 29
- Oct 5, 2026chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.5 — EnduranceLabs/journal-bastion0 reactions
- Sep 28, 2026chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.4 — EnduranceLabs/journal-bastion0 reactions · 1 comment
- Sep 24, 2026feat(mongodb-mcp): read-only MongoDB, pinned at 3.0.4 — forgeprint/forgeprint0 reactions
- Sep 21, 2026chore(deps): bump mongodb-mcp-server from 2.1.0 to 3.0.3 — EnduranceLabs/journal-bastion0 reactions · 1 comment
- Sep 12, 2026Major revamp — tmasjc/screen-job-resume-skill0 reactions
24 more on GitHub
- Sep 7, 2026chore(deps): bump mongodb-mcp-server from 2.1.0 to 2.1.1 — EnduranceLabs/journal-bastion0 reactions · 1 comment
- Aug 17, 2026Publish MongoDB Atlas Remote and Refresh Direct Database Support — obot-platform/obot0 reactions · 1 comment
- Jul 24, 2026mongodb-mcp-server: init at 1.14.0 — NixOS/nixpkgs0 reactions · 4 comments
- Jun 29, 2026[调研] 20+ 热门 MCP 项目机制清单与 hy-workflow 完美期望态 — voxServalG/hy-workflow-mcp0 reactions
- Jun 15, 2026[Feature]: Seed community.json and official.json source packs with real entries from known agent-skill publishers — ar27111994/agent-harness0 reactions · 1 comment
- Jun 6, 2026部分体积较大的mcp安装失败率非常高 — samanhappy/mcphub0 reactions · 1 comment
- Jun 4, 2026feat(content): add mongodb-mcp-server — JSONbored/awesome-claude0 reactions · 2 comments
- Jun 3, 2026Try Mongodb MCP — jabrena/plinth0 reactions · 1 comment
- Apr 23, 2026[Tool Scout] 3 New Tool Suggestions — 2026-04-23 — chintanmehta21/claude-agents0 reactions · 1 comment
- Apr 19, 2026Add mongo-mcp — TrivadisPF/platys-modern-data-platform0 reactions
- Feb 4, 2026Does this package support HTTP transport ? — 441126098/mongo-mcp0 reactions · 1 comment
- Jan 12, 2026chore: fix compass-web builds for database tool calls — mongodb-js/compass0 reactions · 3 comments
- Nov 13, 2025[WIP] Add 6 new partners to collections and agents directory — github/awesome-copilot0 reactions
- Nov 11, 2025Add 18 MCP servers organized for progressive discovery — ArtemisAI/code-execution-with-MCP0 reactions
- Nov 6, 2025Add MongoDB MCP Server for GitHub Custom Agents — gagik/our-shopping-list0 reactions · 3 comments
- Nov 6, 2025chore(deps): bump mongodb-mcp-server from 1.0.3-prerelease.1 to 1.2.0 — mongodb-js/vscode0 reactions · 1 comment
- Oct 27, 2025Openspec - Context7 MCP - GitMCP- MongoDB MCP Kurulumu — Ai-Seo-Optimizer/ai-process-pipeline0 reactions
- Oct 16, 2025feat: export enums as string unions instead of enums — mongodb-js/atlas-local-lib-js0 reactions · 1 comment
- Oct 2, 2025MCP Server For Creating Registry Entries — stacklok/toolhive-catalog0 reactions · 1 comment
- Sep 19, 2025chore: update mongosh — mongodb-js/vscode0 reactions
- Sep 3, 2025ci: enforce conventional commit style — mongodb/atlas-local-lib0 reactions
- Jun 17, 2025Add MongoDB MCP server to registry — stacklok/toolhive0 reactions
- May 14, 2025Mongodb official MCP Server — ipenywis/onemcp-hub0 reactions · 1 comment
- May 2, 2025Add MongoDB official mcp server — modelcontextprotocol/servers0 reactions · 3 comments
In this repositoryOne other file it gives its agents.
The file
We split this copilot-instructions.md into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Test packages: packages/integration-tests (start the server and interact with it), packages/accuracy-tests (accuracy tests that use …
- Very specific: line 39
Always follow the eslint and prettier rule formats specified in eslint.config.js and .prettierrc.json.
- Distinctive: line 40
Use classes for stateful components and functions for stateless pure logic.
- Distinctive: line 41
Use dependency injection to provide dependencies between components.
- Distinctive: line 42
Avoid using global variables as much as possible.
- Very specific: line 60
All tools MUST provide a Zod schema (argsShape) that clearly specifies the API of the tool.
- Distinctive: line 69
If a new tool is added, or the tool description is modified, the accuracy tests MUST be updated too.
- Distinctive: line 77
Ensure there are proper timeout mechanisms to avoid long-running queries that can affect the server.
- Very specific: line 79
If a tool requires elicitation, it must be added to the confirmationRequiredTools list in packages/cli/src/config/userConfig.ts (the …
- Very specific: line 86
If a response field comes from the Atlas API, format it with formatUntrustedData before returning it to the client.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Overview
This project is a monorepo implementing the MCP (Model Context Protocol) server that lets users interact with their MongoDB clusters and MongoDB Atlas accounts. It is built using TypeScript, Node.js, pnpm workspaces, and the official @modelcontextprotocol v2 SDK packages (client, server, core, node).
The server ships as the v3 API: a set of scoped @mongodb-js/mcp-* packages. The mongodb-mcp-server package is the binary CLI distribution (npx mongodb-mcp-server / MCPB) — library embedding uses the scoped packages.
Folder Structure
This project uses pnpm workspaces (pnpm-workspace.yaml). The source of the server lives in packages/*:
packages/mongodb-mcp-server: The shipped CLI binary entrypoint and its scripts.packages/cli: CLI wiring —runMcpCli,CliServer,Session,parseUserConfig,UserConfigSchema,applyConfigOverrides,create*FromConfigfactories,Resources.packages/core: Shared infrastructure —ToolBase/ToolClass,StdioRunner,InMemoryTransport,SessionStore,Keychain,Elicitation,NoopLogger,NoopTelemetry,McpServerre-export.packages/http-runners: HTTP transport —StreamableHttpRunner,MCPHttpServer,MonitoringServer.packages/tools-mongodb: MongoDB tools (MongoDBTools,MongoDBToolBase), connection management (MCPConnectionStore,MCPConnectionManager,ConnectionRegistry),ErrorCodes,MongoDBError.packages/tools-atlas: Atlas Admin API tools (AtlasTools).packages/tools-atlas-local: Atlas Local tools (AtlasLocalTools).packages/tools-assistant: Assistant / knowledge tools (AssistantTools).packages/atlas-api-client: Atlas API client (ApiClient,ClientCredentialsAuthProvider).packages/atlas-telemetry: Telemetry pipeline (AtlasTelemetry).packages/logging: Loggers (ConsoleLogger,DiskLogger,McpLogger).packages/metrics: Metrics (PrometheusMetrics,createDefaultMetrics).packages/types: Shared types (UserConfig,TransportRequestContext,ToolCategory,OperationType,ServerMetadata,McpSession, …).packages/ui: MCP UI resources (UIRegistry).- Test packages:
packages/integration-tests(start the server and interact with it),packages/accuracy-tests(accuracy tests that use different models to ensure tools have reliable descriptions),packages/eval-tests,packages/browser-tests,packages/test-utils. packages/scripts: repo maintenance scripts (API report generation, tool argument/UI generation, release notes).
Libraries and Frameworks
- Zod for message and schema validation.
- Express for the HTTP Transport implementation.
- mongosh NodeDriverServiceProvider for connecting to MongoDB.
- vitest for testing (run per-package).
@modelcontextprotocol/server,@modelcontextprotocol/client,@modelcontextprotocol/core, and@modelcontextprotocol/nodefor the protocol implementation (v2 SDK).
Coding Standards
- For declarations, use types. For usage, rely on type inference unless it is not clear enough.
- Always follow the eslint and prettier rule formats specified in
eslint.config.jsand.prettierrc.json. - Use classes for stateful components and functions for stateless pure logic.
- Use dependency injection to provide dependencies between components.
- Avoid using global variables as much as possible.
- New functionality MUST be under test.
- Tools MUST HAVE integration tests.
- Tools MUST HAVE unit tests.
- Tools MAY HAVE accuracy tests.
Architectural Guidelines and Best Practices
Every agent connected to the MCP Server has a Session (per-session context, from @mongodb-js/mcp-cli; typed as McpSession) attached to it. The Session is the main entrypoint for dependencies to other components — any component that MUST be used by either a tool or a resource MUST be provided through the Session.
Note: MongoDB connection state lives at the app level, not in the Session — it lives in the ConnectionRegistry (from @mongodb-js/mcp-tools-mongodb, e.g. via MCPConnectionStore.view()), shared across sessions, and is addressed by the connectionId tool argument.
Guidelines for All Tools
Tools extend ToolBase from @mongodb-js/mcp-core and must conform to ToolClass (static toolName, category, operationType; description; zod argsShape; execute(); resolveTelemetryMetadata()).
- The name of the tool should describe an action:
create-collection,insert-many. It must be unique across the server. - The description MUST be a simple and accurate prompt that defines what the tool does in an unambiguous way.
- All tools MUST provide a Zod schema (
argsShape) that clearly specifies the API of the tool. - The Operation type MUST be clear:
metadata: Reads metadata for an entity (for example, a cluster). Example: CollectionSchema.read: Reads information from a cluster or Atlas.create: Creates resources, like a collection or a cluster.delete: Deletes resources or documents, like collections, documents or clusters.update: Modifies resources or documents, like collections, documents or clusters.connect: Connects to a MongoDB cluster.
- The tool category MUST be one of
mongodb|atlas|atlas-local|assistant|custom(see per-category guidelines below). - If a new tool is added, or the tool description is modified, the accuracy tests MUST be updated too.
Guidelines for MongoDB Tools (packages/tools-mongodb)
- The tool category MUST be
mongodb. - They MUST call
this.ensureConnected()before attempting to query MongoDB. - They MUST return content sanitized using
formatUntrustedData. - Documents should be serialized with
EJSON.stringify. - Ensure there are proper timeout mechanisms to avoid long-running queries that can affect the server.
- Tools that require elicitation MUST implement
getConfirmationMessageand provide an easy-to-understand message for a human running the operation.- If a tool requires elicitation, it must be added to the
confirmationRequiredToolslist inpackages/cli/src/config/userConfig.ts(thedefaultUserConfig).
- If a tool requires elicitation, it must be added to the
Guidelines for Atlas Tools (packages/tools-atlas)
- The tool category MUST be
atlas. - They interact with the Atlas Admin API through
ApiClient(from@mongodb-js/mcp-atlas-api-client), provided via the Session (session.apiClient). - Atlas tools that make slow paginated API calls should consider timeouts / limits appropriate for the server.
- If a response field comes from the Atlas API, format it with
formatUntrustedDatabefore returning it to the client.
Guidelines for Assistant Tools (packages/tools-assistant)
- The tool category MUST be
assistant.
Custom Tools
- A custom tool in a consumer embedding uses category
custom(seeMCP_SERVER_LIBRARY.mdand the v1→v3 migration skill for the embedding API).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

