@context-engine-bridge/context-engine-mcp-bridge 0.0.22 → 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 +1 -1
- package/src/mcpServer.js +3 -0
- package/src/resultPathMapping.js +28 -8
package/package.json
CHANGED
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
|
|
package/src/resultPathMapping.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
295
|
-
//
|
|
296
|
-
//
|
|
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
|
-
|
|
302
|
-
|
|
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") ||
|