Supports querying and schema exploration for MariaDB databases, enabling tools to list tables and perform parallel SQL execution.
Provides tools to execute SQL queries, list tables, and explore schemas in MySQL databases, supporting simultaneous operations across multiple connections.
Allows for querying PostgreSQL databases, exploring schemas, listing tables, and describing table structures, including support for parallel queries across multiple instances.
Enables interaction with SQLite database files, providing tools for executing SQL queries, listing tables, and describing database structures.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Multi-Database MCP ServerCompare the users table schema in postgres_db and mysql_db"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Multi-Database MCP Server
An MCP (Model Context Protocol) server that provides tools to access multiple databases simultaneously. The server runs in Docker and supports querying multiple databases of different types in parallel. This server was inspired by needs to compare databases or support migrations.
Features
Multiple Database Types: Support for PostgreSQL, MySQL/MariaDB, SQL Server, and SQLite
Multiple Database Support: Connect to and query multiple databases simultaneously (even different types)
Parallel Queries: Execute the same query across multiple databases at once
Schema Exploration: List databases, schemas, tables, and describe table structures
Dockerized: Runs in a Docker container for easy deployment
Connection Pooling: Efficient connection management for all database types
Flexible Configuration: Organize databases by type
Available Tools
list_databases - List all configured database connections
query_database - Execute a SQL query on a specific database
list_tables - List all tables in a database schema
describe_table - Get detailed schema information for a table
list_schemas - List all schemas in a database
query_multiple_databases - Execute the same query on multiple databases simultaneously
Setup
1. Create Database Configuration
Copy the example configuration file and edit it with your database credentials:
Edit databases.json with your database connection details. Organize databases by type at the root level:
Supported Database Types
PostgreSQL (
"postgresql","postgres", or"pg")MySQL/MariaDB (
"mysql"or"mariadb")SQL Server (
"sqlserver","mssql", or"sql server")SQLite (
"sqlite"or"sqlite3")
2. Build and Run with Docker Compose
3. Build and Run with Docker
4. Docker Connection Tips
When configuring database connections from within Docker, keep these tips in mind:
Network Connections (PostgreSQL, MySQL, SQL Server)
Accessing host machine databases: Use
host.docker.internalas the hostname (Windows/Mac) or172.17.0.1(Linux)Accessing other containers: Use the container name or service name from
docker-compose.ymlAccessing remote databases: Use the actual hostname or IP address
Example for accessing PostgreSQL on host machine:
Example for accessing database in another Docker container:
Example for accessing SQL Server on host machine:
Note for SQL Server: Ensure that SQL Server is configured to accept TCP/IP connections and that the SQL Server Browser service is running if using named instances. The default port is 1433.
File Paths (SQLite)
SQLite databases on host: Mount the directory containing the database file as a volume and use the container path
SQLite databases in container: Use absolute paths within the container
Example Docker run command with SQLite volume:
Example SQLite configuration:
Note: The path /app/data/mydatabase.db is the path inside the container, which maps to ./data/mydatabase.db on your host machine via the volume mount.
Usage
The server communicates via stdio using the MCP protocol. Connect your MCP client to the Docker container's stdio streams.
Example MCP Client Configuration
If using with an MCP client, configure it to connect to the Docker container:
Tool Examples
List All Databases
Query a Single Database
List Tables
Describe a Table
Query Multiple Databases Simultaneously
You can query multiple databases of different types simultaneously:
Note: When querying multiple databases of different types, ensure the SQL syntax is compatible across all database types, or use database-specific queries for each database separately.
Development
Local Development (without Docker)
Install dependencies:
Set environment variable:
Run the server:
Database-Specific Notes
PostgreSQL
Default port: 5432
Default schema:
publicUses
asyncpgfor async operations
MySQL/MariaDB
Default port: 3306
Schema parameter is optional (uses current database)
Uses
aiomysqlfor async operations
SQL Server
Default port: 1433
Default schema:
dboRequires ODBC Driver 17 for SQL Server (installed in Docker image)
Uses
pyodbcwith asyncio wrapperImportant: SQL Server must be configured to accept TCP/IP connections
For named instances, ensure SQL Server Browser service is running
Use
host.docker.internalto connect to SQL Server on the host machine from Docker
SQLite
No network connection required
Use
databasefield to specify file path (or:memory:for in-memory)Default schema:
mainUses
aiosqlitefor async operations
Security Notes
Never commit - It contains sensitive credentials
Use environment variables or secrets management in production
Consider using SSL/TLS connections for remote databases
Limit network access to the Docker container
For SQLite, ensure file paths are secure and accessible
Troubleshooting
Connection Issues
Verify database credentials in
databases.jsonEnsure databases are accessible from the Docker container
Check network connectivity (use
docker networkfor container-to-container communication)
Permission Issues
Ensure the
databases.jsonfile has proper read permissionsCheck that the Docker volume mount is correct
License
MIT