@bytebase/dbhub 0.0.3 → 0.0.5
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 +27 -12
- package/dist/tools/index.js +2 -2
- package/dist/tools/list-connectors.js +1 -1
- package/dist/tools/run-query.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,17 +50,7 @@ docker run --rm --init \
|
|
|
50
50
|
### NPM
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
54
|
-
npm install -g @bytebase/dbhub
|
|
55
|
-
|
|
56
|
-
# Or install development version
|
|
57
|
-
npm install -g @bytebase/dbhub@dev
|
|
58
|
-
|
|
59
|
-
# Run from anywhere
|
|
60
|
-
dbhub --dsn="postgres://user:password@localhost:5432/dbname"
|
|
61
|
-
|
|
62
|
-
# Run via npx
|
|
63
|
-
npx @bytebase/dbhub --dsn="postgres://user:password@localhost:5432/dbname"
|
|
53
|
+
npx @bytebase/dbhub --transport sse --port 8080 --dsn "postgres://user:password@localhost:5432/dbname"
|
|
64
54
|
```
|
|
65
55
|
|
|
66
56
|
## Usage
|
|
@@ -114,9 +104,12 @@ Database Source Name (DSN) is required to connect to your database. You can prov
|
|
|
114
104
|
|
|
115
105
|

|
|
116
106
|
|
|
117
|
-
|
|
107
|
+
- Claude Desktop only supports `stdio` transport https://github.com/orgs/modelcontextprotocol/discussions/16
|
|
108
|
+
|
|
109
|
+
#### Docker
|
|
118
110
|
|
|
119
111
|
```json
|
|
112
|
+
// claude_desktop_config.json
|
|
120
113
|
{
|
|
121
114
|
"mcpServers": {
|
|
122
115
|
"dbhub": {
|
|
@@ -129,6 +122,7 @@ Add to `claude_desktop_config.json`
|
|
|
129
122
|
"--transport",
|
|
130
123
|
"stdio",
|
|
131
124
|
"--dsn",
|
|
125
|
+
// Use host.docker.internal as the host if connecting to the local db
|
|
132
126
|
"postgres://user:password@host.docker.internal:5432/dbname?sslmode=disable"
|
|
133
127
|
]
|
|
134
128
|
}
|
|
@@ -136,6 +130,27 @@ Add to `claude_desktop_config.json`
|
|
|
136
130
|
}
|
|
137
131
|
```
|
|
138
132
|
|
|
133
|
+
#### NPX
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
// claude_desktop_config.json
|
|
137
|
+
{
|
|
138
|
+
"mcpServers": {
|
|
139
|
+
"dbhub": {
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": [
|
|
142
|
+
"-y",
|
|
143
|
+
"@bytebase/dbhub",
|
|
144
|
+
"--transport",
|
|
145
|
+
"stdio",
|
|
146
|
+
"--dsn",
|
|
147
|
+
"postgres://user:password@localhost:5432/dbname?sslmode=disable"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
139
154
|
## Development
|
|
140
155
|
|
|
141
156
|
1. Install dependencies:
|
package/dist/tools/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { listConnectorsToolHandler } from './list-connectors.js';
|
|
|
5
5
|
*/
|
|
6
6
|
export function registerTools(server) {
|
|
7
7
|
// Tool to run a SQL query (read-only for safety)
|
|
8
|
-
server.tool("
|
|
8
|
+
server.tool("run_query", runQuerySchema, runQueryToolHandler);
|
|
9
9
|
// Tool to list available database connectors
|
|
10
|
-
server.tool("
|
|
10
|
+
server.tool("list_connectors", {}, listConnectorsToolHandler);
|
|
11
11
|
}
|
|
@@ -2,7 +2,7 @@ import { ConnectorManager } from '../connectors/manager.js';
|
|
|
2
2
|
import { ConnectorRegistry } from '../connectors/interface.js';
|
|
3
3
|
import { createToolSuccessResponse } from '../utils/response-formatter.js';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* list_connectors tool handler
|
|
6
6
|
* Lists all available database connectors and their sample DSNs
|
|
7
7
|
*/
|
|
8
8
|
export async function listConnectorsToolHandler(_args, _extra) {
|
package/dist/tools/run-query.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ConnectorManager } from '../connectors/manager.js';
|
|
3
3
|
import { createToolSuccessResponse, createToolErrorResponse } from '../utils/response-formatter.js';
|
|
4
|
-
// Schema for
|
|
4
|
+
// Schema for run_query tool
|
|
5
5
|
export const runQuerySchema = {
|
|
6
6
|
query: z.string().describe("SQL query to execute (SELECT only)")
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* run_query tool handler
|
|
10
10
|
* Executes a SQL query and returns the results
|
|
11
11
|
*/
|
|
12
12
|
export async function runQueryToolHandler({ query }, _extra) {
|