Fast MongoMcp
README.md
# Fast MongoMcp
> **Educational project:** This project was created purely for educational purposes, to explain how MCP servers work. It is not intended for production use.
## License
This project is licensed under the [MIT License](LICENSE).
An MCP (Model Context Protocol) server that exposes MongoDB operations as tools, enabling AI assistants to query documents, manage collections, and interact with a MongoDB database.
## Installation
### Create a virtual environment
```bash
python3 -m venv venv
source venv/bin/activate # on Windows: venv\Scripts\activate
```
### Install dependencies
```bash
pip install -e .
```
This installs the project in **editable mode**, meaning changes to the source files take effect immediately without reinstalling.
To also install development dependencies (pytest, mypy):
```bash
pip install -e ".[dev]"
```
## MongoDB
### Start MongoDB with Docker
Run a local MongoDB instance for development and testing:
```bash
docker compose up -d
```
### Environment variables
Copy `.env.example` to `.env` and adjust the values as needed:
```bash
cp .env.example .env
```
| Variable | Description | Default |
|---|---|---|
| `MONGODB_HOST` | MongoDB server hostname | `localhost` |
| `MONGODB_PORT` | MongoDB server port | `27017` |
| `MONGODB_USERNAME` | Authentication username | _(empty)_ |
| `MONGODB_PASSWORD` | Authentication password | _(empty)_ |
| `MONGODB_DATABASE` | Database name to use | `test` |
Then export the variables before running the server:
```bash
export $(grep -v '^#' .env | xargs)
```
### Run server
```bash
python -m server.run_mongodb_mcp_server
```
### Run MCP Inspector
```bash
fastmcp dev inspector server/run_mongodb_mcp_server.py
```
### Connect to Claude Code
Add to `.mcp.json` in your project root:
```json
{
"mcpServers": {
"mongodb": {
"type": "stdio",
"command": "python",
"args": ["-m", "server.run_mongodb_mcp_server"],
"cwd": "/absolute/path/to/example-mcp",
"env": {
"MONGODB_USERNAME": "admin",
"MONGODB_PASSWORD": "MyPassword123!",
"MONGODB_DATABASE": "mydb"
}
}
}
}
```
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues