mcp-server-mongo
If you are the rightful owner of mcp-server-mongo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is an MCP server that provides tools for querying MongoDB data.
MCP Server with MongoDB Integration
This is an MCP server that provides tools for querying MongoDB data.
Setup
- Install dependencies using uv:
uv pip install -e .
- Configure MongoDB connection:
- The server will connect to MongoDB at
mongodb://localhost:27017
by default - You can change the connection details by setting environment variables:
MONGODB_URI
: MongoDB connection stringMONGODB_DATABASE
: Database name
- The server will connect to MongoDB at
Running the Server
python main.py
Available Tools
1. query_mongodb
Query a MongoDB collection with a filter.
Parameters:
collection
(string): Name of the collection to queryquery
(object): MongoDB query filterlimit
(integer, optional): Maximum number of results to return (default: 10)
Example:
{
"collection": "users",
"query": {"age": {"$gt": 18}},
"limit": 5
}
2. list_collections
List all collections in the database.
No parameters required.
Development
To add new dependencies:
uv pip install <package-name>
To update dependencies:
uv pip install --upgrade <package-name>