Skip to main content
Glama
Fast MongoMcp

Fast MongoMcp

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.

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.

Related MCP server: MongoDB MCP Server

Installation

Create a virtual environment

python3 -m venv venv
source venv/bin/activate   # on Windows: venv\Scripts\activate

Install dependencies

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):

pip install -e ".[dev]"

MongoDB

Start MongoDB with Docker

Run a local MongoDB instance for development and testing:

docker compose up -d

Environment variables

Copy .env.example to .env and adjust the values as needed:

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:

export $(grep -v '^#' .env | xargs)

Run server

python -m server.run_mongodb_mcp_server

Run MCP Inspector

fastmcp dev inspector server/run_mongodb_mcp_server.py

Connect to Claude Code

Add to .mcp.json in your project root:

{
  "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"
      }
    }
  }
}

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query and introspect MongoDB databases through find, aggregate, and schema discovery operations. Supports read-only default mode with optional write capabilities and works with any MCP-compatible client via stdio or HTTP transports.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with MongoDB databases through natural language, supporting document CRUD, aggregation, collection listing, and statistics.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to interact with MongoDB databases and MongoDB Atlas, supporting read-only and write operations, Atlas cluster management, and data exploration.
      145,421 npm
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to interact with MongoDB 3.6+ databases, supporting collection listing, document queries, counting, and aggregations through natural language.
      5
      1
      MIT