@context-engine-bridge/context-engine-mcp-bridge 0.0.42 → 0.0.44
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/package.json +1 -1
- package/src/mcpServer.js +20 -8
package/package.json
CHANGED
package/src/mcpServer.js
CHANGED
|
@@ -138,6 +138,8 @@ function _extractPaths(obj, paths, workspace, depth = 0) {
|
|
|
138
138
|
function _callLspHandler(port, secret, operation, params) {
|
|
139
139
|
const postData = JSON.stringify(params);
|
|
140
140
|
return new Promise((resolve) => {
|
|
141
|
+
let settled = false;
|
|
142
|
+
const settle = (v) => { if (!settled) { settled = true; resolve(v); } };
|
|
141
143
|
const req = http.request({
|
|
142
144
|
hostname: "127.0.0.1",
|
|
143
145
|
port: parseInt(port, 10),
|
|
@@ -151,18 +153,17 @@ function _callLspHandler(port, secret, operation, params) {
|
|
|
151
153
|
timeout: 3000,
|
|
152
154
|
}, (res) => {
|
|
153
155
|
let data = "";
|
|
154
|
-
let exceeded = false;
|
|
155
156
|
const MAX_RESP = 5 * 1024 * 1024;
|
|
156
|
-
res.on("error", () =>
|
|
157
|
+
res.on("error", () => settle(null));
|
|
157
158
|
res.on("data", chunk => {
|
|
158
|
-
if (
|
|
159
|
+
if (settled) return;
|
|
159
160
|
data += chunk;
|
|
160
|
-
if (data.length > MAX_RESP) {
|
|
161
|
+
if (data.length > MAX_RESP) { req.destroy(); settle(null); }
|
|
161
162
|
});
|
|
162
|
-
res.on("end", () => { if (!
|
|
163
|
+
res.on("end", () => { if (!settled) { try { settle(JSON.parse(data)); } catch { settle(null); } } });
|
|
163
164
|
});
|
|
164
|
-
req.on("error", () =>
|
|
165
|
-
req.on("timeout", () => { req.destroy();
|
|
165
|
+
req.on("error", () => settle(null));
|
|
166
|
+
req.on("timeout", () => { req.destroy(); settle(null); });
|
|
166
167
|
req.write(postData);
|
|
167
168
|
req.end();
|
|
168
169
|
});
|
|
@@ -1070,9 +1071,20 @@ async function createBridgeServer(options) {
|
|
|
1070
1071
|
description: "When true, auto-enrich results with live LSP diagnostics (errors/warnings) for files in the response. Zero extra tool calls needed.",
|
|
1071
1072
|
};
|
|
1072
1073
|
for (const tool of tools) {
|
|
1073
|
-
if (_LSP_ENRICHABLE_TOOLS.has(tool.name)
|
|
1074
|
+
if (!_LSP_ENRICHABLE_TOOLS.has(tool.name)) continue;
|
|
1075
|
+
if (tool.inputSchema?.properties) {
|
|
1074
1076
|
tool.inputSchema = { ...tool.inputSchema, properties: { ...tool.inputSchema.properties, include_lsp: lspProp } };
|
|
1075
1077
|
}
|
|
1078
|
+
if (tool.outputSchema) {
|
|
1079
|
+
tool.outputSchema = {
|
|
1080
|
+
...tool.outputSchema,
|
|
1081
|
+
properties: {
|
|
1082
|
+
...(tool.outputSchema.properties || {}),
|
|
1083
|
+
_lsp_status: { type: "string" },
|
|
1084
|
+
_lsp: { type: "object" },
|
|
1085
|
+
},
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1076
1088
|
}
|
|
1077
1089
|
|
|
1078
1090
|
const pathProp = { type: "string", description: "Absolute file path" };
|