Skip to main content

MCP server for MySQL and MongoDB databases — one instance per database, no Docker required

Project description

db-mcp-server

MCP server for MySQL and MongoDB databases. One instance per database, no Docker required.

Installation

uvx db-mcp-server

Configuration

Configure via environment variables. Each instance connects to a single database.

MySQL

Variable Required Default Description
DB_TYPE Yes mysql
DB_DATABASE Yes Database name
DB_PASSWORD Yes Password
DB_HOST No localhost Host
DB_PORT No 3306 Port
DB_USER No root User
DB_MODE No read-only read-only or read-write

MongoDB

Variable Required Default Description
DB_TYPE Yes mongodb
DB_DATABASE Yes Database name
DB_URL Yes Connection URL (mongodb://...)
DB_MODE No read-only read-only or read-write

Usage in .mcp.json

{
  "mcpServers": {
    "db-prod": {
      "command": "uvx",
      "args": ["db-mcp-server"],
      "env": {
        "DB_TYPE": "mysql",
        "DB_MODE": "read-only",
        "DB_HOST": "db.example.com",
        "DB_PORT": "3306",
        "DB_USER": "root",
        "DB_PASSWORD": "secret",
        "DB_DATABASE": "myapp"
      }
    }
  }
}

For multiple databases, add multiple instances:

{
  "mcpServers": {
    "db-prod": {
      "command": "uvx",
      "args": ["db-mcp-server"],
      "env": { "DB_TYPE": "mysql", "DB_DATABASE": "prod", "..." : "..." }
    },
    "db-staging": {
      "command": "uvx",
      "args": ["db-mcp-server"],
      "env": { "DB_TYPE": "mongodb", "DB_DATABASE": "staging", "..." : "..." }
    }
  }
}

Tools

MySQL

  • query — Execute read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH)
  • execute — Execute write SQL (INSERT, UPDATE, DELETE) — requires DB_MODE=read-write
  • describe — Describe table structure
  • list_tables — List all tables
  • status — Show connection info

MongoDB

  • query — Find documents in a collection
  • describe — Collection stats ($collStats)
  • list_collections — List all collections
  • aggregate — Execute aggregation pipelines ($out/$merge blocked on read-only)
  • status — Show connection info

License

MIT

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

db_mcp_server-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

db_mcp_server-1.0.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file db_mcp_server-1.0.0.tar.gz.

File metadata

  • Download URL: db_mcp_server-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for db_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2f72488c175831c4fa4ed679ca072191ff946d3c994ed60bfeccf92945d3e5c8
MD5 8370624f6b6d69472dfacc6d7438edd4
BLAKE2b-256 aee79028644f6d66abe214860a330abb9a5167b56ef1bdba0e925d2e3e32b78e

See more details on using hashes here.

File details

Details for the file db_mcp_server-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: db_mcp_server-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for db_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc0d0a2825596229e90660c9e9825ea6d39f28622c05e1f5635632c529cae76
MD5 a18c2e4d470e3c492d6842945ea91fb3
BLAKE2b-256 f0bca595a9e1a8bf18b720e035f70cb3820cdb26d1b3e487efbf83e1db4b9a13

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