DBHub

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides Docker container deployment options for running the DBHub server with configurable database connections and transport options.

  • Supports connecting to DuckDB databases to explore tables, access schema information, and perform read-only SQL queries with safety measures.

  • Provides access to MySQL databases for browsing tables, viewing schema information, and executing read-only SQL queries with safety protections.

DBHub는 MCP(Model Context Protocol) 서버 인터페이스를 구현하는 범용 데이터베이스 게이트웨이입니다. 이 게이트웨이를 통해 MCP 호환 클라이언트는 다양한 데이터베이스에 연결하고 탐색할 수 있습니다.

지엑스피1

데모 SSE 엔드포인트

https://demo.dbhub.ai/sse는 샘플 직원 데이터베이스를 연결합니다. Cursor 또는 MCP Inspector를 연결하여 실제 작동 모습을 확인할 수 있습니다.

지원되는 매트릭스

데이터베이스 리소스

리소스 이름URI 형식포스트그레스큐엘MySQLSQL 서버SQLite
스키마db://schemas
스키마의 테이블db://schemas/{schemaName}/tables
스키마의 테이블 구조db://schemas/{schemaName}/tables/{tableName}
테이블의 인덱스db://schemas/{schemaName}/tables/{tableName}/indexes
스키마의 프로시저db://schemas/{schemaName}/procedures
스키마의 프로시저 세부 정보db://schemas/{schemaName}/procedures/{procedureName}

데이터베이스 도구

도구명령 이름포스트그레스큐엘MySQLSQL 서버SQLite
쿼리 실행run_query
목록 커넥터list_connectors

신속한 기능

즉각적인명령 이름포스트그레스큐엘MySQLSQL 서버SQLite
SQL 생성generate_sql
DB 요소 설명explain_db

설치

도커

# PostgreSQL example docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# Demo mode with sample employee database docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --demo

국립민간공원

# PostgreSQL example npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
# Demo mode with sample employee database npx @bytebase/dbhub --transport sse --port 8080 --demo

참고: 데모 모드에는 직원, 부서, 급여 등에 대한 테이블이 있는 SQLite 샘플 "직원" 데이터베이스가 함께 제공됩니다.

클로드 데스크탑

// claude_desktop_config.json { "mcpServers": { "dbhub-postgres-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "bytebase/dbhub", "--transport", "stdio", "--dsn", // Use host.docker.internal as the host if connecting to the local db "postgres://user:password@host.docker.internal:5432/dbname?sslmode=disable" ] }, "dbhub-postgres-npx": { "command": "npx", "args": [ "-y", "@bytebase/dbhub", "--transport", "stdio", "--dsn", "postgres://user:password@localhost:5432/dbname?sslmode=disable" ] }, "dbhub-demo": { "command": "npx", "args": ["-y", "@bytebase/dbhub", "--transport", "stdio", "--demo"] } } }

커서

용법

데이터베이스 연결 구성

테스트를 위해 샘플 직원 데이터베이스와 함께 데모 모드에서 DBHub를 사용할 수 있습니다.

npx @bytebase/dbhub --demo

실제 데이터베이스의 경우 데이터베이스 원본 이름(DSN)이 필요합니다. 다음과 같은 여러 가지 방법으로 제공할 수 있습니다.

  • 명령줄 인수 (가장 높은 우선순위):
    npx @bytebase/dbhub --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • 환경 변수 (두 번째 우선순위):
    export DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @bytebase/dbhub
  • 환경 파일 (3번째 우선순위):
    • 개발용: DSN으로 .env.local 만듭니다.
    • 프로덕션의 경우: DSN GXP10을 사용하여 .env 만듭니다.

[!경고] Docker에서 실행할 때 호스트 머신에서 실행 중인 데이터베이스에 연결하려면 localhost 대신 host.docker.internal 사용하세요. 예: mysql://user:password@host.docker.internal:3306/dbname

DBHub는 다음과 같은 데이터베이스 연결 문자열 형식을 지원합니다.

데이터 베이스DSN 형식
포스트그레스큐엘postgres://[user]:[password]@[host]:[port]/[database]postgres://user:password@localhost:5432/dbname?sslmode=disable
SQLitesqlite:///[path/to/file] 또는 sqlite::memory:sqlite:///path/to/database.db 또는 sqlite::memory:
SQL 서버sqlserver://[user]:[password]@[host]:[port]/[database]sqlserver://user:password@localhost:1433/dbname
MySQLmysql://[user]:[password]@[host]:[port]/[database]mysql://user:password@localhost:3306/dbname

수송

  • stdio (기본값) - Claude Desktop과 같은 도구와 직접 통합하기 위해:
    npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
  • sse - 브라우저 및 네트워크 클라이언트용:
    npx @bytebase/dbhub --transport sse --port 5678 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

명령줄 옵션

옵션설명기본
데모샘플 직원 데이터베이스로 데모 모드에서 실행false
디에스엔데이터베이스 연결 문자열데모 모드가 아닌 경우 필요합니다.
수송전송 모드: stdio 또는 ssestdio
포트HTTP 서버 포트( --transport=sse 사용할 때만 적용 가능)8080

데모 모드에서는 직원, 부서, 직함, 급여, 부서 직원 및 부서 관리자에 대한 테이블이 포함된 샘플 직원 데이터베이스가 로드된 인메모리 SQLite 데이터베이스를 사용합니다. 샘플 데이터베이스에는 테이블 생성, 데이터 로드 및 테스트를 위한 SQL 스크립트가 포함되어 있습니다.

개발

  1. 종속성 설치:
    pnpm install
  2. 개발 모드에서 실행:
    pnpm dev
  3. 프로덕션을 위해 빌드:
    pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

MCP Inspector 로 디버그

stdio

# PostgreSQL example TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js

남남동

# Start DBHub with SSE transport pnpm dev --transport=sse --port=8080 # Start the MCP Inspector in another terminal npx @modelcontextprotocol/inspector

DBHub 서버 /sse 엔드포인트에 연결합니다.

스타 역사

-
security - not tested
A
license - permissive license
-
quality - not tested

MySQL, PostgreSQL, SQLite, DuckDB 등에 연결되는 범용 데이터베이스 MCP 서버입니다.

  1. Supported Matrix
    1. Database Resources
    2. Database Tools
    3. Prompt Capabilities
  2. Installation
    1. Docker
    2. NPM
    3. Claude Desktop
    4. Cursor
  3. Usage
    1. Configure your database connection
    2. Transport
    3. Command line options
  4. Development
    1. Debug with MCP Inspector
  5. Star History
    ID: a01xnguu8x