Skip to main content

A multi-database MCP server supporting multiple remote databases

Project description

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 --from . multidb-mcp

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.

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

multidb_mcp-0.3.0.tar.gz (130.1 kB view details)

Uploaded Source

Built Distribution

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

multidb_mcp-0.3.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file multidb_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: multidb_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 130.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for multidb_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0fff59bb3fb1e28bc94cb3c12bc4e7b71a30ab4e4bf80ecad8d473da3a4605c4
MD5 0f304464554e4e2c3b628956f7a4fc44
BLAKE2b-256 4afe732e91f28b6e2dc056cc2ba45ac346fc622277445316b1ae7aca9c3b72f6

See more details on using hashes here.

File details

Details for the file multidb_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: multidb_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for multidb_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c7ebbce10531e086b5aaa58486a0793ab1f4e570e7c5770eaf7f96c5deb01fc
MD5 67e18a51196172f30a929afc2cbfe641
BLAKE2b-256 c7e01fa0f1780eefb12b2a106082cee09b8cc432c008f1aa86176681aebdb2cf

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