DBHub

Lets an assistant explore schemas and run SQL on PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite

By Bytebase TypeScript Local · stdio Databases

86 popularity score ★ 3.8k ↓ 52k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

It needs DSN. Replace each <NAME> with your value.

Claude CodeTerminal
claude mcp add dbhub -e DSN=<DSN> -- npx -y @bytebase/dbhub
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>"
      }
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>"
      }
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "dbhub": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>"
      }
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.dbhub]
command = "npx"
args = ["-y", "@bytebase/dbhub"]

[mcp_servers.dbhub.env]
DSN = "<DSN>"
Gemini CLITerminal
gemini mcp add --scope user -e DSN=<DSN> dbhub npx -- -y @bytebase/dbhub

Settings 5

DSN Required: Database connection string, e.g. postgres://user:password@localhost:5432/dbname (or pass --dsn).
TRANSPORT Optional: stdio (default) or http.
PORT Optional: HTTP server port, http transport only (default 8080).
DBHUB_AUTH_TOKEN Optional: Bearer tokens required on every HTTP request; auth is off unless set.
DBHUB_HOST Optional: HTTP bind address (default 0.0.0.0).

What it does

DBHub is a database MCP server from Bytebase. One process connects an MCP client such as Claude Code, Claude Desktop, Cursor or VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle or SQLite. It loads two tools by default, execute_sql and search_objects, to keep the tool list small. explain_sql and health_check are optional extras, and you can define your own parameterized SQL tools in a dbhub.toml file.

A single database is set with a DSN connection string, through the --dsn flag, the DSN variable or the DB_* variables. A TOML file passed with --config can connect several databases at once and set options per tool, such as read-only mode, row limits and query timeouts. Connections can go through SSH tunnels (bastion and jump hosts) and use SSL/TLS.

It runs on your machine with npx (Node.js 22.5.0 or later) or from the bytebase/dbhub Docker image, over stdio by default or over HTTP. HTTP mode also serves a web workbench for running queries and tools and viewing request traces. There is also a one-click MCP Bundle and a Claude Code plugin, and both are read-only.

Tools 4

execute_sql
Execute SQL queries with transaction support and safety controls
search_objects
Search and explore database schemas, tables, columns, indexes and procedures
explain_sql
Opt-in: show a query's execution plan without running it
health_check
Opt-in: report connection pool state and buffer cache hit ratio

Similar servers