Multi Database MCP Server
What is DB MCP Server?
Core Concepts
Multi-Database Support
Dynamic Tool Generation
Clean Architecture
- Domain Layer: Core business entities and interfaces
- Repository Layer: Data access implementations
- Use Case Layer: Application business logic
- Delivery Layer: External interfaces (MCP tools)
Features
- Simultaneous Multi-Database Support: Connect to and interact with multiple MySQL and PostgreSQL databases concurrently
- Database-Specific Tool Generation: Auto-creates specialized tools for each connected database
- Clean Architecture: Modular design with clear separation of concerns
- OpenAI Agents SDK Compatibility: Full compatibility with the OpenAI Agents SDK for seamless integration with AI assistants
- Dynamic Database Tools:
- Unified Interface: Consistent interaction patterns across different database types
- Connection Management: Simple configuration for multiple database connections
Currently Supported Databases
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Quick Start
Using Docker
Note: We mount to/app/my-config.jsonbecause the container already has a file at/app/config.json.
Platform Support
linux/amd64- For Intel/AMD based systems (most Linux/Windows servers and desktops)
linux/arm64- For ARM64 based systems (Apple Silicon Macs, ARM servers)
From Source
Running the Server
STDIO Mode (for IDE integration)
.cursor/mcp.json:SSE Mode (Server-Sent Events)
http://localhost:9092/sse for the event stream.Docker Compose
- The db-mcp-server container waits for all database services to be ready before starting
- Multiple database types and versions are included (MySQL 8.0, PostgreSQL 15, 16.3, and 17)
- All databases include health checks to ensure they're fully initialized before the server connects
- Persistent volumes for all database services
- Exposed ports for direct database access if needed
wait-for-it.sh script to ensure all database services are fully ready before starting the server. This script checks if a TCP host/port is available before proceeding. You need to include this script in your project directory. The Docker setup mounts this script into the container and uses it to verify database availability.Configuration
Database Configuration
config.json file with your database connections:host values should match the service names in the docker-compose.yml file.Command-Line Options
Available Tools
Tool Naming Convention
<tool_type>: One of: query, execute, transaction, schema, performance
<database_id>: The ID of the database as defined in your configuration
query_mysql1
execute_mysql1
transaction_mysql1
schema_mysql1
performance_mysql1
Database-Specific Tools
query_<dbid>: Execute SQL queries on the specified database
execute_<dbid>: Execute SQL statements (INSERT, UPDATE, DELETE)
transaction_<dbid>: Manage database transactions
schema_<dbid>: Get database schema information
performance_<dbid>: Analyze query performance
Global Tools
list_databases: List all configured database connections
Examples
Querying Multiple Databases
Executing Transactions
Roadmap
Q3 2025
- MongoDB - Support for document-oriented database operations
- SQLite - Lightweight embedded database integration
- MariaDB - Complete feature parity with MySQL implementation
Q4 2025
- Microsoft SQL Server - Enterprise database support with T-SQL capabilities
- Oracle Database - Enterprise-grade integration
- Redis - Key-value store operations
2026
- Cassandra - Distributed NoSQL database support
- Elasticsearch - Specialized search and analytics capabilities
- CockroachDB - Distributed SQL database for global-scale applications
- DynamoDB - AWS-native NoSQL database integration
- Neo4j - Graph database support
- ClickHouse - Analytics database support
Troubleshooting
Common Issues
- Connection Errors: Verify your database connection settings in
config.json
- Tool Not Found: Ensure the server is running and check tool name prefixes
- Failed Queries: Check your SQL syntax and database permissions
- Docker Volume Mount Errors: If you see errors like
mountpoint for /app/config.json: not a directory, it's because the container already has a file at that path. Mount to a different path (e.g.,/app/my-config.json) and update your configuration accordingly.
- Docker Command Errors: If you encounter command-related errors with Docker, use one of these approaches:
- Wait-for-it.sh Missing or Not Working: If you see errors related to wait-for-it.sh:
Logs
- STDIO mode: stderr
- SSE mode: stdout and
./logs/db-mcp-server.log
-debug flag:Contributing
- Fork the repository
- Create a feature branch:
git checkout -b new-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin new-feature
- Submit a pull request
License
Support & Contact
- For questions or issues, email mnhatlinh.doan@gmail.com
- Open an issue directly: Issue Tracker
- If DB MCP Server helps your work, please consider supporting:
Cursor Integration
Tool Naming Convention
mcp_mysql1_db_mcp_server_stdio_schema_mysql1_dbmysql1_db_mcp_server_stdio by default, which should match your Cursor configuration in the mcp.json file.Cursor Configuration
~/.cursor/mcp.json), you should have a configuration like:Using MCP Tools in Cursor
<server_name>is the name defined in your .cursor/mcp.json (e.g., "multidb")
<tool_type>is one of: query, execute, transaction, schema, performance, list_databases
<database_id>is the database ID from your configuration (not needed for list_databases)
Examples:
- Listing all databases:
- Querying the database:
- Viewing database schema:
- Executing statements:
- Managing transactions:
Troubleshooting MCP Tools in Cursor
- Make sure the server is running (check with
ps aux | grep server)
- Verify your .cursor/mcp.json configuration is correct
- Ensure the server_name in .env matches what's in your MCP tool calls
- Restart Cursor after making configuration changes
- Check the logs in the logs/ directory for any errors
OpenAI Agents SDK Integration
Prerequisites
- OpenAI account with API access
- OpenAI Agents SDK installed:
pip install openai-agents
- A running DB MCP Server instance (SSE mode)
Basic Integration Example
Testing Your Integration
- Build the server with the latest changes
- Start the server if it's not already running
- Test the connection with the OpenAI Agents SDK
- Report if the integration is working correctly
Troubleshooting Agents SDK Integration
- Ensure the server is running in SSE mode on the expected port
- Check that your OpenAI API key is set as an environment variable
- Verify that your agent's instructions mention the database tools specifically
- Inspect the server logs for any error messages
Star History
Multi Database MCP Server
What is DB MCP Server?
Core Concepts
Multi-Database Support
Dynamic Tool Generation
Clean Architecture
- Domain Layer: Core business entities and interfaces
- Repository Layer: Data access implementations
- Use Case Layer: Application business logic
- Delivery Layer: External interfaces (MCP tools)
Features
- Simultaneous Multi-Database Support: Connect to and interact with multiple MySQL and PostgreSQL databases concurrently
- Database-Specific Tool Generation: Auto-creates specialized tools for each connected database
- Clean Architecture: Modular design with clear separation of concerns
- OpenAI Agents SDK Compatibility: Full compatibility with the OpenAI Agents SDK for seamless integration with AI assistants
- Dynamic Database Tools:
- Unified Interface: Consistent interaction patterns across different database types
- Connection Management: Simple configuration for multiple database connections
Currently Supported Databases
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Quick Start
Using Docker
Note: We mount to/app/my-config.jsonbecause the container already has a file at/app/config.json.
Platform Support
linux/amd64- For Intel/AMD based systems (most Linux/Windows servers and desktops)
linux/arm64- For ARM64 based systems (Apple Silicon Macs, ARM servers)
From Source
Running the Server
STDIO Mode (for IDE integration)
.cursor/mcp.json:SSE Mode (Server-Sent Events)
http://localhost:9092/sse for the event stream.Docker Compose
- The db-mcp-server container waits for all database services to be ready before starting
- Multiple database types and versions are included (MySQL 8.0, PostgreSQL 15, 16.3, and 17)
- All databases include health checks to ensure they're fully initialized before the server connects
- Persistent volumes for all database services
- Exposed ports for direct database access if needed
wait-for-it.sh script to ensure all database services are fully ready before starting the server. This script checks if a TCP host/port is available before proceeding. You need to include this script in your project directory. The Docker setup mounts this script into the container and uses it to verify database availability.Configuration
Database Configuration
config.json file with your database connections:host values should match the service names in the docker-compose.yml file.Command-Line Options
Available Tools
Tool Naming Convention
<tool_type>: One of: query, execute, transaction, schema, performance
<database_id>: The ID of the database as defined in your configuration
query_mysql1
execute_mysql1
transaction_mysql1
schema_mysql1
performance_mysql1
Database-Specific Tools
query_<dbid>: Execute SQL queries on the specified database
execute_<dbid>: Execute SQL statements (INSERT, UPDATE, DELETE)
transaction_<dbid>: Manage database transactions
schema_<dbid>: Get database schema information
performance_<dbid>: Analyze query performance
Global Tools
list_databases: List all configured database connections
Examples
Querying Multiple Databases
Executing Transactions
Roadmap
Q3 2025
- MongoDB - Support for document-oriented database operations
- SQLite - Lightweight embedded database integration
- MariaDB - Complete feature parity with MySQL implementation
Q4 2025
- Microsoft SQL Server - Enterprise database support with T-SQL capabilities
- Oracle Database - Enterprise-grade integration
- Redis - Key-value store operations
2026
- Cassandra - Distributed NoSQL database support
- Elasticsearch - Specialized search and analytics capabilities
- CockroachDB - Distributed SQL database for global-scale applications
- DynamoDB - AWS-native NoSQL database integration
- Neo4j - Graph database support
- ClickHouse - Analytics database support
Troubleshooting
Common Issues
- Connection Errors: Verify your database connection settings in
config.json
- Tool Not Found: Ensure the server is running and check tool name prefixes
- Failed Queries: Check your SQL syntax and database permissions
- Docker Volume Mount Errors: If you see errors like
mountpoint for /app/config.json: not a directory, it's because the container already has a file at that path. Mount to a different path (e.g.,/app/my-config.json) and update your configuration accordingly.
- Docker Command Errors: If you encounter command-related errors with Docker, use one of these approaches:
- Wait-for-it.sh Missing or Not Working: If you see errors related to wait-for-it.sh:
Logs
- STDIO mode: stderr
- SSE mode: stdout and
./logs/db-mcp-server.log
-debug flag:Contributing
- Fork the repository
- Create a feature branch:
git checkout -b new-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push to the branch:
git push origin new-feature
- Submit a pull request
License
Support & Contact
- For questions or issues, email mnhatlinh.doan@gmail.com
- Open an issue directly: Issue Tracker
- If DB MCP Server helps your work, please consider supporting:
Cursor Integration
Tool Naming Convention
mcp_mysql1_db_mcp_server_stdio_schema_mysql1_dbmysql1_db_mcp_server_stdio by default, which should match your Cursor configuration in the mcp.json file.Cursor Configuration
~/.cursor/mcp.json), you should have a configuration like:Using MCP Tools in Cursor
<server_name>is the name defined in your .cursor/mcp.json (e.g., "multidb")
<tool_type>is one of: query, execute, transaction, schema, performance, list_databases
<database_id>is the database ID from your configuration (not needed for list_databases)
Examples:
- Listing all databases:
- Querying the database:
- Viewing database schema:
- Executing statements:
- Managing transactions:
Troubleshooting MCP Tools in Cursor
- Make sure the server is running (check with
ps aux | grep server)
- Verify your .cursor/mcp.json configuration is correct
- Ensure the server_name in .env matches what's in your MCP tool calls
- Restart Cursor after making configuration changes
- Check the logs in the logs/ directory for any errors
OpenAI Agents SDK Integration
Prerequisites
- OpenAI account with API access
- OpenAI Agents SDK installed:
pip install openai-agents
- A running DB MCP Server instance (SSE mode)
Basic Integration Example
Testing Your Integration
- Build the server with the latest changes
- Start the server if it's not already running
- Test the connection with the OpenAI Agents SDK
- Report if the integration is working correctly
Troubleshooting Agents SDK Integration
- Ensure the server is running in SSE mode on the expected port
- Check that your OpenAI API key is set as an environment variable
- Verify that your agent's instructions mention the database tools specifically
- Inspect the server logs for any error messages