Skip to main content
MCP server CX Codex

DBHub — Claude Code MCP server: query your databases

Connects an AI client to PostgreSQL, MySQL, SQL Server, Oracle and SQLite through one MCP server. Useful when the agent needs to inspect schemas and run queries.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add --env DSN=<DSN> --env DB_TYPE=<DB_TYPE> --env DB_HOST=<DB_HOST> --env DB_PORT=<DB_PORT> --env DB_USER=<DB_USER> --transport stdio dbhub -- npx -y @bytebase/dbhub
Open on GitHub

What DBHub does

DBHub is a minimal MCP server: it loads just two tools by default, execute_sql and search_objects, at roughly 1.4k tokens. The other two, explain_sql and health_check, are opt-in. That keeps your context window free for actual work instead of tool descriptions.

One process can hold several databases at once — PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite. Connections live in a dbhub.toml file, where you can also define reusable parameterized SQL operations. Guardrails cover runaway queries: read-only mode, row limiting and a query timeout. For remote databases there is SSH tunneling and SSL/TLS.

Start it with npx @bytebase/dbhub@latest. Building the server from source needs Node.js >= 22.5.0, since it relies on the built-in node:sqlite module. Without a valid DSN the server will not come up, so have the connection string ready first. A built-in web Workbench lets you run queries and inspect request traces without any MCP client.

What it helps with

  • inspect table schemas before editing a migration
  • run a SELECT and check the data from chat
  • consolidate several databases under one MCP process
  • troubleshoot production in read-only mode
  • expose curated views to a non-technical teammate

Example prompts for the agent

  • Show me the structure of the orders table in the connected database
  • Run a query: how many orders were created in the last day
  • Find all indexes and procedures related to the users table

How to install DBHub

Platform CLI

claude mcp add --env DSN=<DSN> --env DB_TYPE=<DB_TYPE> --env DB_HOST=<DB_HOST> --env DB_PORT=<DB_PORT> --env DB_USER=<DB_USER> --transport stdio dbhub -- npx -y @bytebase/dbhub

Replace <…> with your own values. 12 more environment variables are in the server README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about DBHub

How do I install DBHub in Claude Code?

Add the server with `claude mcp add dbhub -e DSN=<DSN> -e DB_PASSWORD=<DB_PASSWORD> -e SSH_PASSWORD=<SSH_PASSWORD> -e SSH_PASSPHRASE=<SSH_PASSPHRASE> -- npx -y @bytebase/dbhub. A second form uses separate DB_TYPE, DB_HOST, DB_PORT, DB_USER variables and the stdio` transport.

What does DBHub do?

It acts as a gateway between an MCP client and a database. The agent gets tools for running SQL and searching schema objects, while you keep limits like read-only mode and query timeouts.

Which databases does DBHub support?

PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite. Multiple connections are configured in a single dbhub.toml file.

Similar MCP servers

All MCP servers for Data and databases →

From the same set2

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor