Add MCP server for managing MongoDB clusters#346
Draft
GromNaN wants to merge 2 commits intomongodb-labs:masterfrom
Draft
Add MCP server for managing MongoDB clusters#346GromNaN wants to merge 2 commits intomongodb-labs:masterfrom
GromNaN wants to merge 2 commits intomongodb-labs:masterfrom
Conversation
- Add mongo_orchestration/mcp_server.py exposing three MCP tools: start_cluster, stop_cluster, list_clusters - The MCP server auto-starts mongo-orchestration if not running, and picks up mo-config.json for multi-version support - Add mongo-orchestration-mcp entry point to pyproject.toml - Document the MCP server in README.rst
Tests cover start_cluster (all topologies, version, auth, error cases), stop_cluster, list_clusters, and _ensure_running using mocked HTTP calls. No MongoDB binary or running mongo-orchestration instance required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mongo_orchestration/mcp_server.py: an MCP (Model Context Protocol) server that exposes three tools to AI assistants (e.g. Claude Code):start_cluster,stop_cluster, andlist_clusters.mongo-orchestrationif it is not already running.mo-config.json: map version labels to MongoDB binary directories (compatible with themversion manager).mongo-orchestration-mcpentry point inpyproject.toml.README.rst.Why an MCP server rather than a prompt skill?
The primary use case is driver and library development against MongoDB: a developer asks an AI assistant to run a test suite against a specific topology and version, and the assistant needs to manage clusters autonomously as part of a larger task.
A prompt skill (e.g.
/mongo-launch) requires the user to explicitly invoke each step. An MCP server exposes structured tools that the AI can call on its own initiative mid-task:start_clusterto provision the cluster and obtain the connection URI.stop_clusterto clean up.This end-to-end flow — provision → test → teardown — happens without manual intervention, which is exactly what MCP tools are designed for. A skill would require the user to orchestrate each step themselves.
Test plan
mongo-orchestration-mcpis on the PATH.~/.claude.jsonand verify Claude Code lists the three tools.start_clusterwithcluster_type="single","repl", and"shard"and verify each cluster starts and returns a connection URI.list_clustersand verify all running clusters appear.stop_clusterfor each running cluster and verify they stop cleanly.mo-config.jsonwith version paths and verifystart_cluster(version="7.0")starts the correct binary._ensure_running()startsmongo-orchestrationautomatically when not already running.