Skip to main content
Glama

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

지엑스피1

데모 SSE 엔드포인트

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

mcp-검사관

Related MCP server: Supabase MCP Server

지원되는 매트릭스

데이터베이스 리소스

리소스 이름

URI 형식

포스트그레스큐엘

MySQL

마리아DB

SQL 서버

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}

데이터베이스 도구

도구

명령 이름

포스트그레스큐엘

MySQL

마리아DB

SQL 서버

SQLite

신탁

SQL 실행

execute_sql

목록 커넥터

list_connectors

신속한 기능

즉각적인

명령 이름

포스트그레스큐엘

MySQL

마리아DB

SQL 서버

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
# Oracle example docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub \ --transport sse \ --port 8080 \ --dsn "oracle://username:password@localhost:1521/service_name"
# Oracle example with thick mode for connecting to 11g or older docker run --rm --init \ --name dbhub \ --publish 8080:8080 \ bytebase/dbhub-oracle-thick \ --transport sse \ --port 8080 \ --dsn "oracle://username:password@localhost:1521/service_name"

국립민간공원

# PostgreSQL example npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
# 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"] } } }

커서

커서

용법

SSL 연결

DSN 문자열의 sslmode 매개변수를 사용하여 SSL 모드를 지정할 수 있습니다.

데이터 베이스

sslmode=disable

sslmode=require

기본 SSL 동작

포스트그레스큐엘

인증서 검증

MySQL

인증서 검증

마리아DB

인증서 검증

SQL 서버

인증서 검증

신탁

N/A(Oracle 클라이언트 구성 사용)

SQLite

N/A(파일 기반)

SSL 모드 옵션:

  • sslmode=disable : 모든 SSL/TLS 암호화가 해제됩니다. 데이터는 일반 텍스트로 전송됩니다.

  • sslmode=require : 연결은 암호화되지만 서버 인증서는 검증되지 않습니다. 이 설정은 패킷 스니핑으로부터 보호하지만, 중간자 공격(man-in-the-middle attack)으로부터는 보호하지 못합니다. 신뢰할 수 있는 자체 서명 CA에 사용할 수 있습니다.

sslmode 지정하지 않으면 대부분의 데이터베이스는 가장 높은 수준의 보안을 제공하는 인증서 검증을 기본적으로 사용합니다.

사용 예:

# Disable SSL postgres://user:password@localhost:5432/dbname?sslmode=disable # Require SSL without certificate verification postgres://user:password@localhost:5432/dbname?sslmode=require # Standard SSL with certificate verification (default) postgres://user:password@localhost:5432/dbname

읽기 전용 모드

DBHub를 읽기 전용 모드로 실행하면 SQL 쿼리 실행이 읽기 전용 작업으로 제한됩니다.

# Enable read-only mode npx @bytebase/dbhub --readonly --dsn "postgres://user:password@localhost:5432/dbname"

읽기 전용 모드에서는 읽기 전용 SQL 작업 만 허용됩니다.

이렇게 하면 프로덕션 데이터베이스에 연결할 때 보안을 한층 강화할 수 있습니다.

데이터베이스 연결 구성

테스트를 위해 샘플 직원 데이터베이스와 함께 데모 모드에서 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 GXP14로 .env 생성합니다.

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

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

데이터 베이스

DSN 형식

MySQL

mysql://[user]:[password]@[host]:[port]/[database]

mysql://user:password@localhost:3306/dbname?sslmode=disable

마리아DB

mariadb://[user]:[password]@[host]:[port]/[database]

mariadb://user:password@localhost:3306/dbname?sslmode=disable

포스트그레스큐엘

postgres://[user]:[password]@[host]:[port]/[database]

postgres://user:password@localhost:5432/dbname?sslmode=disable

SQL 서버

sqlserver://[user]:[password]@[host]:[port]/[database]

sqlserver://user:password@localhost:1433/dbname?sslmode=disable

SQLite

sqlite:///[path/to/file]

또는

sqlite::memory:

sqlite:///path/to/database.db

,

sqlite:C:/Users/YourName/data/database.db (windows)

또는

sqlite::memory:

신탁

oracle://[user]:[password]@[host]:[port]/[service_name]

oracle://username:password@localhost:1521/service_name?sslmode=disable

신탁

"NJS-138: 이 데이터베이스 서버 버전에 대한 연결은 Thin 모드에서 node-oracledb에서 지원되지 않습니다."라는 오류가 표시되면 아래 설명된 대로 Thick 모드를 사용해야 합니다.

도커

bytebase/dbhub docker 이미지 대신 bytebase/dbhub bytebase/dbhub-oracle-thick 사용하세요.

엔피엑스
  1. 플랫폼에 맞는 Oracle Instant Client를 다운로드하고 설치하세요.

  2. ORACLE_LIB_DIR 환경 변수를 Oracle Instant Client 경로로 설정합니다.

# Set environment variable to Oracle Instant Client directory export ORACLE_LIB_DIR=/path/to/instantclient_19_8 # Then run DBHub npx @bytebase/dbhub --dsn "oracle://username:password@localhost:1521/service_name"

SQL 서버

추가 쿼리 매개변수:

입증

  • authentication=azure-active-directory-access-token . Azure에서 실행하는 경우에만 적용됩니다. DefaultAzureCredential 을 참조하세요.

수송

  • 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

또는

sse

stdio

포트

HTTP 서버 포트(

--transport=sse

사용할 때만 적용 가능)

8080

읽기 전용

SQL 실행을 읽기 전용 작업으로 제한합니다.

false

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

개발

  1. 종속성 설치:

    pnpm install
  2. 개발 모드에서 실행:

    pnpm dev
  3. 프로덕션을 위해 빌드:

    pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"

테스트

이 프로젝트에서는 테스트를 위해 Vitest를 사용합니다.

  • 테스트 실행: pnpm test

  • 감시 모드에서 테스트 실행: pnpm test:watch

사전 커밋 후크(개발자용)

이 프로젝트에는 각 커밋 전에 자동으로 테스트를 실행하기 위한 사전 커밋 후크가 포함되어 있습니다.

  1. 저장소를 복제한 후, 커밋 전 후크를 설정합니다.

    ./scripts/setup-husky.sh
  2. 이렇게 하면 커밋을 생성할 때마다 테스트 모음이 자동으로 실행되어 테스트를 중단시키는 커밋이 방지됩니다.

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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bytebase/dbhub'

If you have feedback or need assistance with the MCP directory API, please join our Discord server