PluginBench
MCP Server
Active
MIT

DBHub MCP Server

io.github.bytebase/dbhub

Token-efficient MCP server for querying PostgreSQL, MySQL, SQL Server, SQLite, and MariaDB with zero dependencies.

What is the DBHub MCP server?

DBHub is a lightweight, zero-dependency MCP server that enables AI agents to connect to and query multiple databases including PostgreSQL, MySQL, SQL Server, SQLite, and MariaDB. It provides two core tools—execute_sql and search_objects—optimized for minimal token usage, plus support for custom parameterized SQL operations defined in configuration.

DBHub acts as a gateway between MCP-compatible clients (Claude, Cursor, VS Code) and your databases. It's designed for local development with read-only mode, row limiting, query timeouts, and security features like SSH tunneling and SSL/TLS encryption. A built-in web workbench lets you test queries and tools without an MCP client.

How to install DBHub

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • DSN
    secret

    Database connection string (e.g., postgres://user:pass@host:5432/db)

  • DB_TYPE

    Database type: postgres, mysql, mariadb, sqlserver, sqlite

  • DB_HOST

    Database hostname

  • DB_PORT

    Database port

  • DB_USER

    Database username

  • DB_PASSWORD
    secret

    Database password

  • DB_NAME

    Database name or SQLite file path

  • TRANSPORT

    Transport mode: stdio or http

  • PORT

    HTTP server port (default: 8080)

  • ID

    Instance identifier for tool names

  • SSH_HOST

    SSH server hostname

  • SSH_PORT

    SSH server port (default: 22)

  • SSH_USER

    SSH username

  • SSH_PASSWORD
    secret

    SSH password

  • SSH_KEY

    Path to SSH private key

  • SSH_PASSPHRASE
    secret

    SSH key passphrase

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ],
      "env": {
        "DSN": "<YOUR_DSN>",
        "DB_TYPE": "<YOUR_DB_TYPE>",
        "DB_HOST": "<YOUR_DB_HOST>",
        "DB_PORT": "<YOUR_DB_PORT>",
        "DB_USER": "<YOUR_DB_USER>",
        "DB_PASSWORD": "<YOUR_DB_PASSWORD>",
        "DB_NAME": "<YOUR_DB_NAME>",
        "TRANSPORT": "<YOUR_TRANSPORT>",
        "PORT": "<YOUR_PORT>",
        "ID": "<YOUR_ID>",
        "SSH_HOST": "<YOUR_SSH_HOST>",
        "SSH_PORT": "<YOUR_SSH_PORT>",
        "SSH_USER": "<YOUR_SSH_USER>",
        "SSH_PASSWORD": "<YOUR_SSH_PASSWORD>",
        "SSH_KEY": "<YOUR_SSH_KEY>",
        "SSH_PASSPHRASE": "<YOUR_SSH_PASSPHRASE>"
      }
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • execute_sql — Execute SQL queries with transaction support and safety controls including read-only mode, row limiting, and query timeouts.
  • search_objects — Search and explore database schemas, tables, columns, indexes, and procedures with progressive disclosure.
  • Custom Tools — Define reusable, parameterized SQL operations in your dbhub.toml configuration file.

Use cases

  • Query production databases safely from Claude or Cursor with read-only guardrails and row limits.
  • Explore database schemas and structure to understand table relationships and column definitions.
  • Execute parameterized SQL operations defined as custom tools for repeated tasks.
  • Connect to multiple databases simultaneously (production, staging, dev) from a single DBHub instance.
  • Debug database issues using the built-in web workbench without setting up an MCP client.

DBHub MCP server FAQ

What databases does DBHub support?

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

Is DBHub free?

Yes, DBHub is open-source and brought to you by Bytebase, an open-source database DevSecOps platform.

How do I install DBHub in Cursor or Claude?

Install via npm: `npx @bytebase/dbhub@latest` (requires Node.js >= 22.5.0), or use Docker. Configure it as an MCP server in your client's settings pointing to the DBHub HTTP or stdio transport.

Does DBHub require authentication?

DBHub does not authenticate HTTP clients itself. For production, bind to 127.0.0.1 and use a reverse proxy (nginx/Caddy) or firewall. SSH tunneling and SSL/TLS encryption are supported for database connections.

Can I connect to multiple databases at once?

Yes, use TOML configuration files to connect to multiple databases simultaneously from a single DBHub instance.

