
dbhub
Universal Database MCP Server que se conecta a MySQL, PostgreSQL, SQL Server, Mariadb, SQLite.
5
Github Watches
26
Github Forks
231
Github Stars
DBHub is a universal database gateway implementing the Model Context Protocol (MCP) server interface. This gateway allows MCP-compatible clients to connect to and explore different databases.
+------------------+ +--------------+ +------------------+
| | | | | |
| | | | | |
| Claude Desktop +--->+ +--->+ PostgreSQL |
| | | | | |
| Cursor +--->+ DBHub +--->+ SQL Server |
| | | | | |
| Other MCP +--->+ +--->+ SQLite |
| Clients | | | | |
| | | +--->+ MySQL |
| | | | | |
| | | +--->+ MariaDB |
| | | | | |
+------------------+ +--------------+ +------------------+
MCP Clients MCP Server Databases
Demo SSE Endpoint
https://demo.dbhub.ai/sse connects a sample employee database. You can point Cursor or MCP Inspector to it to see it in action.
Supported Matrix
Database Resources
Resource Name | URI Format | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
schemas | db://schemas |
✅ | ✅ | ✅ | ✅ | ✅ |
tables_in_schema | db://schemas/{schemaName}/tables |
✅ | ✅ | ✅ | ✅ | ✅ |
table_structure_in_schema | db://schemas/{schemaName}/tables/{tableName} |
✅ | ✅ | ✅ | ✅ | ✅ |
indexes_in_table | db://schemas/{schemaName}/tables/{tableName}/indexes |
✅ | ✅ | ✅ | ✅ | ✅ |
procedures_in_schema | db://schemas/{schemaName}/procedures |
✅ | ✅ | ✅ | ✅ | ❌ |
procedure_details_in_schema | db://schemas/{schemaName}/procedures/{procedureName} |
✅ | ✅ | ✅ | ✅ | ❌ |
Database Tools
Tool | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
Execute Query | run_query |
✅ | ✅ | ✅ | ✅ | ✅ |
List Connectors | list_connectors |
✅ | ✅ | ✅ | ✅ | ✅ |
Prompt Capabilities
Prompt | Command Name | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite |
---|---|---|---|---|---|---|
Generate SQL | generate_sql |
✅ | ✅ | ✅ | ✅ | ✅ |
Explain DB Elements | explain_db |
✅ | ✅ | ✅ | ✅ | ✅ |
Installation
Docker
# 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
NPM
# 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
Note: The demo mode includes a bundled SQLite sample "employee" database with tables for employees, departments, salaries, and more.
Claude Desktop
- Claude Desktop only supports
stdio
transport https://github.com/orgs/modelcontextprotocol/discussions/16
// 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"]
}
}
}
Cursor
- Cursor supports both
stdio
andsse
. - Follow Cursor MCP guide and make sure to use Agent mode.
Usage
Configure your database connection
You can use DBHub in demo mode with a sample employee database for testing:
npx @bytebase/dbhub --demo
For real databases, a Database Source Name (DSN) is required. You can provide this in several ways:
-
Command line argument (highest priority):
npx @bytebase/dbhub --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
-
Environment variable (second priority):
export DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @bytebase/dbhub
-
Environment file (third priority):
- For development: Create
.env.local
with your DSN - For production: Create
.env
with your DSN
DSN=postgres://user:password@localhost:5432/dbname?sslmode=disable
- For development: Create
[!WARNING] When running in Docker, use
host.docker.internal
instead oflocalhost
to connect to databases running on your host machine. For example:mysql://user:password@host.docker.internal:3306/dbname
DBHub supports the following database connection string formats:
Database | DSN Format | Example |
---|---|---|
MySQL | mysql://[user]:[password]@[host]:[port]/[database] |
mysql://user:password@localhost:3306/dbname |
MariaDB | mariadb://[user]:[password]@[host]:[port]/[database] |
mariadb://user:password@localhost:3306/dbname |
PostgreSQL | postgres://[user]:[password]@[host]:[port]/[database] |
postgres://user:password@localhost:5432/dbname?sslmode=disable |
SQL Server | sqlserver://[user]:[password]@[host]:[port]/[database] |
sqlserver://user:password@localhost:1433/dbname |
SQLite | sqlite:///[path/to/file] or sqlite::memory: |
sqlite:///path/to/database.db , sqlite:C:/Users/YourName/data/database.db (windows) or sqlite::memory: |
SQL Server
Extra query parameters:
authentication
-
authentication=azure-active-directory-access-token
. Only applicable when running from Azure. See DefaultAzureCredential.
Transport
-
stdio (default) - for direct integration with tools like Claude Desktop:
npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
-
sse - for browser and network clients:
npx @bytebase/dbhub --transport sse --port 5678 --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
Command line options
Option | Description | Default |
---|---|---|
demo | Run in demo mode with sample employee database | false |
dsn | Database connection string | Required if not in demo mode |
transport | Transport mode: stdio or sse |
stdio |
port | HTTP server port (only applicable when using --transport=sse ) |
8080 |
The demo mode uses an in-memory SQLite database loaded with the sample employee database that includes tables for employees, departments, titles, salaries, department employees, and department managers. The sample database includes SQL scripts for table creation, data loading, and testing.
Development
-
Install dependencies:
pnpm install
-
Run in development mode:
pnpm dev
-
Build for production:
pnpm build pnpm start --transport stdio --dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
Debug with 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
SSE
# Start DBHub with SSE transport
pnpm dev --transport=sse --port=8080
# Start the MCP Inspector in another terminal
npx @modelcontextprotocol/inspector
Connect to the DBHub server /sse
endpoint
Star History
相关推荐
I find academic articles and books for research and literature reviews.
Confidential guide on numerology and astrology, based of GG33 Public information
Converts Figma frames into front-end code for various mobile frameworks.
Advanced software engineer GPT that excels through nailing the basics.
Take an adjectivised noun, and create images making it progressively more adjective!
Siri Shortcut Finder – your go-to place for discovering amazing Siri Shortcuts with ease
Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.
Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx
Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.
La aplicación AI de escritorio todo en uno y Docker con trapo incorporado, agentes de IA, creador de agentes sin código, compatibilidad de MCP y más.
Un poderoso complemento Neovim para administrar servidores MCP (protocolo de contexto del modelo)
Puente entre los servidores Ollama y MCP, lo que permite a LLM locales utilizar herramientas de protocolo de contexto del modelo
🧑🚀 全世界最好的 llM 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Resumen de los mejores recursos del mundo.
Plataforma de automatización de flujo de trabajo de código justo con capacidades de IA nativas. Combine el edificio visual con código personalizado, auto-anfitrión o nube, más de 400 integraciones.
Reviews

user_zBCkC5th
I recently started using dbhub by bytebase, and it has significantly streamlined our database management tasks. The interface is user-friendly, and the features are robust, accommodating all our needs efficiently. Highly recommend for anyone looking for a reliable and efficient database management tool. Check it out on GitHub!