db4app-mcp-server 0.1.4 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +6 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14915,8 +14915,7 @@ async function fetchPublicKey(relayUrl, connectionId) {
14915
14915
  if (!effectiveConnectionId) {
14916
14916
  throw new Error("Connection ID is required to fetch public key. Include it in MCP_RELAY_HTTP_URL as /{connectionId}/query or set MCP_CONNECTION_ID");
14917
14917
  }
14918
- const basePath = relayUrlObj.pathname.replace(/\/.*$/, "") || "";
14919
- relayUrlObj.pathname = `${basePath}/${effectiveConnectionId}/public-key`;
14918
+ relayUrlObj.pathname = `/${effectiveConnectionId}/public-key`;
14920
14919
  const publicKeyUrl = relayUrlObj.toString();
14921
14920
  const response = await fetch(publicKeyUrl);
14922
14921
  if (!response.ok) {
@@ -14966,8 +14965,7 @@ async function executeSql(relayUrl, sql, params, allowedTables, connectionId) {
14966
14965
  "Connection ID is required. Either include it in MCP_RELAY_HTTP_URL as /{connectionId}/query, or set MCP_CONNECTION_ID environment variable, or pass connectionId in the tool call."
14967
14966
  );
14968
14967
  }
14969
- const basePath = relayUrlObj.pathname.replace(/\/.*$/, "") || "";
14970
- relayUrlObj.pathname = `${basePath}/${effectiveConnectionId}/query`;
14968
+ relayUrlObj.pathname = `/${effectiveConnectionId}/query`;
14971
14969
  queryUrl = relayUrlObj.toString();
14972
14970
  }
14973
14971
  let requestBody;
@@ -14996,6 +14994,7 @@ async function executeSql(relayUrl, sql, params, allowedTables, connectionId) {
14996
14994
  requestBody.allowedTables = allowedTables;
14997
14995
  }
14998
14996
  }
14997
+ console.log("[MCP] Executing SQL:", { queryUrl, effectiveConnectionId, sql: sql.substring(0, 100) + "..." });
14999
14998
  const response = await fetch(queryUrl, {
15000
14999
  method: "POST",
15001
15000
  headers: { "content-type": "application/json" },
@@ -15003,7 +15002,9 @@ async function executeSql(relayUrl, sql, params, allowedTables, connectionId) {
15003
15002
  });
15004
15003
  if (!response.ok) {
15005
15004
  const errorData = await response.json().catch(() => ({}));
15006
- throw new Error(errorData.error ?? `Relay request failed (${response.status})`);
15005
+ const errorMessage = errorData.error ?? `Relay request failed (${response.status})`;
15006
+ console.error("[MCP] Relay error:", { status: response.status, statusText: response.statusText, error: errorMessage, url: queryUrl });
15007
+ throw new Error(errorMessage);
15007
15008
  }
15008
15009
  const payload = await response.json();
15009
15010
  if (!payload.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "db4app-mcp-server",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "MCP server for db4.app - enables LLMs to interact with browser-based Postgres databases via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",