/ Каталог / Песочница / DBHub
● Официальный bytebase 🔑 Нужен свой ключ

DBHub

автор bytebase · bytebase/dbhub

One MCP, many databases — Postgres, MySQL, SQL Server, SQLite, Oracle — in a read-only-by-default query interface.

Bytebase's DBHub is a zero-dependency MCP that speaks to multiple relational databases through a single npx @bytebase/dbhub binary. Pass the DSN for your DB flavor, get schema browsing, table sampling, and SQL execution. Runs in read-only mode by default, making it safe for exploratory production sessions.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

dbhub.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ]
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ]
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ]
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "dbhub": {
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ]
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "dbhub",
      "command": "npx",
      "args": [
        "-y",
        "@bytebase/dbhub"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "dbhub": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@bytebase/dbhub"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

claude mcp add dbhub -- npx -y @bytebase/dbhub

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: DBHub

Query 3 different databases in one session

👤 Engineers whose stack has >1 relational DB ⏱ ~20 min intermediate

Когда использовать: Your stack has Postgres for primary data, MySQL for a legacy service, and SQL Server for a reporting copy — and you want one AI assistant across all.

Предварительные требования
  • DSN for each DB with read-only creds — postgres://, mysql://, sqlserver://, sqlite://, oracle:// formats
Поток
  1. Configure multiple DSNs
    Show me which DB I'm currently pointed at. If needed, switch to the MySQL DSN.✓ Скопировано
    → Clear active-DB indicator
  2. Inspect schema
    List tables in the current DB with approximate row counts.✓ Скопировано
    → Table catalog
  3. Cross-reference across DBs
    Query Postgres for user emails, then query MySQL legacy_users for the same emails, tell me who's in one but not the other.✓ Скопировано
    → Reconciliation report

Итог: A single workflow across heterogeneous DBs without juggling different MCP servers.

Подводные камни
  • SQL dialect differences trip Claude (e.g. LIMIT vs TOP) — Tell Claude explicitly which DB flavor the current query targets, or split into DB-specific turns
Сочетать с: filesystem

Analyze a SQLite file someone sent you

👤 Engineers / analysts handed an opaque .db file ⏱ ~10 min beginner

Когда использовать: A customer sent a sqlite dump and wants it eyeballed.

Поток
  1. Point DBHub at the file
    Use DSN sqlite:///path/to/data.db. List tables + row counts.✓ Скопировано
    → Table inventory
  2. Sample each
    For each non-trivial table, show 5 sample rows and infer the purpose.✓ Скопировано
    → Per-table summary
  3. Answer the customer's question
    Customer asks: <question>. Write SQL, run, return answer.✓ Скопировано
    → Query + result

Итог: Fast exploration of an unfamiliar sqlite file without extracting it into another tool.

Подводные камни
  • Large sqlite tables have no indexes — full scans can lock the file — Open with read-only; avoid aggregations across >1M rows in a single query
Сочетать с: filesystem

Run reporting queries against a read-replica safely

👤 BI / analytics ⏱ ~15 min beginner

Когда использовать: You have a replica for analytics and want AI-driven ad-hoc reports without exposing the primary.

Предварительные требования
  • Read-only DSN against the replica — Replica-only credentials; statement_timeout enforced in DSN
Поток
  1. Verify it's the replica
    Confirm the current connection is read-only and points at the replica host.✓ Скопировано
    → Host string + read-only flag verified
  2. Run the report
    [paste business question]. Translate to SQL, run, return results.✓ Скопировано
    → Result set
  3. Persist for re-use
    Save this SQL to /reports/<name>.sql with a comment explaining the question.✓ Скопировано
    → SQL file saved

Итог: Ad-hoc BI without risk to prod primary.

Подводные камни
  • Heavy queries slow the replica and create replication lag — Set statement_timeout and run big queries off-peak
Сочетать с: filesystem · antv-chart

Audit SQL Server stored procedures for a migration

👤 Teams migrating off SQL Server ⏱ ~30 min advanced

Когда использовать: You need a list of every stored procedure, its lines of code, and last-modified date.

Поток
  1. List procs
    Query sys.procedures + sys.sql_modules to list all procs with name, schema, lines, and last modified date.✓ Скопировано
    → Proc inventory
  2. Classify complexity
    Bucket procs by line count: trivial (<50), medium (50-300), complex (>300). Count each bucket.✓ Скопировано
    → Complexity histogram
  3. Surface MSSQL-specific features
    For complex procs, flag usage of MSSQL-specific constructs (CROSS APPLY, CTE recursion, TOP, GETDATE) — these are the hard migration items.✓ Скопировано
    → Migration-risk list

Итог: A stored-procedure migration plan grounded in real counts.

Подводные камни
  • Some procs contain dynamic SQL that's hard to classify — Flag any proc with EXEC sp_executesql for manual review
Сочетать с: filesystem

Комбинации

Сочетайте с другими MCP — эффект x10

dbhub + antv-chart

Run SQL then chart the result directly

Query weekly revenue from the Postgres replica via DBHub, then render as an AntV line chart.✓ Скопировано
dbhub + filesystem

Save queries + results for reproducibility

Run the weekly KPI query, save SQL to /sql/weekly.sql and result CSV to /data/weekly-<date>.csv.✓ Скопировано
dbhub + notion

Post a SQL-backed report to Notion

Run the top-customers query, create a Notion page with the result as a table.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
list_databases First exploration step free
list_tables database? Catalog before queries free
describe_table table, schema? Inspect schema before querying free
execute_sql sql, params? Read or write SQL (write requires flag) depends on query
execute_read_sql sql, params? Explicit read-only execution depends

Стоимость и лимиты

Во что обходится

Квота API
Bounded by your DB connection limits
Токенов на вызов
Depends on result size; cap with LIMIT
Деньги
Free — costs are your DB hosting only
Совет
Set a statement_timeout in the DSN; AI-written queries can be enthusiastic about full scans.

Безопасность

Права, секреты, радиус поражения

Минимальные скоупы: SELECT on target tables
Хранение учётных данных: DSN in env (DSN or per-flavor env var)
Исходящий трафик: Direct to your DB; no third-party proxy
Никогда не давайте: CREATE/DROP/ALTER in the connection role unless needed for the session

Устранение неполадок

Частые ошибки и исправления

Authentication failed / access denied

DSN credentials wrong or lacking SELECT. Recheck DSN format for each flavor.

Проверить: Connect with the DB's native client using the same DSN
Unsupported SQL feature / syntax error

Flavor mismatch — tell Claude which DB dialect is active, or re-check the DSN prefix.

Connection pool exhausted

Lower concurrency or increase pool size; long-running queries are usually the real cause.

Writes rejected (read-only)

DBHub is in default read-only. Restart with --readonly=false for this session.

Альтернативы

DBHub в сравнении

АльтернативаКогда использоватьКомпромисс
Postgres MCPYou only use Postgres; deeper Postgres-specific featuresSingle-flavor
MongoDB MCPYou need Mongo alongside relationalDifferent data model
Supabase MCPYou're on Supabase and want project+DB managementTied to Supabase

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills