{"type":"mcp_server","name":"dbhub","description":"DBHub is a universal database gateway that implements the Model Context Protocol (MCP) server interface, enabling MCP-compatible clients to connect to and explore various databases. DBHub is a universal database","category":"Database","language":"TypeScript","stars":3046,"forks":11,"owner":"bytebase","github_url":"https://github.com/bytebase/dbhub","homepage":null,"setup":"## Setup\n\n1.  **Docker:**\n    *   PostgreSQL example:\n\n        ```bash\n        docker run --rm --init \\\n           --name dbhub \\\n           --publish 8080:8080 \\\n           bytebase/dbhub \\\n           --transport sse \\\n           --port 8080 \\\n           --dsn \"postgres://user:password@localhost:5432/dbname?sslmode=disable\"\n        ```\n    *   Demo mode:\n\n        ```bash\n        docker run --rm --init \\\n           --name dbhub \\\n           --publish 8080:8080 \\\n           bytebase/dbhub \\\n           --transport sse \\\n           --port 8080 \\\n           --demo\n        ```\n\n2.  **NPM:**\n    *   PostgreSQL example:\n\n        ```bash\n        npx @bytebase/dbhub --transport sse --port 8080 --dsn \"postgres://user:password@localhost:5432/dbname\"\n        ```\n    *   Demo mode:\n\n        ```bash\n        npx @bytebase/dbhub --transport sse --port 8080 --demo\n        ```\n\n3.  **Claude Desktop:**\n    *   Create `claude_desktop_config.json` with the following content:\n\n        ```json\n        // claude_desktop_config.json\n        {\n          \"mcpServers\": {\n            \"dbhub-postgres-docker\": {\n              \"command\": \"docker\",\n              \"args\": [\n                \"run\",\n                \"-i\",\n                \"--rm\",\n                \"bytebase/dbhub\",\n                \"--transport\",\n                \"stdio\",\n                \"--dsn\",\n                // Use host.docker.internal as the host if connecting to the local db\n                \"postgres://user:password@host.docker.internal:5432/dbname?sslmode=disable\"\n              ]\n            },\n            \"dbhub-postgres-npx\": {\n              \"command\": \"npx\",\n              \"args\": [\n                \"-y\",\n                \"@bytebase/dbhub\",\n                \"--transport\",\n                \"stdio\",\n                \"--dsn\",\n                \"postgres://user:password@localhost:5432/dbname?sslmode=disable\"\n              ]\n            },\n            \"dbhub-demo\": {\n              \"command\": \"npx\",\n              \"args\": [\"-y\", \"@bytebase/dbhub\", \"--transport\", \"stdio\", \"--demo\"]\n            }\n          }\n        }\n        ```\n\n4.  **Cursor:**\n    *   Follow [Cursor MCP guide](https://docs.cursor.com/context/model-context-protocol) and use [Agent](https://docs.cursor.com/chat/agent) mode.\n\n5.  **Configure Database Connection:**\n    *   Use `--demo` for a sample database or provide a DSN via command line, environment variable, or environment file.\n\n6.  **Transport:**\n    *   Use `--transport stdio` for Claude Desktop or `--transport sse` for browser and network clients.\n\n7.  **Development:**\n    *   Install dependencies: `pnpm install`\n    *   Run in development mode: `pnpm dev`\n    *   Build for production: `pnpm build && pnpm start --transport stdio --dsn \"postgres://user:password@localhost:5432/dbname?sslmode=disable\"`\n\n8.  **Debug with MCP Inspector:**\n    *   For stdio: `TRANSPORT=stdio DSN=\"postgres://user:password@localhost:5432/dbname?sslmode=disable\" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js`\n    *   For SSE: Start DBHub with `pnpm dev --transport=sse --port=8080` and then start MCP Inspector in another terminal with `npx @modelcontextprotocol/inspector` and connect to the `/sse` endpoint.","tools":"## Available Tools\n\n1.  **Database Gateway:** Implements the Model Context Protocol (MCP) server interface.\n2.  **Demo SSE Endpoint:** Provides a sample employee database for testing.\n3.  **Database Resources:** Exposes schemas, tables, indexes, procedures, and their details via URIs.\n4.  **Database Tools:** Supports executing queries and listing connectors.\n5.  **Prompt Capabilities:** Enables generating SQL and explaining database elements.\n6.  **Demo Mode:** Runs with a sample employee database.\n7.  **Transport Options:** Supports `stdio` and `sse` transport modes.","faq":null,"created_at":"2025-03-09T16:36:38+00:00","updated_at":"2025-03-28T20:51:11+00:00","source_url":"https://model-context-protocol.com/servers/universal-database-gateway-mcp-server","related_articles":[]}