Skip to content

Commit b563c18

Browse files
committed
feat: add SQLite support
1 parent ea7c841 commit b563c18

File tree

12 files changed

+1139
-51
lines changed

12 files changed

+1139
-51
lines changed

README.md

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<a href="https://dbhub.ai/" target="_blank">
33
<picture>
4-
<img src="https://raw.githubusercontent.com/bytebase/dbhub/main/assets/logo-full.svg" width="50%">
4+
<img src="https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/logo-full.svg" width="50%">
55
</picture>
66
</a>
77
</p>
@@ -14,14 +14,14 @@ DBHub is a universal database gateway implementing the Model Context Protocol (M
1414
| | | | | |
1515
| Claude Desktop +--->+ +--->+ PostgreSQL |
1616
| | | | | |
17-
| Cursor +--->+ DBHub +--->+ MySQL |
17+
| Cursor +--->+ DBHub +--->+ SQL Server |
1818
| | | | | |
1919
| Other MCP +--->+ +--->+ SQLite |
2020
| Clients | | | | |
2121
| | | +--->+ DuckDB |
22-
| | | | | |
22+
| | | | | (soon) |
2323
| | | +--->+ Other Databases |
24-
| | | | | |
24+
| | | | | (coming) |
2525
+------------------+ +--------------+ +------------------+
2626
MCP Clients MCP Server Databases
2727
```
@@ -38,19 +38,33 @@ DBHub is a universal database gateway implementing the Model Context Protocol (M
3838
### Docker
3939

4040
```bash
41+
# PostgreSQL example
4142
docker run --rm --init \
4243
--name dbhub \
4344
--publish 8080:8080 \
4445
bytebase/dbhub \
4546
--transport sse \
4647
--port 8080 \
4748
--dsn "postgres://user:password@localhost:5432/dbname?sslmode=disable"
49+
50+
# SQLite in-memory example
51+
docker run --rm --init \
52+
--name dbhub \
53+
--publish 8080:8080 \
54+
bytebase/dbhub \
55+
--transport sse \
56+
--port 8080 \
57+
--dsn "sqlite::memory:"
4858
```
4959

5060
### NPM
5161

5262
```bash
63+
# PostgreSQL example
5364
npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
65+
66+
# SQLite example
67+
npx @bytebase/dbhub --transport sse --port 8080 --dsn "sqlite:///path/to/database.db"
5468
```
5569

5670
## Usage
@@ -79,6 +93,16 @@ Database Source Name (DSN) is required to connect to your database. You can prov
7993
DSN=postgres://user:password@localhost:5432/dbname?sslmode=disable
8094
```
8195

96+
### Supported DSN formats
97+
98+
DBHub supports the following database connection string formats:
99+
100+
| Database | DSN Format | Example |
101+
|------------|-----------------------------------------------------------|--------------------------------------------------------|
102+
| PostgreSQL | `postgres://[user]:[password]@[host]:[port]/[database]` | `postgres://user:password@localhost:5432/dbname?sslmode=disable` |
103+
| SQLite | `sqlite:///[path/to/file]` or `sqlite::memory:` | `sqlite:///path/to/database.db` or `sqlite::memory:` |
104+
| SQL Server | `sqlserver://[user]:[password]@[host]:[port]/[database]` | `sqlserver://user:password@localhost:1433/dbname` |
105+
82106
### Transport
83107

84108
- **stdio** (default) - for direct integration with tools like Claude Desktop:
@@ -102,17 +126,17 @@ Database Source Name (DSN) is required to connect to your database. You can prov
102126

103127
### Claude Desktop
104128

105-
![claude-desktop](https://raw.githubusercontent.com/bytebase/dbhub/main/assets/claude-desktop.webp)
129+
![claude-desktop](https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/claude-desktop.webp)
106130

107131
- Claude Desktop only supports `stdio` transport https://github.com/orgs/modelcontextprotocol/discussions/16
108132

109133
#### Docker
110134

111135
```json
112-
// claude_desktop_config.json
136+
// claude_desktop_config.json - PostgreSQL example
113137
{
114138
"mcpServers": {
115-
"dbhub": {
139+
"dbhub-postgres": {
116140
"command": "docker",
117141
"args": [
118142
"run",
@@ -130,13 +154,34 @@ Database Source Name (DSN) is required to connect to your database. You can prov
130154
}
131155
```
132156

157+
```json
158+
// claude_desktop_config.json - SQLite example (in-memory)
159+
{
160+
"mcpServers": {
161+
"dbhub-sqlite": {
162+
"command": "docker",
163+
"args": [
164+
"run",
165+
"-i",
166+
"--rm",
167+
"bytebase/dbhub",
168+
"--transport",
169+
"stdio",
170+
"--dsn",
171+
"sqlite::memory:"
172+
]
173+
}
174+
}
175+
}
176+
```
177+
133178
#### NPX
134179

135180
```json
136-
// claude_desktop_config.json
181+
// claude_desktop_config.json - PostgreSQL example
137182
{
138183
"mcpServers": {
139-
"dbhub": {
184+
"dbhub-postgres": {
140185
"command": "npx",
141186
"args": [
142187
"-y",
@@ -151,6 +196,25 @@ Database Source Name (DSN) is required to connect to your database. You can prov
151196
}
152197
```
153198

199+
```json
200+
// claude_desktop_config.json - SQLite example
201+
{
202+
"mcpServers": {
203+
"dbhub-sqlite": {
204+
"command": "npx",
205+
"args": [
206+
"-y",
207+
"@bytebase/dbhub",
208+
"--transport",
209+
"stdio",
210+
"--dsn",
211+
"sqlite:///path/to/database.db"
212+
]
213+
}
214+
}
215+
}
216+
```
217+
154218
## Development
155219

156220
1. Install dependencies:
@@ -176,7 +240,14 @@ Database Source Name (DSN) is required to connect to your database. You can prov
176240
#### stdio
177241

178242
```bash
243+
# PostgreSQL example
179244
TRANSPORT=stdio DSN="postgres://user:password@localhost:5432/dbname?sslmode=disable" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js
245+
246+
# SQLite example
247+
TRANSPORT=stdio DSN="sqlite:///path/to/database.db" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js
248+
249+
# SQLite in-memory example
250+
TRANSPORT=stdio DSN="sqlite::memory:" npx @modelcontextprotocol/inspector node /path/to/dbhub/dist/index.js
180251
```
181252

182253
#### SSE
@@ -191,4 +262,4 @@ npx @modelcontextprotocol/inspector
191262

192263
Connect to the DBHub server `/sse` endpoint
193264

194-
![mcp-inspector](https://raw.githubusercontent.com/bytebase/dbhub/main/assets/mcp-inspector.webp)
265+
![mcp-inspector](https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/mcp-inspector.webp)

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323
"license": "MIT",
2424
"dependencies": {
2525
"@modelcontextprotocol/sdk": "^1.6.1",
26+
"@types/sqlite3": "^5.1.0",
2627
"dotenv": "^16.4.7",
2728
"express": "^4.18.2",
2829
"mssql": "^11.0.1",
2930
"pg": "^8.13.3",
31+
"sqlite3": "^5.1.7",
3032
"zod": "^3.24.2"
3133
},
3234
"devDependencies": {

0 commit comments

Comments
 (0)