MCP Server with MongoDB Integration

by sven-olding

173 downloads Not rated yet
GitHub

About

# MCP Server with MongoDB Integration This is an MCP server that provides tools for querying MongoDB data. ## Setup 1. Install dependencies using uv: ```bash uv pip install -e . ``` 2. Configure MongoDB connection: - The server will connect to MongoDB at `mongodb://localhost:27017` by default - You can change the…

Explore

- Query MongoDB collections with a filter and optional limit.
- List all collections in the database.
- Default connection to localhost:27017.
- Customizable MongoDB URI and database via environment variables.
- Simple command-line invocation with minimal setup.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Server with MongoDB Integration
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Install dependencies using uv:

uv pip install -e .

2. 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 string
- MONGODB_DATABASE: Database name

python main.py

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp server with mongodb integration": {
            "mcp-server-mongo": {
                "command": "uv",
                "args": [
                    "pip",
                    "install",
                    "-e",
                    "."
                ]
            }
        }
    }
}

McpServers

{
    "mcp-server-mongo": {
        "command": "uv",
        "args": [
            "pip",
            "install",
            "-e",
            "."
        ]
    }
}

This is an MCP server that provides tools for querying MongoDB data.

Setup

1. Install dependencies using uv:

uv pip install -e .

2. 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 string
- MONGODB_DATABASE: Database name

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 query
- query (object): MongoDB query filter
- limit (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>

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.