A powerful multi-database server implementing the Model Context Protocol (MCP) to give AI assistants structured, tool-based access to MySQL, PostgreSQL and TimescaleDB instances.
https://github.com/FreePeak/db-mcp-serverStop juggling multiple database connections in your AI workflows. DB MCP Server connects your AI assistant to MySQL, PostgreSQL, and TimescaleDB databases simultaneously through a single, unified interface.
Working with databases through AI assistants usually means configuring separate tools for each connection, dealing with inconsistent interfaces, and manually managing connection credentials across different systems. DB MCP Server eliminates this friction by providing one server that handles multiple databases with automatically generated, database-specific tools.
Connect to your production MySQL instance, development PostgreSQL database, and TimescaleDB analytics cluster all at once. Your AI assistant gets specialized tools for each connection without you having to configure three different MCP servers.
Traditional approach: Set up separate MCP servers for each database, manage multiple configurations, deal with different tool interfaces.
With DB MCP Server: Configure once, connect everywhere. Each database connection automatically generates its own set of optimized tools:
# Single config file, multiple databases
{
"connections": [
{"id": "prod_mysql", "type": "mysql", "host": "prod.db", ...},
{"id": "analytics_pg", "type": "postgres", "host": "analytics.db", ...},
{"id": "timeseries", "type": "postgres", "host": "timescale.db", ...}
]
}
Your AI assistant immediately gets:
query_prod_mysql, query_analytics_pg, query_timeseriesschema_prod_mysql, schema_analytics_pg, schema_timeseriesperformance_prod_mysql, performance_analytics_pg, performance_timeseriesPlus specialized TimescaleDB tools for time-series operations when connected to TimescaleDB instances.
Cross-Database Analytics: Query user data from MySQL, join with behavioral analytics from PostgreSQL, and analyze time-series metrics from TimescaleDB—all in one AI conversation.
Multi-Environment Troubleshooting: Compare schema differences between development and production databases, analyze performance across environments, and identify data inconsistencies.
Time-Series Analysis: Use specialized TimescaleDB tools for hypertable management, continuous aggregates, and time-bucketed queries while maintaining access to your transactional databases.
Database Migration Planning: Analyze schema structures across different database types, compare data distributions, and plan migration strategies with full context from multiple sources.
The server follows clean architecture principles with proper separation of concerns, making it reliable for production use. Connection pooling, query timeouts, and transaction management are handled automatically.
Deploy via Docker for containerized environments, use STDIO mode for IDE integration (works perfectly with Cursor), or run in SSE mode for web-based AI assistants. The server adapts to your deployment preferences without changing functionality.
When connected to TimescaleDB instances, you get additional specialized tools:
create_hypertable_<db> for converting tables to hypertablestime_series_query_<db> for optimized time-bucketed queriescontinuous_aggregate_<db> for materialized view managementtime_series_analyze_<db> for pattern analysisThese tools understand TimescaleDB's unique capabilities and generate optimized queries automatically.
Cursor IDE: Add to .cursor/mcp.json for direct integration with your development environment.
Docker Deployment: One container handles all your database connections with mounted configuration.
Custom Integration: Use SSE mode to connect from any client that supports Server-Sent Events.
The server exposes a consistent MCP interface regardless of deployment method, making it easy to switch between development and production setups.
Configure your databases:
{
"connections": [
{
"id": "main_db",
"type": "mysql",
"host": "localhost",
"port": 3306,
"name": "myapp",
"user": "admin",
"password": "password"
}
]
}
Run the server:
docker run -p 9092:9092 \
-v $(pwd)/config.json:/app/my-config.json \
freepeak/db-mcp-server
Connect your AI assistant to http://localhost:9092/sse and start querying multiple databases through generated tools.
Your AI assistant immediately gains structured access to all configured databases with properly typed schemas, query optimization, and transaction management built in.