@context-engine-bridge/context-engine-mcp-bridge 0.0.21 → 0.0.23

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-engine-bridge/context-engine-mcp-bridge",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
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
@@ -795,6 +795,9 @@ async function createBridgeServer(options) {
795
795
  if (!Object.prototype.hasOwnProperty.call(obj, "session")) {
796
796
  obj.session = sessionId;
797
797
  }
798
+ if (defaultsPayload.collection && !Object.prototype.hasOwnProperty.call(obj, "collection")) {
799
+ obj.collection = defaultsPayload.collection;
800
+ }
798
801
  args = obj;
799
802
  }
800
803
 
@@ -1172,6 +1175,13 @@ export async function runHttpMcpServer(options) {
1172
1175
  return;
1173
1176
  }
1174
1177
 
1178
+ // Health check endpoint (used by VS Code extension health ping)
1179
+ if (parsedUrl.pathname === "/health") {
1180
+ res.writeHead(200, { "Content-Type": "application/json" });
1181
+ res.end(JSON.stringify({ status: "ok", sessions: sessions.size }));
1182
+ return;
1183
+ }
1184
+
1175
1185
  // 404 for everything else
1176
1186
  res.statusCode = 404;
1177
1187
  res.setHeader("Content-Type", "application/json");
@@ -226,7 +226,6 @@ function remapRelatedPathToClient(p, workspaceRoot) {
226
226
  return path.join(root, relNative);
227
227
  }
228
228
 
229
- // If it's already a relative path, join it to the workspace root.
230
229
  if (!s.startsWith("/") && !s.includes(":") && !s.includes("\\")) {
231
230
  const relPosix = s.trim();
232
231
  if (relPosix && relPosix !== "." && !relPosix.startsWith("../") && relPosix !== "..") {
@@ -234,7 +233,13 @@ function remapRelatedPathToClient(p, workspaceRoot) {
234
233
  const joined = path.join(root, relNative);
235
234
  const relCheck = path.relative(root, joined);
236
235
  if (relCheck && !relCheck.startsWith(`..${path.sep}`) && relCheck !== "..") {
237
- return joined;
236
+ try {
237
+ if (fs.existsSync(joined)) {
238
+ return joined;
239
+ }
240
+ } catch {
241
+ // ignore
242
+ }
238
243
  }
239
244
  }
240
245
  }
@@ -291,27 +296,37 @@ function remapHitPaths(hit, workspaceRoot) {
291
296
  out.client_path_source = "workspace_join";
292
297
  }
293
298
  } else {
294
- // Prefer a host_path that is within the current bridge workspace.
295
- // This keeps provenance (host_path) intact while providing a user-local
296
- // absolute path even when the bridge workspace is a parent directory.
299
+ // Prefer host_path if it is an absolute path that exists on disk,
300
+ // regardless of whether it falls under workspaceRoot. This handles
301
+ // the common case where the bridge workspace (cwd) differs from the
302
+ // actual repo location (e.g. workspace=/home/user but files live at
303
+ // /media/datadrive/project/).
297
304
  const hp = typeof hostPath === "string" ? hostPath : "";
298
305
  const hpNorm = hp ? hp.replace(/\\/g, path.sep) : "";
299
306
  if (
300
307
  hpNorm &&
301
- hpNorm.startsWith(workspaceRoot) &&
302
- (!fs.existsSync(candidate) || fs.existsSync(hpNorm))
308
+ path.isAbsolute(hpNorm) &&
309
+ fs.existsSync(hpNorm)
303
310
  ) {
304
311
  out.client_path = hpNorm;
305
312
  if (diagnostics) {
306
313
  out.client_path_joined = candidate;
307
314
  out.client_path_source = "host_path";
308
315
  }
309
- } else {
316
+ } else if (fs.existsSync(candidate)) {
310
317
  out.client_path = candidate;
311
318
  if (diagnostics) {
312
319
  out.client_path_joined = candidate;
313
320
  out.client_path_source = "workspace_join";
314
321
  }
322
+ } else {
323
+ // Neither host_path nor the joined candidate exist on disk.
324
+ // Do NOT produce a wrong absolute path; leave client_path unset
325
+ // so the override logic below falls back to the relative path.
326
+ if (diagnostics) {
327
+ out.client_path_joined = candidate;
328
+ out.client_path_source = "fallback_relative";
329
+ }
315
330
  }
316
331
  }
317
332
  } catch {
@@ -448,8 +463,13 @@ export function maybeRemapToolResult(name, result, workspaceRoot) {
448
463
  const lower = String(name).toLowerCase();
449
464
  const shouldMap = (
450
465
  lower === "repo_search" ||
466
+ lower === "code_search" ||
451
467
  lower === "context_search" ||
452
468
  lower === "context_answer" ||
469
+ lower === "info_request" ||
470
+ lower === "symbol_graph" ||
471
+ lower === "pattern_search" ||
472
+ lower === "cross_repo_search" ||
453
473
  lower.endsWith("search_tests_for") ||
454
474
  lower.endsWith("search_config_for") ||
455
475
  lower.endsWith("search_callers_for") ||