@@ -35,6 +35,51 @@ DBHub is a universal database gateway implementing the Model Context Protocol (M
3535
3636## Usage
3737
38+ ### Configure your database connection
39+
40+ DBHub requires a Database Source Name (DSN) to connect to your database. You can provide this in several ways:
41+
42+ - ** Command line argument** (highest priority):
43+
44+ ``` bash
45+ pnpm dev --dsn " postgres://user:password@localhost:5432/dbname?sslmode=disable"
46+ ```
47+
48+ - ** Environment variable** (second priority):
49+
50+ ``` bash
51+ export DSN=" postgres://user:password@localhost:5432/dbname?sslmode=disable"
52+ pnpm dev
53+ ```
54+
55+ - ** Environment file** (third priority):
56+ - For development: Create ` .env.local ` with your DSN
57+ - For production: Create ` .env ` with your DSN
58+ ```
59+ DSN=postgres://user:password@localhost:5432/dbname?sslmode=disable
60+ ```
61+
62+ ### Transport
63+
64+ - ** stdio** (default) - for direct integration with tools like Claude Desktop:
65+
66+ ``` bash
67+ npx @bytebase/dbhub --transport stdio --dsn " postgres://user:password@localhost:5432/dbname?sslmode=disable"
68+ ```
69+
70+ - ** sse** - for browser and network clients:
71+ ``` bash
72+ npx @bytebase/dbhub --transport sse --port 5678 --dsn " postgres://user:password@localhost:5432/dbname?sslmode=disable"
73+ ```
74+
75+ ### Command line options
76+
77+ | Option | Description | Default |
78+ | ------------- | --------------------------------------------------------------- | ----------------------------------- |
79+ | ` --dsn ` | Database connection string | Required if not set via environment |
80+ | ` --transport ` | Transport mode: ` stdio ` or ` sse ` | ` stdio ` |
81+ | ` --port ` | HTTP server port (only applicable when using ` --transport=sse ` ) | ` 8080 ` |
82+
3883### Claude Desktop
3984
4085![ claude-desktop] ( https://raw.githubusercontent.com/bytebase/dbhub/main/assets/claude-desktop.webp )
@@ -67,45 +112,6 @@ Add to `claude_desktop_config.json`
67112 pnpm install
68113 ```
69114
70- 1 . Configure your database connection:
71-
72- DBHub requires a Database Source Name (DSN) to connect to your database. You can provide this in several ways:
73-
74- - ** Command line argument** (highest priority):
75-
76- ``` bash
77- pnpm dev --dsn " postgres://user:password@localhost:5432/dbname?sslmode=disable"
78- ```
79-
80- - ** Environment variable** (second priority):
81-
82- ` ` ` bash
83- export DSN=" postgres://user:password@localhost:5432/dbname?sslmode=disable"
84- pnpm dev
85- ` ` `
86-
87- - ** Environment file** (third priority):
88- - For development: Create ` .env.local` with your DSN
89- - For production: Create ` .env` with your DSN
90- ```
91- DSN=postgres://user:password@localhost:5432/dbname? sslmode=disable
92- ```
93-
94- 1. Choose a transport mode:
95-
96- DBHub supports two transport modes:
97-
98- - ** stdio** (default) - for direct integration with tools like Claude Desktop
99-
100- ` ` ` bash
101- pnpm dev --transport stdio
102- ` ` `
103-
104- - ** sse** - for browser and network clients
105- ` ` ` bash
106- pnpm dev --transport sse
107- ` ` `
108-
1091151 . Run in development mode:
110116
111117 ``` bash
@@ -130,7 +136,7 @@ TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disa
130136
131137``` bash
132138# Start DBHub with SSE transport
133- pnpm dev --transport=sse
139+ pnpm dev --transport=sse --port=8080
134140
135141# Start the MCP Inspector in another terminal
136142npx @modelcontextprotocol/inspector
0 commit comments