bytebase/dbhub

Token conscious database MCP server for Postgres, MySQL, SQL Server, Oracle, MariaDB, SQLite.

DBHub – a tiny, token‑efficient MCP server for AI‑driven database access

What it is – DBHub is a lightweight Model‑Connect‑Protocol (MCP) server that lets AI‑powered tools (Claude Desktop/Code, Cursor, VS Code, Copilot CLI, etc.) talk to real relational databases. It runs as a single process, has zero external dependencies, and exposes only the essential tools needed for an LLM to explore or query data safely.

Why it matters for AI/ML – Modern LLM‑based agents need a way to run SQL without blowing the model’s context window. DBHub’s default toolset (just execute_sql and search_objects) fits in ~1.4 k tokens, 10‑plus times smaller than competing MCP servers. This leaves far more of the model’s prompt space for the actual reasoning task, making DBHub a practical bridge between language models and production databases.

Key features

  • Token‑efficient core – 2 built‑in tools at 1.4 k tokens.
  • Multi‑database support – PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite.
  • Multi‑connection via a single TOML file – run one DBHub process for many databases.
  • Safety guardrails – read‑only mode, row limits, query timeouts, SSH tunneling, TLS encryption.
  • Optional extra tools – explain_sql, health_check, and user‑defined custom tools.
  • Built‑in web workbench – visual query console and request trace viewer.
  • Zero runtime dependencies – just Node ≥ 22.5 (uses the built‑in node:sqlite).

Typical use cases

  1. Local development – let Claude Code or VS Code explore schema, validate queries, and debug data without leaving the editor.
  2. Non‑technical dashboards – expose read‑only, rate‑limited views to business users via AI assistants.
  3. Consolidated DB gateway – replace a fleet of separate MCP servers with one DBHub instance.
  4. Production troubleshooting – run safe, read‑only diagnostics from an LLM when a service misbehaves.

How to get started

# Quick one‑liner (npm) – runs an HTTP‑based MCP server on port 8080
npx @bytebase/dbhub@latest \
  --transport http \
  --port 8080 \
  --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

Other deployment options:

  • Docker image (pull from Docker Hub)
  • MCP Bundle (one‑click, read‑only mode)
  • Claude Code plugin (direct integration in the Claude UI)

Development workflow

pnpm install          # install dev deps
pnpm dev              # run with hot‑reload
pnpm build && pnpm start --transport stdio --dsn "postgres://…"

The repo includes a dbhub.toml for multi‑database configuration, a web workbench under /docs/images/workbench, and test/debug docs.

Who’s behind it – The project is maintained by Bytebase (the company behind the enterprise‑grade database MCP platform). The README points to the full Bytebase product for teams that need richer guardrails.


All details are taken directly from the repository’s README; no additional features are inferred.

Related

  • Project
  • Project
  • Project
  • Project
  • Project