connectLABSCO SUMMARY
The connection string is an argument, not a setting — which cuts both ways.
Passing credentials at call time means one server can reach several databases without restarting, and it also means the connection target is whatever the conversation says it is, with no allowlist in between. Combined with an unrestricted delete, that argues for pointing this at a development database, or at a Mongo user whose permissions match what you are willing to lose.
What it is
A FastMCP server that exposes MongoDB operations as six tools. The connection is established by a tool call rather than by configuration, so the client picks the connection string and database at runtime, and every subsequent operation runs against whatever was connected. ObjectIds and other Mongo-specific types are serialised to strings on the way out.
What you get
connecttakes aconnection_stringand adatabase_name;disconnectcloses itcreateinserts a document into a named collectionreadqueries with an optionalfilter,limitandskipupdatetakes afilterand anupdatedocument, with optionalupsertdeleteremoves documents matching a filter- Standard MongoDB query syntax throughout, so operators like
$gteand$setwork as written - ObjectId and similar types converted to strings automatically in results
Requirements
A reachable MongoDB server — nothing is configured in the environment, since the connection string arrives with the connect call. Python 3.8 or later, MongoDB 3.6 or later, fastmcp 0.2.0 or later and pymongo 4.6.0 or later. Install with uv pip install -e . or pip install -e ., then run python -m my_mongo_mcp.server or the installed my-mongo-mcp command. Project my-mongo-mcp, version 0.1.0. Every tool here writes as well as reads, including delete.
Setup effort
Build from source — clone the repository, then follow the steps on this page and add the configuration for your client
USE CASES
Exploring a collection you did not design
Connect, read a filtered sample with a limit, and see the shape of the documents.
Fixing a handful of records
Filter to the ones that are wrong and apply an update in one call.
Seeding test data
Insert documents into a collection from the conversation instead of writing a script.
Switching between two databases
Disconnect and reconnect with a different connection string without restarting the server.
6 tools
Listed in project docs. Your client may show a different list.
disconnectcreatereadupdatedeleteBEFORE YOU INSTALL
What to know first
Tools you get
6 tools named in the project's documentation.
Requires
- python on PATH
- Python 3.8+
Where it runs
The documented client runs the server on your machine.
INSTALLATION
Connect your client
Clone the repository, then follow the steps on this page and add the configuration for your client. This one is built from source rather than installed with a single command.
Server setup
Setup
git clone https://github.com/linpeibiao/mongodb-mcp-server.git
cd mongodb-mcp-server
pip install -e .python
python -m my_mongo_mcp.serverMCP Clients
Claude Desktop
{
"mcpServers": {
"mongodb": {
"command": "python",
"args": [
"-m",
"my_mongo_mcp.server"
],
"env": {}
}
}
}python here must be the Python you ran pip install -e . with; if that is a virtual environment, put the full path of its python in command. No connection string goes in the config — the connect tool takes it at runtime.