DBHub

Databases

Token-efficient MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse, SQLite.

Your AI app calls the DBHub MCP server, which does the databases work and sends the result back to the chat.

About DBHub

DBHub is a community MCP server from bytebase, filed in our directory under databases. Token-efficient MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse, SQLite.

DBHub runs on your own machine: your AI app starts it with the command npx -y @bytebase/dbhub@2.1.0 and talks to it over standard input and output.

DBHub is listed in the official MCP registry as io.github.bytebase/dbhub, version 2.1.0.

At a glance

Publisher
bytebase (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @bytebase/dbhub
Written in
TypeScript
License
MIT
GitHub stars
4,042
Official MCP registry
io.github.bytebase/dbhub

How to set up DBHub

  1. Install Node.js on the machine that runs your AI app, because DBHub starts with npx and downloads its package on first run.
  2. Check the DBHub README for keys or settings; the registry lists none that DBHub requires.
  3. Add DBHub to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the DBHub tools to confirm the connection.
  5. Run one read-only task with DBHub first, and keep your app asking before each tool call until the results look right.

DBHub compared with similar servers

  • Postgres by crystaldba has fewer GitHub stars than DBHub (3.5k against 4k); both are community servers, and both run locally.
  • Google by google has more GitHub stars than DBHub (4.8k against 4k); Google is official while DBHub is a community server, and Google runs as a remote server and DBHub runs on your own machine.
  • FlyEnv by xpf0000 has fewer GitHub stars than DBHub (3.4k against 4k); both are community servers, and both run locally.

Before you connect DBHub

  • Give DBHub its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each DBHub tool call until you trust what it does with them.
  • Treat text that DBHub fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for DBHub on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for DBHub

How marketing and sales teams put DBHub to work, by company size. Pick the size closest to yours and start DBHub on one use case.

Small business

  • A small business with its own app can ask DBHub plain questions about customers and orders, without writing SQL.
  • Owners can use DBHub to pull a list of customers who haven't bought in 90 days and plan a win-back email.
  • DBHub runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing analysts can connect DBHub to answer campaign questions from the warehouse directly, instead of waiting on the data team's queue.
  • Lifecycle teams can use DBHub to build audience lists from product data and check counts before a send.
  • Start DBHub on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should point DBHub at a read replica with a read-only role, so agents query freely without risk to production data.
  • Data teams can expose curated views through DBHub, so marketing gets self-serve answers without access to raw customer tables.
  • DBHub is a community server, so have security review the code and pin a version before DBHub touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

DBHub README

From bytebase/dbhub on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

[!NOTE]
If you need an enterprise-level database MCP server with built-in guardrails like approval flow, access control, data masking, and audit logging beyond what DBHub offers, check out Bytebase.

            +------------------+    +--------------+    +------------------+
            |                  |    |              |    |                  |
            |  Claude Desktop  +--->+              +--->+    PostgreSQL    |
            |                  |    |              |    |                  |
            |  Claude Code     +--->+              +--->+    SQL Server    |
            |                  |    |              |    |                  |
            |  Codex           +--->+    DBHub     +--->+    Oracle        |
            |                  |    |              |    |                  |
            |  Cursor          +--->+              +--->+    SQLite        |
            |                  |    |              |    |                  |
            |  VS Code         +--->+              +--->+    MySQL         |
            |                  |    |              |    |                  |
            |  Copilot CLI     +--->+              +--->+    MariaDB       |
            |                  |    |              |    |                  |
            |                  |    |              +--->+    ClickHouse    |
            |                  |    |              |    |                  |
            +------------------+    +--------------+    +------------------+
                 MCP Clients           MCP Server             Databases

DBHub is a minimal MCP server: token-efficient, zero-dependency, and just two tools by default with opt-in extras. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases:

  • Minimal: Zero dependency, token efficient with a minimal set of MCP tools to maximize context window
  • Multi-Database: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse, and SQLite through a single interface
  • Multi-Connection: Connect to multiple databases simultaneously with TOML configuration
  • Guardrails: Read-only mode, row limiting, and query timeout to prevent runaway operations
  • Secure Access: SSH tunneling and SSL/TLS encryption

Token Efficiency

DBHub's two built-in tool definitions total 261 tokens with the cl100k_base tokenizer.

MCP Server Definition Tokens Tools
DBHub 2.0.1 261 2
MCP Toolbox 1.18.0 3,901 29
Supabase MCP 0.19.0 6,982 36

Full tool definitions, not session usage. See the November 2026 benchmark for configurations and reproduction steps.

Use Cases

  • Local Development: Schema exploration, query validation, and data debugging with Claude Code, VS Code, Cursor, etc.
  • Non-Technical Access: Expose curated, read-only views to non-technical staff via Claude Desktop, VS Code, Cursor, etc.
  • Multi-Database Consolidation: Replace separate MCP servers for each database with a single DBHub process
  • Production Troubleshooting: Read-only diagnostics with guardrails against runaway queries

Read-only mode is a guardrail, not a permission boundary. Always connect with a least-privilege, read-only database user. See Read-Only Mode.

Supported Databases

PostgreSQL, MySQL, SQL Server, MariaDB, Oracle, ClickHouse, and SQLite.

MCP Tools

DBHub implements MCP tools for database operations:

  • execute_sql: Execute SQL queries with transaction support and safety controls
  • search_objects: Search and explore database schemas, tables, columns, indexes, and procedures with progressive disclosure
  • 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
  • Custom Tools: Define reusable, parameterized SQL operations in your dbhub.toml configuration file

Workbench

DBHub includes a built-in web interface for interacting with your database tools. It provides a visual way to execute queries, run custom tools, and view request traces without requiring an MCP client.

Workbench overview

Execute SQL

Request traces

Installation

npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

For Claude Code, install the plugin:

/plugin marketplace add bytebase/dbhub
/plugin install dbhub@dbhub

For Codex, install the plugin (reads the connection string from DBHUB_DSN):

codex plugin marketplace add bytebase/dbhub
codex plugin add dbhub@dbhub

Also available as:

See the Installation Guide for all options, Command-Line Options for parameters, and Multi-Database Configuration for connecting several databases at once.

Replacing @modelcontextprotocol/server-postgres

The reference PostgreSQL MCP server, @modelcontextprotocol/server-postgres, is archived and marked deprecated on npm ("Archived and unmaintained; no security guarantees"). DBHub is a maintained replacement. Swap the package and pass the connection string with --dsn; an existing postgresql:// URL works unchanged.

Before:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
    }
  }
}

