@bytebase/dbhub 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +34 -33
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.js +1489 -13
  4. package/dist/resources/employee-sqlite/employee.sql +117 -0
  5. package/dist/resources/employee-sqlite/load_department.sql +10 -0
  6. package/dist/resources/employee-sqlite/load_dept_emp.sql +1103 -0
  7. package/dist/resources/employee-sqlite/load_dept_manager.sql +17 -0
  8. package/dist/resources/employee-sqlite/load_employee.sql +1000 -0
  9. package/dist/resources/employee-sqlite/load_salary1.sql +9488 -0
  10. package/dist/resources/employee-sqlite/load_title.sql +1470 -0
  11. package/dist/resources/employee-sqlite/object.sql +74 -0
  12. package/dist/resources/employee-sqlite/show_elapsed.sql +4 -0
  13. package/dist/resources/employee-sqlite/test_employee_md5.sql +119 -0
  14. package/package.json +5 -4
  15. package/dist/config/demo-loader.js +0 -45
  16. package/dist/config/env.js +0 -146
  17. package/dist/connectors/interface.js +0 -55
  18. package/dist/connectors/manager.js +0 -91
  19. package/dist/connectors/mysql/index.js +0 -169
  20. package/dist/connectors/postgres/index.js +0 -172
  21. package/dist/connectors/sqlite/index.js +0 -208
  22. package/dist/connectors/sqlserver/index.js +0 -186
  23. package/dist/prompts/db-explainer.js +0 -201
  24. package/dist/prompts/index.js +0 -11
  25. package/dist/prompts/sql-generator.js +0 -114
  26. package/dist/resources/index.js +0 -12
  27. package/dist/resources/schema.js +0 -36
  28. package/dist/resources/tables.js +0 -17
  29. package/dist/server.js +0 -140
  30. package/dist/tools/index.js +0 -11
  31. package/dist/tools/list-connectors.js +0 -43
  32. package/dist/tools/run-query.js +0 -32
  33. package/dist/utils/response-formatter.js +0 -109
