@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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mcpServer.js +20 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-engine-bridge/context-engine-mcp-bridge",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "Context Engine MCP bridge (http/stdio proxy combining indexer + memory servers)",
5
5
  "bin": {
6
6
  "ctxce": "bin/ctxce.js",
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", () => { if (!exceeded) resolve(null); });
157
+ res.on("error", () => settle(null));
157
158
  res.on("data", chunk => {
158
- if (exceeded) return;
159
+ if (settled) return;
159
160
  data += chunk;
160
- if (data.length > MAX_RESP) { exceeded = true; req.destroy(); resolve(null); }
161
+ if (data.length > MAX_RESP) { req.destroy(); settle(null); }
161
162
  });
162
- res.on("end", () => { if (!exceeded) { try { resolve(JSON.parse(data)); } catch { resolve(null); } } });
163
+ res.on("end", () => { if (!settled) { try { settle(JSON.parse(data)); } catch { settle(null); } } });
163
164
  });
164
- req.on("error", () => resolve(null));
165
- req.on("timeout", () => { req.destroy(); resolve(null); });
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) && tool.inputSchema?.properties) {
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" };