@bytebase/dbhub 0.6.2 → 0.7.0
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.
- package/README.md +12 -10
- package/dist/index.js +0 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://cursor.com/install-mcp?name=dbhub
|
|
10
|
+
<a href="https://cursor.com/install-mcp?name=dbhub&config=eyJjb21tYW5kIjoibnB4IEBieXRlYmFzZS9kYmh1YiIsImVudiI6eyJUUkFOU1BPUlQiOiJzdGRpbyIsIkRTTiI6InBvc3RncmVzOi8vdXNlcjpwYXNzd29yZEBsb2NhbGhvc3Q6NTQzMi9kYm5hbWU%2Fc3NsbW9kZT1kaXNhYmxlIiwiUkVBRE9OTFkiOiJ0cnVlIn19"><img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Add dbhub MCP server to Cursor" height="32" /></a>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
DBHub is a universal database gateway implementing the Model Context Protocol (MCP) server interface. This gateway allows MCP-compatible clients to connect to and explore different databases.
|
|
@@ -56,7 +56,6 @@ https://demo.dbhub.ai/message connects a [sample employee database](https://gith
|
|
|
56
56
|
| Tool | Command Name | Description | PostgreSQL | MySQL | MariaDB | SQL Server | SQLite | Oracle |
|
|
57
57
|
| --------------- | ----------------- | ------------------------------------------------------------------- | :--------: | :---: | :-----: | :--------: | ------ | :----: |
|
|
58
58
|
| Execute SQL | `execute_sql` | Execute single or multiple SQL statements (separated by semicolons) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
59
|
-
| List Connectors | `list_connectors` | List all available database connectors | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
60
59
|
|
|
61
60
|
### Prompt Capabilities
|
|
62
61
|
|
|
@@ -172,7 +171,7 @@ npx @bytebase/dbhub --transport http --port 8080 --demo
|
|
|
172
171
|
|
|
173
172
|
### Cursor
|
|
174
173
|
|
|
175
|
-
[](https://cursor.com/install-mcp?name=dbhub
|
|
174
|
+
[](https://cursor.com/install-mcp?name=dbhub&config=eyJjb21tYW5kIjoibnB4IEBieXRlYmFzZS9kYmh1YiIsImVudiI6eyJUUkFOU1BPUlQiOiJzdGRpbyIsIkRTTiI6InBvc3RncmVzOi8vdXNlcjpwYXNzd29yZEBsb2NhbGhvc3Q6NTQzMi9kYm5hbWU%2Fc3NsbW9kZT1kaXNhYmxlIiwiUkVBRE9OTFkiOiJ0cnVlIn19)
|
|
176
175
|
|
|
177
176
|

|
|
178
177
|
|
|
@@ -235,6 +234,9 @@ You can use DBHub in demo mode with a sample employee database for testing:
|
|
|
235
234
|
npx @bytebase/dbhub --demo
|
|
236
235
|
```
|
|
237
236
|
|
|
237
|
+
> [!WARNING]
|
|
238
|
+
If your user/password contains special characters, you need to escape them first. (e.g. `pass#word` should be escaped as `pass%23word`)
|
|
239
|
+
|
|
238
240
|
For real databases, a Database Source Name (DSN) is required. You can provide this in several ways:
|
|
239
241
|
|
|
240
242
|
- **Command line argument** (highest priority):
|
|
@@ -315,13 +317,13 @@ Extra query parameters:
|
|
|
315
317
|
|
|
316
318
|
### Command line options
|
|
317
319
|
|
|
318
|
-
| Option | Description | Default |
|
|
319
|
-
| --------- | --------------------------------------------------------------- | ---------------------------- |
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
324
|
-
|
|
|
320
|
+
| Option | Environment Variable | Description | Default |
|
|
321
|
+
| --------- | -------------------- | --------------------------------------------------------------- | ---------------------------- |
|
|
322
|
+
| dsn | `DSN` | Database connection string | Required if not in demo mode |
|
|
323
|
+
| transport | `TRANSPORT` | Transport mode: `stdio` or `http` | `stdio` |
|
|
324
|
+
| port | `PORT` | HTTP server port (only applicable when using `--transport=http`) | `8080` |
|
|
325
|
+
| readonly | `READONLY` | Restrict SQL execution to read-only operations | `false` |
|
|
326
|
+
| demo | N/A | Run in demo mode with sample employee database | `false` |
|
|
325
327
|
|
|
326
328
|
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, salaries, department employees, and department managers. The sample database includes SQL scripts for table creation, data loading, and testing.
|
|
327
329
|
|
package/dist/index.js
CHANGED
|
@@ -2939,34 +2939,6 @@ async function executeSqlToolHandler({ sql: sql2 }, _extra) {
|
|
|
2939
2939
|
}
|
|
2940
2940
|
}
|
|
2941
2941
|
|
|
2942
|
-
// src/tools/list-connectors.ts
|
|
2943
|
-
async function listConnectorsToolHandler(_args, _extra) {
|
|
2944
|
-
const samples = ConnectorRegistry.getAllSampleDSNs();
|
|
2945
|
-
let activeConnectorType = null;
|
|
2946
|
-
try {
|
|
2947
|
-
const activeConnector = ConnectorManager.getCurrentConnector();
|
|
2948
|
-
activeConnectorType = activeConnector.id;
|
|
2949
|
-
} catch (error) {
|
|
2950
|
-
}
|
|
2951
|
-
const isDemo = isDemoMode();
|
|
2952
|
-
if (isDemo && !activeConnectorType) {
|
|
2953
|
-
activeConnectorType = "sqlite";
|
|
2954
|
-
}
|
|
2955
|
-
const sampleObjects = Object.entries(samples).map(([id, dsn]) => ({
|
|
2956
|
-
id,
|
|
2957
|
-
dsn,
|
|
2958
|
-
active: id === activeConnectorType
|
|
2959
|
-
}));
|
|
2960
|
-
const responseData = {
|
|
2961
|
-
connectors: sampleObjects,
|
|
2962
|
-
count: sampleObjects.length,
|
|
2963
|
-
activeConnector: activeConnectorType,
|
|
2964
|
-
demoMode: isDemo,
|
|
2965
|
-
readonlyMode: isReadOnlyMode()
|
|
2966
|
-
};
|
|
2967
|
-
return createToolSuccessResponse(responseData);
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
2942
|
// src/tools/index.ts
|
|
2971
2943
|
function registerTools(server) {
|
|
2972
2944
|
server.tool(
|
|
@@ -2975,12 +2947,6 @@ function registerTools(server) {
|
|
|
2975
2947
|
executeSqlSchema,
|
|
2976
2948
|
executeSqlToolHandler
|
|
2977
2949
|
);
|
|
2978
|
-
server.tool(
|
|
2979
|
-
"list_connectors",
|
|
2980
|
-
"List all available database connectors",
|
|
2981
|
-
{},
|
|
2982
|
-
listConnectorsToolHandler
|
|
2983
|
-
);
|
|
2984
2950
|
}
|
|
2985
2951
|
|
|
2986
2952
|
// src/prompts/sql-generator.ts
|