package/README.md CHANGED
@@ -26,28 +26,34 @@ DBHub is a universal database gateway implementing the Model Context Protocol (M
26
26
  MCP Clients MCP Server Databases
27
27
  ```
28
28
 
29
+ ## Demo SSE Endpoint
30
+
31
+ https://demo.dbhub.ai/sse connects a [sample employee database](https://github.com/bytebase/employee-sample-database). You can point Cursor or MCP Inspector to it to see it in action.
32
+
33
+ ![mcp-inspector](https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/mcp-inspector.webp)
34
+
29
35
  ## Supported Matrix
30
36
 
31
37
  ### Database Resources
32
38
 
33
- | Resource | URI Format | PostgreSQL | MySQL | SQL Server | SQLite |
34
- |------------------------|:----------:|:----------:|:-----:|:----------:|:------:|
35
- | Tables | `db://tables` | ✅ | | ✅ | ✅ |
36
- | Schema | `db://schema/{tableName}` | ✅ | | ✅ | ✅ |
39
+ | Resource | URI Format | PostgreSQL | MySQL | SQL Server | SQLite |
40
+ | -------- | :-----------------------: | :--------: | :---: | :--------: | :----: |
41
+ | Tables | `db://tables` | ✅ | | ✅ | ✅ |
42
+ | Schema | `db://schema/{tableName}` | ✅ | | ✅ | ✅ |
37
43
 
38
44
  ### Database Tools
39
45
 
40
- | Tool | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
41
- |------------------------|:------------------:|:----------:|:-----:|:----------:|:------:|
42
- | Execute Query | `run_query` | ✅ | | ✅ | ✅ |
43
- | List Connectors | `list_connectors` | ✅ | | ✅ | ✅ |
46
+ | Tool | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
47
+ | --------------- | :---------------: | :--------: | :---: | :--------: | :----: |
48
+ | Execute Query | `run_query` | ✅ | | ✅ | ✅ |
49
+ | List Connectors | `list_connectors` | ✅ | | ✅ | ✅ |
44
50
 
45
51
  ### Prompt Capabilities
46
52
 
47
- | Prompt | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
48
- |------------------------|:----------------:|:----------:|:-----:|:----------:|:------:|
49
- | Generate SQL | `generate_sql` | ✅ | | ✅ | ✅ |
50
- | Explain DB Elements | `explain_db` | ✅ | | ✅ | ✅ |
53
+ | Prompt | Command Name | PostgreSQL | MySQL | SQL Server | SQLite |
54
+ | ------------------- | :------------: | :--------: | :---: | :--------: | :----: |
55
+ | Generate SQL | `generate_sql` | ✅ | | ✅ | ✅ |
56
+ | Explain DB Elements | `explain_db` | ✅ | | ✅ | ✅ |
51
57
 
52
58
  ## Installation
53
59
 
@@ -87,6 +93,8 @@ npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@
87
93
  npx @bytebase/dbhub --transport sse --port 8080 --demo
88
94
  ```
89
95
 
96
+ > Note: The demo mode includes a bundled SQLite sample "employee" database with tables for employees, departments, salaries, and more.
97
+
90
98
  ### Claude Desktop
91
99
 
92
100
  ![claude-desktop](https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/claude-desktop.webp)
@@ -124,13 +132,7 @@ npx @bytebase/dbhub --transport sse --port 8080 --demo
124
132
  },
125
133
  "dbhub-demo": {
126
134
  "command": "npx",
127
- "args": [
128
- "-y",
129
- "@bytebase/dbhub",
130
- "--transport",
131
- "stdio",
132
- "--demo"
133
- ]
135
+ "args": ["-y", "@bytebase/dbhub", "--transport", "stdio", "--demo"]
134
136
  }
135
137
  }
136
138
  }
@@ -177,12 +179,12 @@ For real databases, a Database Source Name (DSN) is required. You can provide th
177
179
 
178
180
  DBHub supports the following database connection string formats:
179
181
 
180
- | Database | DSN Format | Example |
181
- |------------|-----------------------------------------------------------|--------------------------------------------------------|
182
- | PostgreSQL | `postgres://[user]:[password]@[host]:[port]/[database]` | `postgres://user:password@localhost:5432/dbname?sslmode=disable` |
183
- | SQLite | `sqlite:///[path/to/file]` or `sqlite::memory:` | `sqlite:///path/to/database.db` or `sqlite::memory:` |
184
- | SQL Server | `sqlserver://[user]:[password]@[host]:[port]/[database]` | `sqlserver://user:password@localhost:1433/dbname` |
185
- | MySQL | `mysql://[user]:[password]@[host]:[port]/[database]` | `mysql://user:password@localhost:3306/dbname` |
182
+ | Database | DSN Format | Example |
183
+ | ---------- | -------------------------------------------------------- | ---------------------------------------------------------------- |
184
+ | PostgreSQL | `postgres://[user]:[password]@[host]:[port]/[database]` | `postgres://user:password@localhost:5432/dbname?sslmode=disable` |
185
+ | SQLite | `sqlite:///[path/to/file]` or `sqlite::memory:` | `sqlite:///path/to/database.db` or `sqlite::memory:` |
186
+ | SQL Server | `sqlserver://[user]:[password]@[host]:[port]/[database]` | `sqlserver://user:password@localhost:1433/dbname` |
187
+ | MySQL | `mysql://[user]:[password]@[host]:[port]/[database]` | `mysql://user:password@localhost:3306/dbname` |
186
188
 
187
189
  ### Transport
188
190
 
@@ -199,13 +201,14 @@ DBHub supports the following database connection string formats:
199
201
 
200
202
  ### Command line options
201
203
 
202
- | Option | Description | Default |
203
- | :-------- | :-------------------------------------------------------------- | :---------------------------------- |
204
- | demo | Run in demo mode with sample employee database | `false` |
205
- | dsn | Database connection string | Required if not in demo mode |
206
- | transport | Transport mode: `stdio` or `sse` | `stdio` |
207
- | port | HTTP server port (only applicable when using `--transport=sse`) | `8080` |
204
+ | Option | Description | Default |
205
+ | :-------- | :-------------------------------------------------------------- | :--------------------------- |
206
+ | demo | Run in demo mode with sample employee database | `false` |
207
+ | dsn | Database connection string | Required if not in demo mode |
208
+ | transport | Transport mode: `stdio` or `sse` | `stdio` |
209
+ | port | HTTP server port (only applicable when using `--transport=sse`) | `8080` |
208
210
 
211
+ The demo mode uses an in-memory SQLite database loaded with the [sample employee database](https://github.com/bytebase/dbhub/tree/main/resources/employee-sqlite) that includes tables for employees, departments, titles, and salaries.
209
212
 
210
213
  ## Development
211
214
 
@@ -247,5 +250,3 @@ npx @modelcontextprotocol/inspector
247
250
  ```
248
251
 
249
252
  Connect to the DBHub server `/sse` endpoint
250
-
251
- ![mcp-inspector](https://raw.githubusercontent.com/bytebase/dbhub/main/resources/images/mcp-inspector.webp)
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node