DBHub MCP Server
Lightweight gateway that lets Claude query Postgres, MySQL, SQL Server, Oracle and SQLite.
Community, verifiedby BytebaseRuns on your computerChecked November 18, 2026
DBHub is a free, open-source MCP server from Bytebase (MIT) that connects Claude to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse or SQLite through one connection string, and it is the server the Claude Code docs use in their database example. It loads only two tools by default, execute_sql and search_objects, to save context; row limits, query timeouts and named custom tools are settings in one TOML file.
Who is DBHub MCP for?
- Developers who want Claude to query an existing database
- Analysts who need read-only SQL access
- Teams running several database engines
What can you ask DBHub MCP to do?
Once it is connected, ask in plain words. Your AI tool decides when to use the server and asks before it changes anything important.
What tables do we have, and which ones reference the customers table?How many new signups did we get each week this quarter?Find orders over 500 dollars that have no matching payment record.How to connect DBHub to Claude
MCP is an open standard. The setup steps below cover this server in Claude Code, Claude app, Codex, Cursor, VS Code, Gemini CLI, Antigravity, OpenCode, Windsurf. Pick your tool:
New to MCP? Read what an MCP server is and how to add one.
Connect the DBHub MCP server to Claude Code for me: run this command: claude mcp add --transport stdio dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://USER:PASSWORD@localhost:5432/DBNAME"
If a value starts with YOUR_, ask me for it first. When it is connected, help me sign in if needed and show me one thing I can ask it to do.Or do it yourself:
claude mcp add --transport stdio dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://USER:PASSWORD@localhost:5432/DBNAME"Unlock the setup steps
Free. Leave your email once to open the setup steps for all 152 servers, and get the best new connectors each month.
Good to know
The npx command can write to the database unless you connect with a read-only user or set readonly = true in dbhub.toml; the .mcpb bundle and DBHub's Claude Code and Codex plugins are read-only by design.
How did we check DBHub MCP?
Rechecked on November 18, 2026 (first check November 8), the day Bytebase published v2.0.0 of bytebase/dbhub (MIT, 3.9k stars), which adds ClickHouse and a Codex plugin. We read the README, the @bytebase/dbhub npm package (it requires Node.js 22.5 or newer), the command-line, read-only mode and TOML pages on dbhub.ai, and the Claude Code MCP docs, which use DBHub in their PostgreSQL example. We did not connect it to a database for this page.
Source: github.com/bytebase/dbhub
What do people ask about DBHub MCP?
Is DBHub read-only by default?
Not when you start it with npx and a connection string: execute_sql can run writes unless the tool is set to readonly = true in dbhub.toml. In read-only mode DBHub checks each statement against an allow-list and also runs it under the database's own read-only mechanism; the .mcpb bundle and the Claude Code and Codex plugins ship read-only.
Is read-only mode enough on its own?
No. DBHub's docs call read-only mode a guardrail, not a permission boundary: a privileged role can still reach server files or the network through functions a plain SELECT can call, such as lo_export and dblink on PostgreSQL or LOAD_FILE on MySQL, even inside a read-only transaction. Connect with a least-privilege, read-only database user scoped to the data Claude needs.
How can I try it without my own database?
Start it with the --demo flag and it loads a bundled SQLite sample employee database, so you can test prompts before you connect real data.
Why does DBHub load only two tools?
Bytebase keeps the default to execute_sql and search_objects so the tool list costs little context; its README puts it at about 0.5k tokens. explain_sql and health_check are opt-in, and you can add your own parameterized tools in the TOML file.
Do I need to know SQL to use DBHub?
No. You ask in plain words, Claude writes the SQL and DBHub runs it, so the habit that matters is reading the query in each approval prompt and refusing anything that is not a SELECT unless you meant it. A safe first step is the --demo flag with readonly = true, so you see how a refused write looks before real data is involved. The early-access Claude Code course covers adding servers like DBHub in its Skills and MCP lesson, and what MCP is explains the approval prompts in plain words.
We wrote these answers from the official pages of each product named, read on November 18, 2026.
More database servers
Using servers like DBHub from Claude Code? Our Claude Code course, in early access, goes from your first command to a landing page, an AI video and a working agent.
