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.
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.
- `connect` takes a `connection_string` and a `database_name`; `disconnect` closes it
- `create` inserts a document into a named collection
- `read` queries with an optional `filter`, `limit` and `skip`
- `update` takes a `filter` and an `update` document, with optional `upsert`
- `delete` removes documents matching a filter
- Standard MongoDB query syntax throughout, so operators like `$gte` and `$set` work as written
- ObjectId and similar types converted to strings automatically in results
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.
Build from source — clone the repository and build it, then point your client at the binary
