DBHub
Database MCP server for Postgres, MySQL, MariaDB, SQL Server, Oracle and SQLite
- Pricing
- Open source
- Platforms
- CLI, self-hosted, Linux
- Runs
- Locally
- Version
- 1.7.1
- Listing updated
- today
Similar MCP servers
About DBHub
DBHub is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
Context cost is the design goal. By default it loads two tools, which the README puts at about 1.4k tokens, and compares that with 19k for MCP Toolbox and Supabase MCP. Two more tools, explain_sql and health_check, are opt-in, and reusable parameterised queries can be defined in a dbhub.toml file.
Guardrails include read-only mode, row limits and query timeouts, plus SSH tunnelling and SSL/TLS for connections. A TOML config can connect several databases at once, so one process replaces a separate server per database. A built-in web workbench lets you run queries, custom tools and view request traces without an MCP client.
Run it with npx, Docker, a one-click MCP Bundle (read-only) or a Claude Code plugin. The README says it is the official PostgreSQL example in the Claude Code docs, and points to Bytebase for approval flows, access control, masking and audit logging.
Install
Run in a terminal
claude mcp add dbhub --env DSN='<DSN>' --env DB_PASSWORD='<DB_PASSWORD>' --env SSH_PASSWORD='<SSH_PASSWORD>' --env SSH_PASSPHRASE='<SSH_PASSPHRASE>' -- npx -y @bytebase/dbhubAdd to claude_desktop_config.json
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<DSN>",
"DB_PASSWORD": "<DB_PASSWORD>",
"SSH_PASSWORD": "<SSH_PASSWORD>",
"SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
}
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<DSN>",
"DB_PASSWORD": "<DB_PASSWORD>",
"SSH_PASSWORD": "<SSH_PASSWORD>",
"SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
}
}
}
}Add to .vscode/mcp.json
{
"servers": {
"dbhub": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<DSN>",
"DB_PASSWORD": "<DB_PASSWORD>",
"SSH_PASSWORD": "<SSH_PASSWORD>",
"SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<DSN>",
"DB_PASSWORD": "<DB_PASSWORD>",
"SSH_PASSWORD": "<SSH_PASSWORD>",
"SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
}
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"dbhub": {
"command": "npx",
"args": [
"-y",
"@bytebase/dbhub"
],
"env": {
"DSN": "<DSN>",
"DB_PASSWORD": "<DB_PASSWORD>",
"SSH_PASSWORD": "<SSH_PASSWORD>",
"SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
}
}
}
}Using several servers? Build one config file with the MCP config generator.
Configuration
DSNDatabase connection string (e.g., postgres://user:pass@host:5432/db)DB_TYPEDatabase type: postgres, mysql, mariadb, sqlserver, oracle, sqliteDB_HOSTDatabase hostnameDB_PORTDatabase portDB_USERDatabase usernameDB_PASSWORDDatabase passwordDB_NAMEDatabase name or SQLite file pathTRANSPORTTransport mode: stdio or httpPORTHTTP server port (default: 8080)IDInstance identifier for tool namesSSH_HOSTSSH server hostnameSSH_PORTSSH server port (default: 22)SSH_USERSSH usernameSSH_PASSWORDSSH passwordSSH_KEYPath to SSH private keySSH_PASSPHRASESSH key passphraseSSH_AUTH_SOCKPath to SSH agent socket
Tools this server provides (4)
Taken from the project documentation; the running server may differ.
- execute_sql
- Execute SQL queries with transaction support and safety controls.
- search_objects
- Search schemas, tables, columns, indexes and procedures with progressive disclosure.
- explain_sql
- Show a query's execution plan without running it (opt-in).
- health_check
- Report connection pool state and buffer cache hit ratio (opt-in).
What it does
- Two default tools
- execute_sql and search_objects keep the context footprint small.
- Six databases
- PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite behind one interface.
- Multi-connection config
- Connect several databases at once through TOML.
- Query guardrails
- Read-only mode, row limiting and query timeouts.
- SSH and TLS
- Tunnel through SSH and encrypt with SSL/TLS.
- Web workbench
- Run queries and custom tools and inspect request traces in a browser.
- Custom tools
- Define parameterised SQL operations in dbhub.toml.
Good for
- Explore a schema and debug data from Claude Code or Cursor
- Give non-technical staff curated read-only database access
- Replace several per-database MCP servers with one
- Run read-only production diagnostics with runaway-query protection
Pricing
Open source
Free open source
DBHub FAQ
Which databases are supported?
PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite.
How do I start it?
For example npx @bytebase/dbhub@latest --transport http --port 8080 --dsn with a connection string; Docker and an MCP Bundle also exist.
Can it be made read-only?
Yes, read-only mode is a listed guardrail and the MCP Bundle install is read-only.
What Node version does development need?
Node.js 22.5.0 or newer, because it uses the built-in node:sqlite module.
Is DBHub free?
Yes. DBHub is open source, so you can use and self-host it for free.
How do I add DBHub to Claude Code?
Run this command in your terminal: claude mcp add dbhub --env DSN='<DSN>' --env DB_PASSWORD='<DB_PASSWORD>' --env SSH_PASSWORD='<SSH_PASSWORD>' --env SSH_PASSPHRASE='<SSH_PASSPHRASE>' -- npx -y @bytebase/dbhub
What are the best alternatives to DBHub?
The closest alternatives to DBHub are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.


