@dbx-app/mcp-server 0.2.0 → 0.2.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.
- package/dist/index.js +10 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ function mdTable(headers, rows) {
|
|
|
36
36
|
}
|
|
37
37
|
const server = new McpServer({
|
|
38
38
|
name: "dbx",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.1",
|
|
40
40
|
});
|
|
41
41
|
server.tool("dbx_list_connections", "List all database connections configured in DBX", {}, async () => {
|
|
42
42
|
const connections = await backend.loadConnections();
|
|
@@ -114,6 +114,7 @@ server.tool("dbx_add_connection", "Add a new database connection to DBX", {
|
|
|
114
114
|
name, db_type, host, port, username, password,
|
|
115
115
|
database, ssl, ssh_enabled: false,
|
|
116
116
|
});
|
|
117
|
+
await notifyReload();
|
|
117
118
|
return text(`Connection "${config.name}" added (id: ${config.id}).`);
|
|
118
119
|
});
|
|
119
120
|
server.tool("dbx_remove_connection", "Remove a database connection from DBX", {
|
|
@@ -122,6 +123,7 @@ server.tool("dbx_remove_connection", "Remove a database connection from DBX", {
|
|
|
122
123
|
const removed = await backend.removeConnection(connection_name);
|
|
123
124
|
if (!removed)
|
|
124
125
|
return text(`Connection "${connection_name}" not found.`);
|
|
126
|
+
await notifyReload();
|
|
125
127
|
return text(`Connection "${connection_name}" removed.`);
|
|
126
128
|
});
|
|
127
129
|
function formatCell(value) {
|
|
@@ -147,6 +149,13 @@ async function getBridgeUrl() {
|
|
|
147
149
|
const port = (await readFile(portFile, "utf-8")).trim();
|
|
148
150
|
return `http://127.0.0.1:${port}`;
|
|
149
151
|
}
|
|
152
|
+
async function notifyReload() {
|
|
153
|
+
try {
|
|
154
|
+
const bridgeUrl = await getBridgeUrl();
|
|
155
|
+
await fetch(`${bridgeUrl}/reload-connections`, { method: "POST" });
|
|
156
|
+
}
|
|
157
|
+
catch { }
|
|
158
|
+
}
|
|
150
159
|
// Desktop-only tools: open table and execute-and-show require the Tauri bridge
|
|
151
160
|
if (!isWebMode) {
|
|
152
161
|
server.tool("dbx_open_table", "Open a table in DBX desktop app UI. Requires DBX to be running.", {
|
package/package.json
CHANGED