Skip to main content

An MCP server for MonkDB

Project description

Official MonkDB MCP Server

Python PyPI version Stable Version Last Updated

An MCP (Modular Command Protocol) server for interacting with MonkDB, enabling Claude like LLMs to execute database-related tools such as querying, table inspection, and server health checks.

[!CAUTION] Treat your MCP database user as you would any external client connecting to your database, granting only the minimum necessary privileges. Avoid using default or admin users in production environments.

Features

Tools

  • run_select_query

    • Execute SQL queries on your MonkDB cluster.
    • Input: sql (string): The SQL query to execute.
    • Rejects non-select queries
  • list_tables

    • List all tables in monkdb schema.
  • health_check

    • Does a health check ping on MonkDB.
    • Returns either ok or an error message.
  • get_server_version

    • Returns the server version of MonkDB.
  • describe_table

    • Describe a table's columns in MonkDB.

Configuration

  1. Open the Claude Desktop configuration file located at:

    • On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • On Windows: %APPDATA%/Claude/claude_desktop_config.json
  2. Add the following:

{
  "mcpServers": {
    "mcp-monkdb": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp-monkdb",
        "--python",
        "3.13",
        "mcp-monkdb"
      ],
      "env": {
        "MONKDB_HOST": "<monkdb-host>",
        "MONKDB_API_PORT": "<monkdb-port>",
        "MONKDB_USER": "<monkdb-user>",
        "MONKDB_PASSWORD": "<monkdb-password>",

        // Optional OTEL Configuration
        "MONKDB_OTEL_ENABLED": "true",
        "MONKDB_OTEL_EXPORTER_OTLP_ENDPOINT": "https://your-otel-endpoint:4318",
        "MONKDB_OTEL_SERVICE_NAME": "mcp-monkdb",
        "MONKDB_OTEL_AUTH_HEADER": "Authorization=Bearer your-token-here"
      }
    }
  }
}

Update the environment variables to point to your own MonkDB cluster.

  1. Locate the command entry for uv and replace it with the absolute path to the uv executable. This ensures that the correct version of uv is used when starting the server. On a mac, you can find this path using which uv.

  2. Restart Claude Desktop to apply the changes.

Note: you may also use poetry instead of uv.

{
  "mcpServers": {
    "mcp-monkdb": {
      "command": "poetry",
      "args": [
        "run",
        "python",
        "-m",
        "mcp_monkdb"
      ],
      "env": {
        "MONKDB_HOST": "<monkdb-host>",
        "MONKDB_API_PORT": "<monkdb-port>",
        "MONKDB_USER": "<monkdb-user>",
        "MONKDB_PASSWORD": "<monkdb-password>",

        // Optional OTEL Configuration
        "MONKDB_OTEL_ENABLED": "true",
        "MONKDB_OTEL_EXPORTER_OTLP_ENDPOINT": "https://your-otel-endpoint:4318",
        "MONKDB_OTEL_SERVICE_NAME": "mcp-monkdb",
        "MONKDB_OTEL_AUTH_HEADER": "Authorization=Bearer your-token-here"
      }
    }
  }
}

Environment Variables

The following environment variables are used to configure the MonkDB connection and optional OpenTelemetry (OTEL) tracing.

Required Variables

  • MONKDB_HOST: The hostname or IP address of your MonkDB server.
  • MONKDB_USER: The username for authentication.
  • MONKDB_PASSWORD: The password for authentication.
  • MONKDB_API_PORT: The API port of MonkDB (default is 4200).

Optional Variables

  • MONKDB_SCHEMA: The schema of MonkDB. Defaults to monkdb. Tables under this schema are protected by RBAC policies.

Optional OTEL Tracing Variables

To enable distributed tracing using OpenTelemetry:

  • MONKDB_OTEL_ENABLED: Set to true to enable tracing.
  • MONKDB_OTEL_EXPORTER_OTLP_ENDPOINT: The OTLP HTTP endpoint (e.g. http://localhost:4318 or https://your-collector.com:4318).
  • MONKDB_OTEL_SERVICE_NAME: Logical name for trace viewers (e.g., mcp-monkdb).
  • MONKDB_OTEL_AUTH_HEADER: (Optional) Auth header if your OTEL collector requires it.
    Format: Authorization=Bearer <token> or api-key=XYZ123.

Note
If you're using a local OTEL collector with no auth, MONKDB_OTEL_AUTH_HEADER can be omitted.

Example .env Configuration

MONKDB_HOST=xx.xx.xx.xxx
MONKDB_USER=testuser
MONKDB_PASSWORD=testpassword
MONKDB_API_PORT=4200
MONKDB_SCHEMA=monkdb

# OpenTelemetry tracing (optional)
MONKDB_OTEL_ENABLED=true
MONKDB_OTEL_EXPORTER_OTLP_ENDPOINT=https://my-otel-collector:4318
MONKDB_OTEL_SERVICE_NAME=mcp-monkdb
MONKDB_OTEL_AUTH_HEADER=Authorization=Bearer xyz123

These can also be configured directly inside your Claude Desktop config:

{
  "mcpServers": {
    "mcp-monkdb": {
      "command": "poetry",
      "args": ["run", "python", "-m", "mcp_monkdb"],
      "env": {
        "MONKDB_HOST": "<monkdb-host>",
        "MONKDB_API_PORT": "<monkdb-port>",
        "MONKDB_USER": "<monkdb-user>",
        "MONKDB_PASSWORD": "<monkdb-password>",
        "MONKDB_OTEL_ENABLED": "true",
        "MONKDB_OTEL_EXPORTER_OTLP_ENDPOINT": "https://your-otel-host:4318",
        "MONKDB_OTEL_SERVICE_NAME": "mcp-monkdb",
        "MONKDB_OTEL_AUTH_HEADER": "Authorization=Bearer your-token"
      }
    }
  }
}

Traced Operations

Operation ToolTraced? Captured Attributes
run_select_query monkdb.query, monkdb.query.type (select), monkdb.query.rows, status

Running tests

cd in to mcp_monkdb folder and then run the below command to execute unit tests.

python3 -m unittest discover -s tests 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_monkdb-0.2.2.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_monkdb-0.2.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mcp_monkdb-0.2.2.tar.gz.

File metadata

  • Download URL: mcp_monkdb-0.2.2.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/25.1.0

File hashes

Hashes for mcp_monkdb-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b4034d2b72f8710aa63f4137732c8c3236a5cdf11a58d67ae2a67ff43ad8e927
MD5 542e93de67bc3741bf927b92f0b6f553
BLAKE2b-256 356cd4927c7c66e837671fdd046f76f707e71221ebe68eefa988669a3eec4de5

See more details on using hashes here.

File details

Details for the file mcp_monkdb-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: mcp_monkdb-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Darwin/25.1.0

File hashes

Hashes for mcp_monkdb-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b2b104aaf7ab0c9f6c1478fe26499dbe677e86dd0b9cde755dc0e7a6d4d5d50d
MD5 0142fa8ca7c5592ce30da76b2dab4433
BLAKE2b-256 d18b49c32658f94ecc962aa6bf1e0f0e5e9ffb8f99ed7271cf51d4c6b02e9e7a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page