Multi-Database MCP Server (PostgreSQL & MySQL)
A powerful Model Context Protocol (MCP) Server designed for AI-assisted development (e.g., Cursor, Claude Desktop, Antigravity). It enables your AI assistant to safely interact directly with PostgreSQL and MySQL/MariaDB databases.
Key Features
- Dual Database Support: Supports both PostgreSQL and MySQL out of the box.
- Ready to Use: Simple
pipinstallation with zero complex setup. - Flexible Configuration: Configure via Client Config or Environment Variables (
.env). - Secure & Controlled: Built-in Read-Only mode, Max Row limits, and strict permission controls.
- Dual Execution Modes: Supports standard STDIO (Default for Cursor) and HTTP (for Antigravity/Docker).
Installation
Ensure you have Python 3.10 or higher installed.
pip install da2-mcp-multi-db
(Note: The package name is da2-mcp-multi-db)
Quick Start
Once installed, you can launch the servers directly using the following commands:
1. PostgreSQL
# Start PostgreSQL Server
da2-mcp-postgresql
2. MySQL / MariaDB
# Start MySQL Server
da2-mcp-mysql
Configuration Guide
This program relies on environment variables (like DATABASE_URL) to connect to your database. We provide two ways to configure this, please choose the one that fits your workflow:
Method 1: MCP Client Configuration (Recommended)
If you are using Cursor or Claude Desktop, it is recommended to define variables directly in your Client's configuration file for a cleaner setup.
Cursor Example (cursor_mcp_config.json):
{
"mcpServers": {
"my-postgres": {
"command": "da2-mcp-postgresql",
"args": [],
"env": {
"DATABASE_URL": "postgresql://user:password@localhost:5432/mydb",
"READ_ONLY": "false",
"MAX_ROWS": "1000"
}
},
"my-mysql": {
"command": "da2-mcp-mysql",
"args": [],
"env": {
"MYSQL_DATABASE_URL": "mysql://user:password@localhost:3306/mydb"
}
}
}
}
Method 2: Using .env File (For CLI)
If you are running commands manually in a terminal, the program will automatically look for a .env file in the current working directory.
- Create a file named
.envin the directory where you run the command. - Add the following content:
# PostgreSQL Connection String
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
# MySQL Connection String
MYSQL_DATABASE_URL=mysql://user:password@localhost:3306/mydb
# --- OR Use Individual Variables (Lowest Priority) ---
# PostgreSQL Config
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=password
PG_DATABASE=postgres
# MySQL Config
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=password
MYSQL_DATABASE=mysql
# Security Settings (Optional)
LOG_LEVEL=INFO
READ_ONLY=false
MAX_ROWS=1000
QUERY_TIMEOUT=30
ALLOW_CREATE_DB=false
ALLOW_DROP_DB=false
Available Tools
Once connected, your AI assistant will have access to the following capabilities:
| Tool Name | Description |
|---|---|
| list_databases | List all available databases on the server |
| list_schemas | (PostgreSQL Only) List schemas in a database |
| list_tables | Show all tables in a specific database |
| describe_table | Inspect table schema (columns, types, indexes) |
| execute_query | Execute standard SQL queries (SELECT, INSERT, UPDATE...) |
| create_database | Create a new database (requires permission) |
| drop_database | Drop a database (requires permission and confirmation) |
| get_server_info | Get current server version and configuration info |
HTTP Mode
If you need to run in HTTP Server mode (e.g., for Docker containers or remote deployment):
# Start on Port 8000
da2-mcp-postgresql --http --port 8000
You can debug this using the MCP Inspector:
npx @modelcontextprotocol/inspector http://localhost:8000/mcp
License
MIT License
Copyright (c) 2026 Danny, DA2 Studio (https://da2.35g.tw)
Metadata
Release files for da2-mcp-multi-db 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| da2_mcp_multi_db-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for da2_mcp_multi_db-0.1.1-py3-none-any.whl |
Release files / da2_mcp_multi_db-0.1.1-py3-none-any.whl
| Download URL | da2_mcp_multi_db-0.1.1-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a5aaf0992bdd759add301e8f39581da6e2ac459f3f4bd26f6794d3681f5175d
|
|
BLAKE2b-256 checksum How to use checksums |
eb6401c45e7695425476acc83099d1333469775dc51f9be8d0e176f31929bc15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for da2-mcp-multi-db 0.1.1
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.