DBHub
Lets your AI agent explore and query PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite with safe limits.
3.8k stars on GitHubby BytebaseLicense MITUpdated 20 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add dbhub -- npx -y @bytebase/dbhub
What to fill in
| Name | What it is | Required |
|---|---|---|
DSN | Database connection string (e.g., postgres://user:pass@host:5432/db) | No |
DB_TYPE | Database type: postgres, mysql, mariadb, sqlserver, oracle, sqlite | No |
DB_HOST | Database hostname | No |
DB_PORT | Database port | No |
DB_USER | Database username | No |
DB_PASSWORD | Database password | No |
DB_NAME | Database name or SQLite file path | No |
TRANSPORT | Transport mode: stdio or http | No |
PORT | HTTP server port (default: 8080) | No |
ID | Instance identifier for tool names | No |
SSH_HOST | SSH server hostname | No |
SSH_PORT | SSH server port (default: 22) | No |
SSH_USER | SSH username | No |
SSH_PASSWORD | SSH password | No |
SSH_KEY | Path to SSH private key | No |
SSH_PASSPHRASE | SSH key passphrase | No |
SSH_AUTH_SOCK | Path to SSH agent socket | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Show me the tables in this database and their columns.
How many orders did we get last week, grouped by country?
What it is
DBHub is a small MCP server that connects your agent to one or more databases. It exposes just two tools by default to save on tokens, one to run SQL and one to explore the schema. It has guardrails such as read-only mode, row limits and query timeouts.
What it can do
execute_sql: run SQL queries with transaction support and safety controlssearch_objects: explore schemas, tables, columns, indexes and proceduresexplain_sql(opt-in): show a query plan without running ithealth_check(opt-in): report connection pool state and cache hit ratio- Custom tools: your own reusable SQL operations set in dbhub.toml
When to use
- βΊWhen you want your agent to explore a database schema while you build.
- βΊWhen you want staff to ask questions about read-only data in plain words.
- βΊWhen you want one server for several databases instead of one for each.
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
sql-database-assistantHelps your agent write and speed up SQL queries, explore a database schema, and create migrations for common database tools.postgres-expertHelps your agent speed up PostgreSQL queries, choose indexes, design schemas and run safe database maintenance.database-optimizerHelps your agent find slow database queries and speed them up, using execution plans, better indexes, query rewrites, and settings tuning for PostgreSQL and MySQL.Frequently asked questions
Is it free and open source?
Yes. It is open source. For enterprise guardrails like approval flow and audit logging, the readme points to Bytebase.
Which databases work?
PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite.
Is it safe to use on production?
It has guardrails such as read-only mode, row limiting and query timeouts, plus SSH tunneling and SSL/TLS. Use read-only mode for production checks.
Can I connect more than one database?
Yes. Use TOML configuration for several connections at once.
Is there a visual interface?
Yes. There is a built-in web Workbench to run queries and view request traces without an MCP client.
What is the install command?
npx @bytebase/dbhub@latest with a transport, port and DSN. There are also a Docker image, an MCP Bundle and a Claude Code plugin.
If it does not work
- βΊCheck that the connection string (DSN) has the right user, password, host and database name.
- βΊBuilding from source needs Node.js 22.5.0 or newer.
- βΊRestart your AI client fully after changing the config.
5 new skills a week. 1 minute to read.