mcp-server-mongo
0
This MCP server integrates with MongoDB to provide tools for querying databases and listing collections. It allows users to easily set up a connection and perform database operations.
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>