After:

{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": ["-y", "@bytebase/dbhub@latest", "--dsn", "postgresql://localhost/mydb"]
    }
  }
}

The old server only ran read-only queries. With --dsn alone, DBHub's execute_sql can also write. To keep it read-only, point --config at a TOML file that sets readonly = true. The replacement guide has that config and the other differences.

Development

Requires Node.js >= 22.5.0 (DBHub uses the built-in node:sqlite module).

# Install dependencies
pnpm install

# Run in development mode
pnpm dev

# Build and run for production
pnpm build && pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"

See Testing and Debug.

See the branding guide for logo assets, the Zinc color theme, and the asset sync workflow.

Contributors

Star History

Questions about DBHub

What is the DBHub MCP server?

Token-efficient MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse, SQLite. DBHub is maintained by bytebase on GitHub at bytebase/dbhub, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the DBHub MCP server?

Add DBHub to your AI app's MCP config with the command npx -y @bytebase/dbhub@2.1.0. In Claude Code, run claude mcp add --transport stdio dbhub -- npx -y @bytebase/dbhub@2.1.0. To run DBHub this way you need Node.js installed.

Does DBHub need an API key?

The registry lists no required keys for DBHub. Check the DBHub README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is DBHub an official MCP server?

No. DBHub is a community server maintained by bytebase. Community servers can be excellent; read the code and the open issues before you give DBHub access to company data.

What license is DBHub under?

DBHub is released under the MIT license, according to its GitHub repository. The license covers the code of DBHub; the service it connects to has its own terms.