Skip to main content

npm

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

# Or use demo mode for testing
npx @bytebase/dbhub@latest --transport http --port 8080 --demo

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"

# Or use demo mode for testing
docker run --rm --init \
  --name dbhub \
  --publish 8080:8080 \
  bytebase/dbhub \
  --transport http \
  --port 8080 \
  --demo
When connecting to databases on your host machine from Docker, use host.docker.internal instead of localhost:
--dsn "postgres://user:[email protected]:5432/dbname"

Client Integration

Once DBHub is installed and running, configure your MCP client to connect to it.

Claude Code

For local database connections, use stdio transport:
claude mcp add --transport stdio dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"
The -- separates Claude’s flags from DBHub’s arguments. Everything after -- is the DBHub command.
Using DBHub: Start Claude Code in your project directory:
claude
Verify DBHub is loaded:
/mcp
References:

Claude Desktop

Claude Desktop with DBHub
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "@bytebase/dbhub@latest",
        "--transport",
        "stdio",
        "--dsn",
        "postgres://user:password@localhost:5432/dbname"
      ]
    }
  }
}
Troubleshooting:
  • Verify your DSN connection string is correct
  • Check that the database is accessible from your machine
  • Review Claude Desktop logs: ~/Library/Logs/Claude/mcp*.log (MacOS)
References:

Cursor

Cursor with DBHub
Click the link below to install DBHub in Cursor:Install DBHub MCP server in CursorAfter installing, edit the DSN in your Cursor MCP settings to point to your database.
References:

VS Code

VS Code has native MCP support through GitHub Copilot. Create .vscode/mcp.json in your project root:
For local database connections, use stdio transport:
.vscode/mcp.json
{
  "servers": {
    "dbhub": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@bytebase/dbhub@latest",
        "--transport",
        "stdio",
        "--dsn",
        "postgres://user:password@localhost:5432/dbname"
      ]
    }
  }
}
References:

Codex

# Connect to your database
codex mcp add dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"

# Or use demo mode for testing
codex mcp add dbhub -- npx @bytebase/dbhub@latest --transport stdio --demo
References:

Dify

DBHub must be running as an HTTP server for Dify to connect. Start DBHub with HTTP transport:
npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
Configuration:
  1. In Dify, navigate to Tools → MCP
  2. Click Add MCP Server (HTTP)
  3. Configure the server:
    • Server URL: http://localhost:8080/mcp (or your DBHub host)
    • Name: DBHub
    • Server Identifier: dbhub (permanent, max 24 characters)
  4. Click save. Dify will automatically discover DBHub’s tools.
Using DBHub Tools: Once connected, DBHub tools are available in:
  • Agents: Tools appear alongside built-in tools, use “Add All” to enable all DBHub tools
  • Workflows: Tools appear as available node types
Multi-Database Setup: For multiple databases, use a config file:
npx @bytebase/dbhub@latest --transport http --port 8080 --config /path/to/dbhub.toml
Demo Mode: For testing, use the built-in demo database:
npx @bytebase/dbhub@latest --transport http --port 8080 --demo
Limitations:
  • Dify only supports HTTP transport (not stdio)
  • DBHub must be network-accessible from Dify
References:

LibreChat

DBHub can be integrated with LibreChat using either stdio or Streamable HTTP transport.
librechat.yaml
mcpServers:
  dbhub:
    type: stdio
    command: npx
    args:
      - -y
      - "@bytebase/dbhub@latest"
      - "--dsn"
      - "postgres://user:password@localhost:5432/dbname"
    timeout: 60000
For demo mode:
librechat.yaml
mcpServers:
  dbhub:
    type: stdio
    command: npx
    args:
      - -y
      - "@bytebase/dbhub@latest"
      - "--demo"
    timeout: 60000
References: