db4app-mcp-server 0.1.7 → 0.1.8
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 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14927,14 +14927,21 @@ Troubleshooting:
|
|
|
14927
14927
|
}
|
|
14928
14928
|
throw new Error("Unexpected embedding response format from LM Studio");
|
|
14929
14929
|
}
|
|
14930
|
-
async function executeSql(postgresUrl, sql, params = []) {
|
|
14930
|
+
async function executeSql(postgresUrl, sql, params = [], timeoutMs = 3e4) {
|
|
14931
14931
|
const client = getClient(postgresUrl);
|
|
14932
14932
|
try {
|
|
14933
14933
|
await ensureConnected(client);
|
|
14934
|
-
|
|
14934
|
+
const hasLargeArray = params.some((p) => Array.isArray(p) && p.length > 1e3);
|
|
14935
|
+
const timeout = hasLargeArray ? 6e4 : timeoutMs;
|
|
14936
|
+
console.log("[MCP] Executing SQL:", {
|
|
14937
|
+
postgresUrl: postgresUrl.replace(/:[^:@]+@/, ":****@"),
|
|
14938
|
+
sql: sql.substring(0, 100) + "...",
|
|
14939
|
+
hasLargeArray,
|
|
14940
|
+
timeout: `${timeout}ms`
|
|
14941
|
+
});
|
|
14935
14942
|
const queryPromise = client.query(sql, params);
|
|
14936
14943
|
const timeoutPromise = new Promise(
|
|
14937
|
-
(_, reject) => setTimeout(() => reject(new Error(
|
|
14944
|
+
(_, reject) => setTimeout(() => reject(new Error(`Postgres query timed out after ${timeout / 1e3} seconds`)), timeout)
|
|
14938
14945
|
);
|
|
14939
14946
|
const result = await Promise.race([queryPromise, timeoutPromise]);
|
|
14940
14947
|
return {
|
package/package.json
CHANGED