Skip to main content
This guide will walk you through setting up DBHub and connecting it to an AI tool for the first time. We’ll use demo mode to get started quickly, then show you how to connect to your own database.

Prerequisites

Before starting, ensure you have:
  • Node.js 20+ installed (for NPM method) OR Docker installed
  • Access to an AI tool (Claude Desktop, Claude Code, Cursor, or VS Code)
  • Optionally: A PostgreSQL, MySQL, or other supported database

Choose Your Transport

DBHub supports two transport protocols:
TransportHow It WorksBest For
stdioAI tool spawns DBHub as a subprocessLocal desktop apps, single-user setups
httpDBHub runs as a standalone HTTP serverWeb clients, shared servers, remote access

Step 1: Start DBHub in Demo Mode

If using stdio transport, skip this step - your AI tool will spawn DBHub as a subprocess automatically.
For http transport, start DBHub server manually:
npx @bytebase/dbhub@latest --transport http --port 8080 --demo
The server will start at http://localhost:8080. The workbench is available at the root (/), and the MCP endpoint is at /mcp.
Running in DEMO mode - using sample employee database

 _____  ____  _   _       _
|  __ \|  _ \| | | |     | |
| |  | | |_) | |_| |_   _| |__
| |  | |  _ <|  _  | | | | '_ \
| |__| | |_) | | | | |_| | |_) |
|_____/|____/|_| |_|\__,_|_.__/

v0.11.10 [DEMO] - Minimal Database MCP Server

Workbench at http://localhost:8080/
MCP server endpoint at http://localhost:8080/mcp
Demo mode includes a sample SQLite “employee” database with realistic data.

Step 2: Connect with Your AI Tool

Choose your AI tool and follow the setup instructions in the Client Integration section:

Claude Code

Anthropic’s CLI for agentic coding

Claude Desktop

Anthropic’s desktop app

Codex

OpenAI’s CLI for agentic coding

Cursor

AI-powered code editor

Dify

Open-source AI app platform

LibreChat

Open-source chat UI

VS Code

GitHub Copilot integration

Step 3: Try It Out

Try these example prompts in your AI tool:
What schemas are available in the database?
The AI will use the db://schemas resource to list all schemas.
What tables are in the public schema?
The AI will use the db://schemas/public/tables resource.
Show me the top 5 employees by salary
The AI will generate and execute SQL like:
SELECT * FROM employees ORDER BY salary DESC LIMIT 5;
Update the salary of employee 10001 to 100000
The AI will generate and execute SQL like:
UPDATE salaries SET salary = 100000 WHERE emp_no = 10001;
This only works when the execute_sql tool is not configured with readonly = true. See Read-Only Mode.

Step 4: Install the Agent Skill (Optional)

DBHub provides an agent skill that teaches your AI tool the best-practice workflow for database querying — explore the schema first, then write precise SQL. This reduces errors and back-and-forth.
npx skills add bytebase/dbhub
The skill guides the AI to follow the explore-then-query pattern: discover schemas, find tables, inspect table structure, then write targeted queries. It works with all supported AI tools.

Step 5: Connect to Your Own Database

Once you’ve verified DBHub works in demo mode, connect it to your actual database.

DSN Configuration

Complete connection string formats and options for PostgreSQL, MySQL, MariaDB, SQL Server, and SQLite.