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.
Demo SSE Endpoint
https://demo.dbhub.ai/sse connects a sample employee database. You can point Cursor or MCP Inspector to it to see it in action.
Supported Matrix
Database Resources
Resource Name | URI Format | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite | Oracle |
---|---|---|---|---|---|---|---|
schemas | db://schemas | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
tables_in_schema | db://schemas/{schemaName}/tables | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
table_structure_in_schema | db://schemas/{schemaName}/tables/{tableName} | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
indexes_in_table | db://schemas/{schemaName}/tables/{tableName}/indexes | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
procedures_in_schema | db://schemas/{schemaName}/procedures | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
procedure_details_in_schema | db://schemas/{schemaName}/procedures/{procedureName} | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
Database Tools
Tool | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite | Oracle |
---|---|---|---|---|---|---|---|
Execute SQL | execute_sql | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
List Connectors | list_connectors | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Prompt Capabilities
Prompt | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite | Oracle |
---|---|---|---|---|---|---|---|
Generate SQL | generate_sql | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Explain DB Elements | explain_db | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Installation
Docker
NPM
Note: The demo mode includes a bundled SQLite sample "employee" database with tables for employees, departments, salaries, and more.
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
SSL Connections
You can specify the SSL mode using the sslmode
parameter in your DSN string:
Database | sslmode=disable | sslmode=require | Default SSL Behavior |
---|---|---|---|
PostgreSQL | ✅ | ✅ | Certificate verification |
MySQL | ✅ | ✅ | Certificate verification |
MariaDB | ✅ | ✅ | Certificate verification |
SQL Server | ✅ | ✅ | Certificate verification |
Oracle | ✅ | ✅ | N/A (use Oracle client config) |
SQLite | ❌ | ❌ | N/A (file-based) |
SSL Mode Options:
sslmode=disable
: All SSL/TLS encryption is turned off. Data is transmitted in plaintext.sslmode=require
: Connection is encrypted, but the server's certificate is not verified. This provides protection against packet sniffing but not against man-in-the-middle attacks. You may use this for trusted self-signed CA.
Without specifying sslmode
, most databases default to certificate verification, which provides the highest level of security.
Example usage:
Read-only Mode
You can run DBHub in read-only mode, which restricts SQL query execution to read-only operations:
In read-only mode, only readonly SQL operations are allowed.
This provides an additional layer of security when connecting to production databases.
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
Warning
When running in Docker, use host.docker.internal
instead of localhost
to connect to databases running on your host machine. For example: mysql://user:password@host.docker.internal:3306/dbname
DBHub supports the following database connection string formats:
Database | DSN Format | Example |
---|---|---|
MySQL | mysql://[user]:[password]@[host]:[port]/[database] | mysql://user:password@localhost:3306/dbname?sslmode=disable |
MariaDB | mariadb://[user]:[password]@[host]:[port]/[database] | mariadb://user:password@localhost:3306/dbname?sslmode=disable |
PostgreSQL | postgres://[user]:[password]@[host]:[port]/[database] | postgres://user:password@localhost:5432/dbname?sslmode=disable |
SQL Server | sqlserver://[user]:[password]@[host]:[port]/[database] | sqlserver://user:password@localhost:1433/dbname?sslmode=disable |
SQLite | sqlite:///[path/to/file] or sqlite::memory: | sqlite:///path/to/database.db , sqlite:C:/Users/YourName/data/database.db (windows) or sqlite::memory: |
Oracle | oracle://[user]:[password]@[host]:[port]/[service_name] | oracle://username:password@localhost:1521/service_name?sslmode=disable |
Oracle
If you see the error "NJS-138: connections to this database server version are not supported by node-oracledb in Thin mode", you need to use Thick mode as described below.
Docker
Use bytebase/dbhub-oracle-thick
instead of bytebase/dbhub
docker image.
npx
- Download and install Oracle Instant Client for your platform
- Set the
ORACLE_LIB_DIR
environment variable to the path of your Oracle Instant Client:
SQL Server
Extra query parameters:
authentication
authentication=azure-active-directory-access-token
. Only applicable when running from Azure. See DefaultAzureCredential.
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 |
readonly | Restrict SQL execution to read-only operations | false |
The demo mode uses an in-memory SQLite database loaded with the sample employee database that includes tables for employees, departments, titles, salaries, department employees, and department managers. The sample database includes SQL scripts for table creation, data loading, and testing.
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
Contributors
Star History
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Universal database MCP server connecting to MySQL, PostgreSQL, SQLite, DuckDB and etc.
Related Resources
Related MCP Servers
- -securityFlicense-qualityAn MCP server that provides safe, read-only access to SQLite databases through MCP. This server is built with the FastMCP framework, which enables LLMs to explore and query SQLite databases with built-in safety features and query validation.Last updated -21Python
- -securityAlicense-qualityAn MCP server for MotherDuck and local DuckDB.Last updated -359PythonMIT License
- -securityAlicense-qualityMCP to access any database accessible via JDBC such as Postgres, Oracle, mysql, mariadb, sqlite etc.Last updated -103Apache 2.0
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -469517JavaScriptMIT License