Skip to main content
Glama
claude-code.mdx2.56 kB
--- title: "Claude Code" --- ## CLI <Tabs> <Tab title="Stdio"> For local database connections, use stdio transport: ```bash claude mcp add --transport stdio dbhub -- npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname" ``` <Note> The `--` separates Claude's flags from DBHub's arguments. Everything after `--` is the DBHub command. </Note> </Tab> <Tab title="HTTP"> For remote or shared database servers, use HTTP transport: ```bash claude mcp add --transport http dbhub http://localhost:8080/mcp ``` This connects to a DBHub server running with HTTP transport: ```bash npx @bytebase/dbhub --transport http --port 8080 --dsn "postgres://user:password@localhost:5432/dbname" ``` </Tab> </Tabs> ## Project Configuration For project-specific database connections shared with your team, create `.mcp.json` in your project root. <Tabs> <Tab title="Stdio"> ```json .mcp.json { "mcpServers": { "dbhub": { "type": "stdio", "command": "npx", "args": [ "@bytebase/dbhub", "--transport", "stdio", "--dsn", "postgres://user:password@localhost:5432/dbname" ] } } } ``` <Tip> Use environment variable expansion for sensitive values: ```json .mcp.json { "mcpServers": { "dbhub": { "type": "stdio", "command": "npx", "args": [ "@bytebase/dbhub", "--transport", "stdio", "--dsn", "${DATABASE_URL}" ] } } } ``` </Tip> </Tab> <Tab title="HTTP"> ```json .mcp.json { "mcpServers": { "dbhub": { "type": "http", "url": "http://localhost:8080/mcp" } } } ``` </Tab> </Tabs> ## User Configuration For personal configuration across all projects, add to your user scope: ```bash claude mcp add --scope user dbhub -- npx @bytebase/dbhub --transport stdio --dsn "postgres://user:password@localhost:5432/dbname" ``` Or manually edit the user configuration file: <Tabs> <Tab title="MacOS/Linux"> Edit `~/.claude/settings.json` and add to the `mcpServers` section. </Tab> <Tab title="Windows"> Edit `%USERPROFILE%\.claude\settings.json` and add to the `mcpServers` section. </Tab> </Tabs> ## ## Using DBHub Start Claude Code in your project directory: ```bash claude ``` Verify DBHub is loaded: ```bash /mcp ``` ## References - [Claude Code MCP Documentation](https://code.claude.com/docs/en/mcp)

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