DBHub MCP Server
io.github.bytebase/dbhub
Token-efficient MCP server for querying PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, and SQLite databases.
What this kind of tool is for
- Query, inspect, or seed a database without writing a one-off script.
- Let your agent look up schema details before it writes migration code.
- Move a small dataset between tools without leaving the terminal.
How to compare servers like this
- Engine match:
- Confirm it speaks your exact database and version, not just the family.
- Access scope:
- Read-only connections are the safe default — start there before granting writes.
- Safety rails:
- Check whether destructive statements need an explicit confirmation before they run.
- Maintenance signal:
- Database drivers change; a recently updated tool is less likely to break mid-query.
This page carries your copy-paste config: pick your MCP client in the install section on this page and use the copy button.
What is the DBHub MCP server?
DBHub is a zero-dependency, token-efficient MCP server that connects MCP-compatible clients like Claude and Cursor to multiple databases. It provides SQL execution, schema exploration, and custom parameterized operations across PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, and SQLite with built-in safety controls like read-only mode and query timeouts.
DBHub acts as a lightweight gateway between AI agents and databases, allowing you to query and explore database schemas directly from Claude, Cursor, or other MCP clients. It supports multiple databases simultaneously, includes a web workbench for visual interaction, and prioritizes token efficiency and security with features like SSH tunneling, SSL/TLS encryption, and row limiting.
How to install DBHub
Copy-paste configuration for popular MCP clients.
DSNsecretDatabase connection string (e.g., postgres://user:pass@host:5432/db)
DB_TYPEDatabase type: postgres, mysql, mariadb, sqlserver, oracle, sqlite
DB_HOSTDatabase hostname
DB_PORTDatabase port
DB_USERDatabase username
DB_PASSWORDsecretDatabase password
DB_NAMEDatabase name or SQLite file path
TRANSPORTTransport mode: stdio or http
PORTHTTP server port (default: 8080)
IDInstance identifier for tool names
SSH_HOSTSSH server hostname
SSH_PORTSSH server port (default: 22)
SSH_USERSSH username
SSH_PASSWORDsecretSSH password
SSH_KEYPath to SSH private key
SSH_PASSPHRASEsecretSSH key passphrase
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<YOUR_DSN>",
"DB_TYPE": "<YOUR_DB_TYPE>",
"DB_HOST": "<YOUR_DB_HOST>",
"DB_PORT": "<YOUR_DB_PORT>",
"DB_USER": "<YOUR_DB_USER>",
"DB_PASSWORD": "<YOUR_DB_PASSWORD>",
"DB_NAME": "<YOUR_DB_NAME>",
"TRANSPORT": "<YOUR_TRANSPORT>",
"PORT": "<YOUR_PORT>",
"ID": "<YOUR_ID>",
"SSH_HOST": "<YOUR_SSH_HOST>",
"SSH_PORT": "<YOUR_SSH_PORT>",
"SSH_USER": "<YOUR_SSH_USER>",
"SSH_PASSWORD": "<YOUR_SSH_PASSWORD>",
"SSH_KEY": "<YOUR_SSH_KEY>",
"SSH_PASSPHRASE": "<YOUR_SSH_PASSPHRASE>"
}
}
}
}Tools & capabilities
Tools this server exposes to the agent.
execute_sql— Execute SQL queries with transaction support and safety controls including read-only mode, row limiting, and query timeout.search_objects— Search and explore database schemas, tables, columns, indexes, and procedures with progressive disclosure.Custom Tools— Define reusable, parameterized SQL operations in dbhub.toml configuration file.
Use cases
- Query production databases directly from Claude or Cursor to analyze data and generate insights
- Explore database schemas and table structures without leaving your IDE or chat interface
- Execute parameterized SQL operations defined in configuration for common database tasks
- Connect to multiple databases (production, staging, dev) simultaneously from a single DBHub instance
- Build AI-powered database analysis and reporting workflows with safety guardrails
DBHub MCP server FAQ
DBHub is an MCP server that lets AI agents like Claude and Cursor query and explore PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, and SQLite databases directly. It's designed to be token-efficient with just two core tools and includes safety features like read-only mode and query timeouts.
Yes, DBHub is open-source and free to use. It's maintained by Bytebase, an open-source database DevSecOps platform.
You can install via NPM (`npm install @bytebase/dbhub`), Docker, or run it directly with `npx @bytebase/dbhub@latest`. Requires Node.js >= 22.5.0 for NPM installation.
DBHub runs as an MCP server and exposes an HTTP or stdio transport. Configure it in your MCP client's settings (Claude Desktop, Cursor, VS Code) by pointing to the DBHub server endpoint and providing your database connection string.
DBHub itself doesn't authenticate HTTP clients—it relies on network isolation or a reverse proxy for security. Database authentication is handled through connection strings (DSN). For production, bind to 127.0.0.1 and use a reverse proxy.
Yes, DBHub supports multi-database setup via TOML configuration files, allowing you to manage production, staging, and development databases from a single instance.
README (reference)
Source of truth, from the repository.
<p align="center"> <a href="https://dbhub.ai/" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-dark.svg" width="75%"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-light.svg" width="75%"> <img src="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-light.svg" width="75%" alt="DBHub Logo"> </picture> </a> </p>[!NOTE]
Brought to you by Bytebase, open-source database DevSecOps platform.
+------------------+ +--------------+ +------------------+
| | | | | |
| | | | | |
| Claude Desktop +--->+ +--->+ PostgreSQL |
| | | | | |
| Claude Code +--->+ +--->+ SQL Server |
| | | | | |
| Cursor +--->+ DBHub +--->+ SQLite |
| | | | | |
| VS Code +--->+ +--->+ MySQL |
| | | | | |
| Copilot CLI +--->+ +--->+ MariaDB |
| | | | | |
| | | | | |
+------------------+ +--------------+ +------------------+
MCP Clients MCP Server Databases
DBHub is a zero-dependency, token efficient MCP server implementing the Model Context Protocol (MCP) server interface. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases:
- Local Development First: Zero dependency, token efficient with just two MCP tools to maximize context window
- Multi-Database: PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite through a single interface
- Multi-Connection: Connect to multiple databases simultaneously with TOML configuration
- Guardrails: Read-only mode, row limiting, and query timeout to prevent runaway operations
- Secure Access: SSH tunneling and SSL/TLS encryption
Supported Databases
PostgreSQL, MySQL, SQL Server, MariaDB, and SQLite.
MCP Tools
DBHub implements MCP tools for database operations:
- execute_sql: Execute SQL queries with transaction support and safety controls
- search_objects: Search and explore database schemas, tables, columns, indexes, and procedures with progressive disclosure
- Custom Tools: Define reusable, parameterized SQL operations in your
dbhub.tomlconfiguration file
Workbench
DBHub includes a built-in web interface for interacting with your database tools. It provides a visual way to execute queries, run custom tools, and view request traces without requiring an MCP client.

