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) 服务器接口。该网关允许兼容 MCP 的客户端连接并探索不同的数据库。
演示 SSE 端点
https://demo.dbhub.ai/sse连接了一个示例员工数据库。您可以将 Cursor 或 MCP Inspector 指向该数据库,以查看其实际运行情况。
支持矩阵
数据库资源
资源名称 | URI 格式 | PostgreSQL | MySQL | 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} | ✅ | ✅ | ✅ | ❌ |
数据库工具
工具 | 命令名称 | PostgreSQL | MySQL | SQL 服务器 | SQLite |
---|---|---|---|---|---|
执行查询 | run_query | ✅ | ✅ | ✅ | ✅ |
列出连接器 | list_connectors | ✅ | ✅ | ✅ | ✅ |
提示功能
迅速的 | 命令名称 | PostgreSQL | MySQL | SQL 服务器 | SQLite |
---|---|---|---|---|---|
生成 SQL | generate_sql | ✅ | ✅ | ✅ | ✅ |
解释数据库元素 | explain_db | ✅ | ✅ | ✅ | ✅ |
安装
Docker
新公共管理
注意:演示模式包括捆绑的 SQLite 示例“员工”数据库,其中包含员工、部门、工资等表。
克劳德桌面
- Claude Desktop 仅支持
stdio
传输https://github.com/orgs/modelcontextprotocol/discussions/16
光标
- Cursor 同时支持
stdio
和sse
。 - 按照Cursor MCP 指南并确保使用代理模式。
用法
配置数据库连接
您可以在演示模式下使用 DBHub 和示例员工数据库进行测试:
对于真实数据库,需要数据库源名称 (DSN)。您可以通过以下几种方式提供此信息:
- 命令行参数(最高优先级):Copy
- 环境变量(第二优先级):Copy
- 环境文件(第三优先级):
- 对于开发:使用您的 DSN 创建
.env.local
- 对于生产:使用您的 DSN GXP10 创建
.env
- 对于开发:使用您的 DSN 创建
警告:在 Docker 中运行时,请使用
host.docker.internal
而不是localhost
连接到主机上运行的数据库。例如:mysql://user:password@host.docker.internal:3306/dbname
DBHub支持以下数据库连接字符串格式:
数据库 | DSN 格式 | 例子 |
---|---|---|
PostgreSQL | postgres://[user]:[password]@[host]:[port]/[database] | postgres://user:password@localhost:5432/dbname?sslmode=disable |
SQLite | sqlite:///[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 |
MySQL | mysql://[user]:[password]@[host]:[port]/[database] | mysql://user:password@localhost:3306/dbname |
运输
- stdio (默认)-用于与 Claude Desktop 等工具直接集成:Copy
- **sse——**适用于浏览器和网络客户端:Copy
命令行选项
选项 | 描述 | 默认 |
---|---|---|
演示 | 使用示例员工数据库以演示模式运行 | false |
域名系统 | 数据库连接字符串 | 如果非处于演示模式则为必填项 |
运输 | 传输模式: stdio 或sse | stdio |
港口 | HTTP 服务器端口(仅在使用--transport=sse 时适用) | 8080 |
演示模式使用内存 SQLite 数据库,其中加载了示例员工数据库,其中包含员工、部门、职称、薪资、部门员工和部门经理等表格。示例数据库包含用于创建表、加载数据和测试的 SQL 脚本。
发展
- 安装依赖项:Copy
- 以开发模式运行:Copy
- 为生产而构建:Copy
使用MCP Inspector进行调试
标准输入输出
上交所
连接到 DBHub 服务器/sse
端点
星史
This server cannot be installed
通用数据库 MCP 服务器连接到 MySQL、PostgreSQL、SQLite、DuckDB 等。