# DBHub

> DBHub is an open-source MCP server for databases. Database MCP server for Postgres, MySQL, MariaDB, SQL Server, Oracle and SQLite. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, self-hosted, Linux, macOS, Windows, Web
- **Repository:** https://github.com/bytebase/dbhub
- **MCP Registry name:** io.github.bytebase/dbhub
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
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
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "SSH_PASSWORD": "<SSH_PASSWORD>",
        "SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "SSH_PASSWORD": "<SSH_PASSWORD>",
        "SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```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>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "SSH_PASSWORD": "<SSH_PASSWORD>",
        "SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<DSN>",
        "DB_PASSWORD": "<DB_PASSWORD>",
        "SSH_PASSWORD": "<SSH_PASSWORD>",
        "SSH_PASSPHRASE": "<SSH_PASSPHRASE>"
      }
    }
  }
}
```

## Tools

- `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).

## 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.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/dbhub
