DBHub
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Integrations
Provides Docker container deployment options for running the DBHub server with configurable database connections and transport options.
Supports connecting to DuckDB databases to explore tables, access schema information, and perform read-only SQL queries with safety measures.
Provides access to MySQL databases for browsing tables, viewing schema information, and executing read-only SQL queries with safety protections.
DBHub is a universal database gateway implementing the Model Context Protocol (MCP) server interface. This gateway allows MCP-compatible clients to connect to and explore different databases.
Supported Matrix
Database Resources
Resource | URI Format | PostgreSQL | MySQL | SQL Server | SQLite |
---|---|---|---|---|---|
Tables | db://tables | ✅ | ✅ | ✅ | ✅ |
Schema | db://schema/{tableName} | ✅ | ✅ | ✅ | ✅ |
Database Tools
Tool | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
---|---|---|---|---|---|
Execute Query | run_query | ✅ | ✅ | ✅ | ✅ |
List Connectors | list_connectors | ✅ | ✅ | ✅ | ✅ |
Prompt Capabilities
Prompt | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
---|---|---|---|---|---|
Generate SQL | generate_sql | ✅ | ✅ | ✅ | ✅ |
Explain DB Elements | explain_db | ✅ | ✅ | ✅ | ✅ |
Installation
Docker
NPM
Claude Desktop
- Claude Desktop only supports
stdio
transport https://github.com/orgs/modelcontextprotocol/discussions/16
Cursor
- Cursor supports both
stdio
andsse
. - Follow Cursor MCP guide and make sure to use Agent mode.
Usage
Configure your database connection
You can use DBHub in demo mode with a sample employee database for testing:
For real databases, a Database Source Name (DSN) is required. You can provide this in several ways:
- Command line argument (highest priority):Copy
- Environment variable (second priority):Copy
- Environment file (third priority):
- For development: Create
.env.local
with your DSN - For production: Create
.env
with your DSN
Copy - For development: Create
DBHub supports the following database connection string formats:
Database | DSN Format | Example |
---|---|---|
PostgreSQL | postgres://[user]:[password]@[host]:[port]/[database] | postgres://user:password@localhost:5432/dbname?sslmode=disable |
SQLite | sqlite:///[path/to/file] or sqlite::memory: | sqlite:///path/to/database.db or sqlite::memory: |
SQL Server | sqlserver://[user]:[password]@[host]:[port]/[database] | sqlserver://user:password@localhost:1433/dbname |
MySQL | mysql://[user]:[password]@[host]:[port]/[database] | mysql://user:password@localhost:3306/dbname |
Transport
- stdio (default) - for direct integration with tools like Claude Desktop:Copy
- sse - for browser and network clients:Copy
Command line options
Option | Description | Default |
---|---|---|
demo | Run in demo mode with sample employee database | false |
dsn | Database connection string | Required if not in demo mode |
transport | Transport mode: stdio or sse | stdio |
port | HTTP server port (only applicable when using --transport=sse ) | 8080 |
Development
- Install dependencies:Copy
- Run in development mode:Copy
- Build for production:Copy
Debug with MCP Inspector
stdio
SSE
Connect to the DBHub server /sse
endpoint
This server cannot be installed
Universal database MCP server connecting to MySQL, PostgreSQL, SQLite, DuckDB and etc.