> ## Documentation Index
> Fetch the complete documentation index at: https://dbhub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

## npm

> [!NOTE]
>
> The npm method requires **Node.js >= 22.5.0** (DBHub uses Node's built-in `node:sqlite` module). The Docker image bundles a compatible Node runtime, so no local Node install is needed when running via Docker.

> [tab] npx
>
> ```bash theme={null}
> # 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
> ```

> [tab] Global Installation
>
> ```bash theme={null}
> # Install globally
> npm install -g @bytebase/dbhub@latest
>
> # Run the server
> dbhub --transport http --port 8080 --dsn "postgres://..."
>
> # Or use demo mode for testing
> dbhub --transport http --port 8080 --demo
> ```

### Minimal Installation

By default, DBHub attempts to install drivers for all supported databases (PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite). If you only need specific databases, you can skip the unnecessary drivers to reduce installation size.

This applies to `npm install` (global or local). When using `npx`, npm will attempt to install all optional dependencies, but some drivers may be skipped if their installation fails, a required transitive dependency is missing, or the platform is not supported.

```bash theme={null}
# Install with only the PostgreSQL driver
npm install -g @bytebase/dbhub@latest --omit=optional && npm install -g pg

# Install with only PostgreSQL and MySQL drivers
npm install -g @bytebase/dbhub@latest --omit=optional && npm install -g pg mysql2
```

Available driver packages:

* `pg` — PostgreSQL
* `mysql2` — MySQL
* `mariadb` — MariaDB
* `mssql` — SQL Server
* `oracledb` — Oracle (Thin mode: pure JavaScript, no Oracle Instant Client required)

SQLite uses the built-in `node:sqlite` module (Node.js 22.5+), so it requires no driver package or native compilation and is always available.

> [!NOTE]
>
> When a driver is not installed or a required dependency is missing (e.g., a transitive dependency like `@azure/core-client` for the SQL Server driver), DBHub will skip that connector at startup and log a message. All other connectors will work normally. SQLite (including `--demo` mode) needs no extra driver — it relies on the built-in `node:sqlite` module.

## MCP Bundle (.mcpb)

The [MCP Bundle](https://dbhub.ai/mcpb.md) is a one-click install for MCPB-compatible clients — Claude Desktop, Claude Code, MCP for Windows: download the `.mcpb` from the [latest release](https://github.com/bytebase/dbhub/releases/latest), install, enter your connection string. Read-only by default, no Node.js or JSON editing required — the recommended path for non-technical users. The guide also covers packaging your own bundle.

## Claude Code Plugin

The [Claude Code Plugin](https://dbhub.ai/claude-code-plugin.md) registers the DBHub MCP server in Claude Code with one install command and adds `/dbhub:setup` and `/dbhub:explore` skills. Claude Code prompts for the connection string and keeps it in secure storage. Read-only by design, like the MCP Bundle.

## Docker

> [tab] Docker Run
>
> ```bash theme={null}
> 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
> ```
>
> > [!WARNING]
> >
> > When connecting to databases on your host machine from Docker, use `host.docker.internal` instead of `localhost`:
> >
> > ```bash theme={null}
> > --dsn "postgres://user:password@host.docker.internal:5432/dbname"
> > ```

> [tab] Docker Compose
>
> For development environments using Docker Compose, add DBHub to your `docker-compose.yml`.
> Keep the database password out of the Compose file: put it in a gitignored `.env` next to
> `docker-compose.yml`, and let Compose interpolate it. DBHub reads the connection from the
> `DB_*` variables, so the password never has to be URL-encoded into a DSN.
>
> ```bash .env theme={null}
> POSTGRES_USER=user
> POSTGRES_PASSWORD=change-me
> POSTGRES_DB=dbname
> ```
>
> ```yaml docker-compose.yml theme={null}
> services:
>   dbhub:
>     image: bytebase/dbhub:latest
>     container_name: dbhub
>     init: true
>     ports:
>       - "127.0.0.1:8080:8080"
>     environment:
>       TRANSPORT: http
>       PORT: "8080"
>       DB_TYPE: postgres
>       DB_HOST: database
>       DB_PORT: "5432"
>       DB_USER: ${POSTGRES_USER}
>       DB_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
>       DB_NAME: ${POSTGRES_DB}
>     depends_on:
>       database:
>         condition: service_healthy
>
>   database:
>     image: postgres:18-alpine
>     environment:
>       POSTGRES_USER: ${POSTGRES_USER}
>       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
>       POSTGRES_DB: ${POSTGRES_DB}
>     volumes:
>       - postgres_data:/var/lib/postgresql
>     healthcheck:
>       test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
>       interval: 2s
>       timeout: 5s
>       retries: 10
>       start_period: 5s
>
> volumes:
>   postgres_data:
> ```
>
> > [!NOTE]
> >
> > `${POSTGRES_PASSWORD:?...}` makes `docker compose up` fail fast when the password is unset, and
> > `depends_on` with `condition: service_healthy` holds DBHub back until Postgres accepts connections.
> > Binding to `127.0.0.1` keeps the MCP endpoint off the network; drop the prefix, or add
> > [`--auth-token`](https://dbhub.ai/config/command-line), if other machines need to reach it.

## Client Integration

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

### Claude Code

> [!NOTE]
>
> Prefer a one-command, read-only install with a prompted connection string? Use the [Claude Code Plugin](https://dbhub.ai/claude-code-plugin.md). The manual registration below gives full control over flags, transports, and TOML configs.

> [tab] CLI
>
> > [tab] Stdio
> >
> > For local database connections, use stdio transport:
> >
> > ```bash theme={null}
> > claude mcp add --transport stdio dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"
> > ```
> >
> > > [!NOTE]
> > >
> > > The `--` separates Claude's flags from DBHub's arguments. Everything after `--` is the DBHub command.
>
> > [tab] HTTP
> >
> > For remote or shared database servers, use HTTP transport:
> >
> > ```bash theme={null}
> > claude mcp add --transport http dbhub http://localhost:8080/mcp
> > ```
> >
> > This connects to a DBHub server running with HTTP transport:
> >
> > ```bash theme={null}
> > npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
> > ```

> [tab] Project Configuration
>
> For project-specific database connections shared with your team, create `.mcp.json` in your project root.
>
> > [tab] Stdio
> >
> > ```json .mcp.json theme={null}
> > {
> >   "mcpServers": {
> >     "dbhub": {
> >       "type": "stdio",
> >       "command": "npx",
> >       "args": [
> >         "@bytebase/dbhub@latest",
> >         "--transport",
> >         "stdio",
> >         "--dsn",
> >         "postgres://user:password@localhost:5432/dbname"
> >       ]
> >     }
> >   }
> > }
> > ```
> >
> > > [!TIP]
> > >
> > > Use environment variable expansion for sensitive values:
> > >
> > > ```json .mcp.json theme={null}
> > > {
> > >   "mcpServers": {
> > >     "dbhub": {
> > >       "type": "stdio",
> > >       "command": "npx",
> > >       "args": [
> > >         "@bytebase/dbhub@latest",
> > >         "--transport",
> > >         "stdio",
> > >         "--dsn",
> > >         "${DATABASE_URL}"
> > >       ]
> > >     }
> > >   }
> > > }
> > > ```
>
> > [tab] HTTP
> >
> > ```json .mcp.json theme={null}
> > {
> >   "mcpServers": {
> >     "dbhub": {
> >       "type": "http",
> >       "url": "http://localhost:8080/mcp"
> >     }
> >   }
> > }
> > ```

> [tab] User Configuration
>
> For personal configuration across all projects:
>
> ```bash theme={null}
> claude mcp add --scope user dbhub -- npx @bytebase/dbhub@latest --transport stdio --dsn "postgres://user:password@localhost:5432/dbname"
> ```
>
> Or manually edit the user configuration file:
>
> > [tab] MacOS/Linux
> >
> > Edit `~/.claude/settings.json` and add to the `mcpServers` section.
>
> > [tab] Windows
> >
> > Edit `%USERPROFILE%\.claude\settings.json` and add to the `mcpServers` section.

**Using DBHub:**

Start Claude Code in your project directory:

```bash theme={null}
claude
```

Verify DBHub is loaded:

```bash theme={null}
/mcp
```

**References:**

* [Claude Code MCP Documentation](https://code.claude.com/docs/en/mcp)

### Claude Desktop

![Claude Desktop with DBHub](https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/claude-desktop.webp)

> [!NOTE]
>
> Prefer a one-click, read-only install with no JSON editing? Use the [MCP Bundle](https://dbhub.ai/mcpb.md). The manual config below gives full control over flags and transports.

> [tab] MacOS/Linux
>
> Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
>
> ```json ~/Library/Application Support/Claude/claude_desktop_config.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```

> [tab] Windows
>
> Edit `%APPDATA%\Claude\claude_desktop_config.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```

> [tab] Demo Mode
>
> For testing, you can use the built-in demo database:
>
> ```json ~/Library/Application Support/Claude/claude_desktop_config.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--demo"
>       ]
>     }
>   }
> }
> ```

**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:**

* [Claude Desktop MCP Documentation](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)

### Cursor

![Cursor with DBHub](https://raw.githubusercontent.com/bytebase/dbhub/main/docs/images/cursor.webp)

> [tab] One-Click Install
>
> Click the link below to install DBHub in Cursor:
>
> [![Install DBHub MCP server in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](cursor://anysphere.cursor-deeplink/mcp/install?name=dbhub\&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJAYnl0ZWJhc2UvZGJodWIiLCItLXRyYW5zcG9ydCIsInN0ZGlvIiwiLS1kc24iLCJwb3N0Z3JlczovL3VzZXI6cGFzc3dvcmRAbG9jYWxob3N0OjU0MzIvZGJuYW1lIl19)
>
> After installing, edit the DSN in your Cursor MCP settings to point to your database.

> [tab] Stdio (Local)
>
> For local database connections, use stdio transport:
>
> **MacOS/Linux** - Edit `~/.cursor/mcp.json`:
>
> ```json ~/.cursor/mcp.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```
>
> **Windows** - Edit `%USERPROFILE%\.cursor\mcp.json`:
>
> ```json %USERPROFILE%.cursor\mcp.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```

> [tab] HTTP (Remote)
>
> For remote or shared database servers, use HTTP transport:
>
> **MacOS/Linux** - Edit `~/.cursor/mcp.json`:
>
> ```json ~/.cursor/mcp.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "url": "http://localhost:8080/mcp"
>     }
>   }
> }
> ```
>
> **Windows** - Edit `%USERPROFILE%\.cursor\mcp.json`:
>
> ```json %USERPROFILE%.cursor\mcp.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "url": "http://localhost:8080/mcp"
>     }
>   }
> }
> ```
>
> This connects to a DBHub server running with HTTP transport:
>
> ```bash theme={null}
> npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
> ```

> [tab] Project-Specific
>
> For project-specific database connections, create `.cursor/mcp.json` in your project root:
>
> ```json .cursor/mcp.json theme={null}
> {
>   "mcpServers": {
>     "project-db": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--config",
>         "${workspaceFolder}/dbhub.toml"
>       ]
>     }
>   }
> }
> ```

**References:**

* [Cursor MCP Documentation](https://cursor.com/docs/context/mcp)

### VS Code

VS Code has native MCP support through GitHub Copilot. Create `.vscode/mcp.json` in your project root:

> [tab] Stdio (Local)
>
> For local database connections, use stdio transport:
>
> ```json .vscode/mcp.json theme={null}
> {
>   "servers": {
>     "dbhub": {
>       "type": "stdio",
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```

> [tab] HTTP (Remote)
>
> For remote or shared database servers, use HTTP transport:
>
> ```json .vscode/mcp.json theme={null}
> {
>   "servers": {
>     "dbhub": {
>       "type": "http",
>       "url": "http://localhost:8080/mcp"
>     }
>   }
> }
> ```
>
> This connects to a DBHub server running with HTTP transport:
>
> ```bash theme={null}
> npx @bytebase/dbhub@latest --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
> ```

> [tab] Input Variables
>
> For sensitive data like passwords, use input variables:
>
> ```json .vscode/mcp.json theme={null}
> {
>   "inputs": [
>     {
>       "type": "promptString",
>       "id": "db-dsn",
>       "description": "Database connection string",
>       "password": true
>     }
>   ],
>   "servers": {
>     "dbhub": {
>       "type": "stdio",
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "${input:db-dsn}"
>       ]
>     }
>   }
> }
> ```

> [tab] Config File
>
> For multi-database setups, use a config file:
>
> ```json .vscode/mcp.json theme={null}
> {
>   "servers": {
>     "dbhub": {
>       "type": "stdio",
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--config",
>         "${workspaceFolder}/dbhub.toml"
>       ]
>     }
>   }
> }
> ```

**References:**

* [VS Code MCP Documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers)

### GitHub Copilot CLI

> [tab] Interactive
>
> Use the Copilot CLI to interactively add the MCP server:
>
> ```
> /mcp add
> ```
>
> When prompted, you'll need to provide:
>
> * **Server type**: select `local` (the default)
> * **Server name**: for example, `dbhub`
> * **Command**: `npx @bytebase/dbhub@latest`
> * **Arguments**: transport (e.g., `--transport stdio`) and connection details (either `--dsn` connection string or `--demo` for the demo database)

> [tab] Config File
>
> Create or edit the configuration file `~/.copilot/mcp-config.json`:
>
> ```json ~/.copilot/mcp-config.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--dsn",
>         "postgres://user:password@localhost:5432/dbname"
>       ]
>     }
>   }
> }
> ```

> [tab] Demo Mode
>
> For testing, use the built-in demo database:
>
> ```json ~/.copilot/mcp-config.json theme={null}
> {
>   "mcpServers": {
>     "dbhub": {
>       "command": "npx",
>       "args": [
>         "@bytebase/dbhub@latest",
>         "--transport",
>         "stdio",
>         "--demo"
>       ]
>     }
>   }
> }
> ```

**References:**

* [Copilot CLI MCP Documentation](https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp)

### Codex

> [tab] CLI
>
> ```bash theme={null}
> # 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
> ```

> [tab] TOML
>
> ```toml ~/.codex/config.toml theme={null}
> # Connect to your database
> [mcp_servers.dbhub]
> command = "npx"
> args = ["@bytebase/dbhub@latest", "--transport", "stdio", "--dsn", "postgres://user:password@localhost:5432/dbname"]
>
> # Or use demo mode for testing
> [mcp_servers.dbhub]
> command = "npx"
> args = ["@bytebase/dbhub@latest", "--transport", "stdio", "--demo"]
> ```

> [tab] Verification
>
> ```bash theme={null}
> /mcp
>
> 🔌  MCP Tools
>
>   • dbhub
>     • Status: enabled
>     • Auth: Unsupported
>     • Command: npx -y @bytebase/dbhub@latest --demo
>     • Tools: execute_sql
>     • Resources: schemas (db://schemas)
>     • Resource templates: tables_in_schema (db://schemas/{schemaName}/tables), table_structure_in_schema (db://schemas/{schemaName}/
> tables/{tableName}), indexes_in_table (db://schemas/{schemaName}/tables/{tableName}/indexes), procedures_in_schema (db://schemas/
> {schemaName}/procedures), procedure_detail_in_schema (db://schemas/{schemaName}/procedures/{procedureName})
> ```

**References:**

* [Codex MCP Documentation](https://developers.openai.com/codex/mcp/)

### Dify

DBHub must be running as an HTTP server for Dify to connect. Start DBHub with HTTP transport:

```bash theme={null}
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:

```bash theme={null}
npx @bytebase/dbhub@latest --transport http --port 8080 --config /path/to/dbhub.toml
```

**Demo Mode:**

For testing, use the built-in demo database:

```bash theme={null}
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:**

* [Dify MCP Documentation](https://docs.dify.ai/en/guides/tools/mcp)

### LibreChat

DBHub can be integrated with [LibreChat](https://www.librechat.ai/) using either **stdio** or **Streamable HTTP** transport.

> [tab] stdio
>
> ```yaml librechat.yaml theme={null}
> mcpServers:
>   dbhub:
>     type: stdio
>     command: npx
>     args:
>       - -y
>       - "@bytebase/dbhub@latest"
>       - "--dsn"
>       - "postgres://user:password@localhost:5432/dbname"
>     timeout: 60000
> ```
>
> For demo mode:
>
> ```yaml librechat.yaml theme={null}
> mcpServers:
>   dbhub:
>     type: stdio
>     command: npx
>     args:
>       - -y
>       - "@bytebase/dbhub@latest"
>       - "--demo"
>     timeout: 60000
> ```

> [tab] Streamable HTTP
>
> ```yaml librechat.yaml theme={null}
> mcpServers:
>   dbhub:
>     type: streamable-http
>     url: http://host.docker.internal:8080/mcp
>     timeout: 60000
> ```
>
> > [!NOTE]
> >
> > **Docker Networking:** When LibreChat runs in Docker (e.g., with docker-compose), use `host.docker.internal:8080` to connect to DBHub running on your host machine. This is Docker's special DNS name that resolves to the host's IP address.
> >
> > For native installations, use `http://localhost:8080/mcp` instead.

**References:**

* [LibreChat MCP Documentation](https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/mcp_servers)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.