What safety features does DBHub have?

Read-only mode, row limiting, query timeouts, and DNS-rebinding protection to prevent runaway operations and unauthorized access.

README (reference)

Source of truth, from the repository.

[!NOTE]
Brought to you by Bytebase, open-source database DevSecOps platform.

<p align="center"> <a href="https://dbhub.ai/" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-dark.svg" width="75%"> <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-light.svg" width="75%"> <img src="https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/logo/full-light.svg" width="75%" alt="DBHub Logo"> </picture> </a> </p>
            +------------------+    +--------------+    +------------------+
            |                  |    |              |    |                  |
            |                  |    |              |    |                  |
            |  Claude Desktop  +--->+              +--->+    PostgreSQL    |
            |                  |    |              |    |                  |
            |  Claude Code     +--->+              +--->+    SQL Server    |
            |                  |    |              |    |                  |
            |  Cursor          +--->+    DBHub     +--->+    SQLite        |
            |                  |    |              |    |                  |
            |  VS Code         +--->+              +--->+    MySQL         |
            |                  |    |              |    |                  |
            |  Copilot CLI     +--->+              +--->+    MariaDB       |
            |                  |    |              |    |                  |
            |                  |    |              |    |                  |
            +------------------+    +--------------+    +------------------+
                 MCP Clients           MCP Server             Databases

DBHub is a zero-dependency, token efficient MCP server implementing the Model Context Protocol (MCP) server interface. This lightweight gateway allows MCP-compatible clients to connect to and explore different databases:

  • Local Development First: Zero dependency, token efficient with just two MCP tools to maximize context window
  • Multi-Database: PostgreSQL, MySQL, MariaDB, SQL Server, 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

Supported Databases

PostgreSQL, MySQL, SQL Server, MariaDB, 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
  • 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

Installation

See the full Installation Guide for detailed instructions.

Quick Start

Docker:

docker run --rm --init \
   --name dbhub \
   --publish 8080:8080 \
   bytebase/dbhub \
   --transport http \
   --port 8080 \
   --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

NPM: (requires Node.js >= 22.5.0)

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

Demo Mode:

npx @bytebase/dbhub@latest --transport http --port 8080 --demo

Restrict to loopback (recommended for production):

npx @bytebase/dbhub@latest --transport http --host 127.0.0.1 --port 8080 --demo

The HTTP transport defaults to --host 0.0.0.0, exposing DBHub on every network interface. For production, bind to 127.0.0.1 and front DBHub with a reverse proxy (nginx/Caddy) or firewall — DBHub does not authenticate HTTP clients.

The HTTP transport also has built-in DNS-rebinding protection: it only accepts requests whose Host is loopback, this machine's own hostname/IPs, or a name you allow via --allowed-hosts. If a client behind a reverse proxy or custom DNS name gets a 403, add that hostname with --allowed-hosts.

See Command-Line Options for all available parameters.

Multi-Database Setup

Connect to multiple databases simultaneously using TOML configuration files. Perfect for managing production, staging, and development databases from a single DBHub instance.

See Multi-Database Configuration for complete setup instructions.

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.

Contributors

<a href="https://github.com/bytebase/dbhub/graphs/contributors"> <img src="https://contrib.rocks/image?repo=bytebase/dbhub" /> </a>

Star History

<a href="https://www.star-history.com/?repos=bytebase%2Fdbhub&type=date&legend=top-left"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&theme=dark&legend=top-left" /> <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&legend=top-left" /> <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=bytebase/dbhub&type=date&legend=top-left" /> </picture> </a>

Related MCP servers

Browser automation for AI agents via MCP, powering ByteDance's Agent TARS hybrid GUI/DOM browser control.

37k
TypeScript
Apache-2.0
View repository →

Run arbitrary shell commands from an MCP-connected AI agent.

37k
TypeScript
Apache-2.0
View repository →

Filesystem access MCP server from ByteDance's UI-TARS/Agent TARS ecosystem.

37k
TypeScript
Apache-2.0
View repository →

Adds web search capability to MCP-enabled AI agents like Agent TARS.

37k
TypeScript
Apache-2.0
View repository →

An MCP server that provides Email, Phone and Address Validation Services from Byteplant

1
Python
View repository →
VIViewMax MCP logo

Remote MCP for AI video, image, music and speech generation.

0
View repository →