# DBHub

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed · ★ 3722
- Author: bytebase
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/bytebase/dbhub
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/mcp/dbhub

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

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `DSN`, `DB_TYPE`, `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`, `TRANSPORT`, `PORT`, `ID` — keys and tokens: ask the human for the values, never commit them or put them in shared files.
- Works with: PostgreSQL

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
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

### Codex

**Platform CLI**
```bash
codex mcp add dbhub --env DSN=<DSN> --env DB_TYPE=<DB_TYPE> --env DB_HOST=<DB_HOST> --env DB_PORT=<DB_PORT> --env DB_USER=<DB_USER> -- npx -y @bytebase/dbhub
```
Replace <…> with your own values. 12 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "dbhub": {
            "command": "npx",
            "args": [
                "-y",
                "@bytebase/dbhub"
            ],
            "env": {
                "DSN": "<DSN>",
                "DB_TYPE": "<DB_TYPE>",
                "DB_HOST": "<DB_HOST>",
                "DB_PORT": "<DB_PORT>",
                "DB_USER": "<DB_USER>"
            }
        }
    }
}
```
Replace <…> with your own values. 12 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "dbhub": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@bytebase/dbhub"
            ],
            "env": {
                "DSN": "<DSN>",
                "DB_TYPE": "<DB_TYPE>",
                "DB_HOST": "<DB_HOST>",
                "DB_PORT": "<DB_PORT>",
                "DB_USER": "<DB_USER>"
            }
        }
    }
}
```
Replace <…> with your own values. 12 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e DSN=<DSN> -e DB_TYPE=<DB_TYPE> -e DB_HOST=<DB_HOST> -e DB_PORT=<DB_PORT> -e DB_USER=<DB_USER> dbhub npx -y @bytebase/dbhub
```
Replace <…> with your own values. 12 more environment variables are in the server README

## When to use it
- 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
- 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

## Similar
- [World Monitor](https://affpapa.org/en/nevibecode/mcp/world-monitor.md) — MCP server · ★ 89408
- [Scrapling MCP Server](https://affpapa.org/en/nevibecode/mcp/scrapling-mcp-server.md) — MCP server · ★ 89433
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [dbx](https://affpapa.org/en/nevibecode/mcp/dbx.md) — MCP server · ★ 27669
- [Metabase](https://affpapa.org/en/nevibecode/mcp/metabase.md) — MCP server · ★ 49845

From the same set: [bytebase/dbhub](https://affpapa.org/en/nevibecode/by/bytebase/dbhub.md) — 2 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