Installation
See the full Installation Guide for detailed instructions.
Quick Start
Docker:
docker run --rm --init \
--name dbhub \
--publish 8080:8080 \
bytebase/dbhub \
--transport http \
--port 8080 \
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
NPM: (requires Node.js >= 22.5.0)
npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
Demo Mode:
npx @bytebase/dbhub@latest --transport http --port 8080 --demo
Restrict to loopback (recommended for production):
npx @bytebase/dbhub@latest --transport http --host 127.0.0.1 --port 8080 --demo
The HTTP transport defaults to
--host 0.0.0.0, exposing DBHub on every network interface. For production, bind to127.0.0.1and front DBHub with a reverse proxy (nginx/Caddy) or firewall — DBHub does not authenticate HTTP clients.The HTTP transport also has built-in DNS-rebinding protection: it only accepts requests whose
Hostis loopback, this machine's own hostname/IPs, or a name you allow via--allowed-hosts. If a client behind a reverse proxy or custom DNS name gets a403, add that hostname with--allowed-hosts.
See Command-Line Options for all available parameters.
Multi-Database Setup
Connect to multiple databases simultaneously using TOML configuration files. Perfect for managing production, staging, and development databases from a single DBHub instance.
See Multi-Database Configuration for complete setup instructions.
Development
Requires Node.js >= 22.5.0 (DBHub uses the built-in node:sqlite module).
# Install dependencies
pnpm install
# Run in development mode
pnpm dev
# Build and run for production
pnpm build && pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"
Contributors
<a href="https://github.com/bytebase/dbhub/graphs/contributors"> <img src="https://contrib.rocks/image?repo=bytebase/dbhub" /> </a>Star History
<a href="https://www.star-history.com/?repos=bytebase%2Fdbhub&type=date&legend=top-left"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&legend=top-left" /> </picture> </a>Related MCP servers

Semantic search and AI-powered curation for your Calibre ebook library — meaning-based retrieval, metadata management, and safe writes.

ChatSpatial
Schema-enforced spatial transcriptomics analysis with 20 MCP tools and 66 methods via natural language

AllRatesToday
Real-time & historical exchange rates for 160+ currencies. No API key needed to start.
Real-time currency exchange rates, historical data, and multi-currency lookups for MCP clients.
Browser automation for AI agents via MCP, powering ByteDance's Agent TARS hybrid GUI/DOM browser control.
Run arbitrary shell commands from an MCP-connected AI agent.
