Skip to main content

MultiDB MCP Server

MCP (Model Context Protocol) server supporting multiple remote databases. Stateless design - specify the database with each call.

Features

  • 🔄 Connect to multiple databases (MySQL/PostgreSQL) simultaneously
  • 🎯 Stateless design - no connection state management needed
  • 🔍 Query, schema inspection, database management
  • 🛡️ Connection info managed via configuration file
  • ✅ User confirmation for data modification operations

Installation

Recommended: Using uvx

uvx multidb-mcp

MCP configuration example:

{
  "multidb-mcp": {
    "type": "stdio",
    "command": "uvx",
    "args": [
      "multidb_mcp"
    ],
    "env": {
      "DATABASE_CONFIG_PATH": "xxx/database.json",
      "DEFAULT_MAX_ROWS_AFFECTED": "1"
    }
  }
}

Other methods

Using uv:

uv venv && source .venv/bin/activate
uv pip install -e .
multidb-mcp

Using pip:

pip install -e .
multidb-mcp

Configuration

Create a config.json file:

{
  "databases": {
    "dev1": {
      "type": "mysql",
      "host": "localhost",
      "port": 3306,
      "user": "root",
      "password": "password",
      "database": "dev_db"
    },
    "test": {
      "type": "postgresql",
      "host": "localhost",
      "port": 5432,
      "user": "postgres",
      "password": "password",
      "database": "test_db"
    }
  }
}

Copy from config.example.json:

cp config.example.json config.json  # Edit with actual connection details

Configuration file priority

  1. Command-line argument: --config /path/to/config.json
  2. Environment variable: DATABASE_CONFIG_PATH=/path/to/config.json
  3. Default path: ./config.json

Usage

Start the server

# Using default config
multidb-mcp

# Using custom config
multidb-mcp --config /path/to/config.json

# Using environment variable
export DATABASE_CONFIG_PATH=/path/to/config.json && multidb-mcp

# Development mode
fastmcp dev multidb_mcp/server.py

Run demo

python demo.py

MCP Tools

1. list_databases

List all configured databases.

2. execute_query

Execute SQL query on specified database. For data modification operations (INSERT/UPDATE/DELETE), user confirmation is requested.

Parameter Type Description
connection_name string Database connection name from config file
query string SQL query statement

3. list_tables

List all tables in specified database.

Parameter Type Description
connection_name string Database connection name from config file

4. describe_table

Get table structure details (fields, types, constraints).

Parameter Type Description
connection_name string Database connection name from config file
table_name string Table name

Stateless Design

Each tool call explicitly specifies the database to operate on. Benefits:

  • ✅ No server-side state management
  • ✅ Concurrent multi-client access without interference
  • ✅ Clear, independent calls
  • ✅ Ideal for distributed/serverless environments
  • ✅ Eliminates state inconsistency issues

License

See LICENSE file for details.

Metadata

Release files for multidb-mcp 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for multidb-mcp 0.3.2
File Size Uploaded Provenance
multidb_mcp-0.3.2.tar.gz 130.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for multidb-mcp 0.3.2
File Interpreter ABI Platform
multidb_mcp-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 139.6 kB

Release files / multidb_mcp-0.3.2.tar.gz

Download URL multidb_mcp-0.3.2.tar.gz
Size 130.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3e9a5b2ec8f1aef55b25129e3095e58fff2e7acd8ed135ecaca698b272d3a842
BLAKE2b-256 checksum
How to use checksums
a821ceb92d24e3068205f5270386337ad888aa1181eab06a901a146a29e4ce79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / multidb_mcp-0.3.2-py3-none-any.whl

Download URL multidb_mcp-0.3.2-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1263039430b94bf1bbff7c518debcd217af12ad7b55e5ac716f853319cd660f0
BLAKE2b-256 checksum
How to use checksums
a13e75065c78fcc9ecf18c226a0f9bca1c595b60049e8f79b74dd20a5c0f4852
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for multidb-mcp 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page