@context-engine-bridge/context-engine-mcp-bridge 0.0.57 → 0.0.59
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 +23 -3
package/package.json
CHANGED
package/src/mcpServer.js
CHANGED
|
@@ -1257,8 +1257,9 @@ async function createBridgeServer(options) {
|
|
|
1257
1257
|
: [];
|
|
1258
1258
|
const shouldFanOut = additionalCollections.length > 0 && indexerClient;
|
|
1259
1259
|
|
|
1260
|
+
debugLog(`[ctxce] Fan-out check: tool=${name}, inFanoutSet=${_FANOUT_TOOLS.has(name)}, workspace=${workspace}, hint=${fanOutCollectionHint}, additional=[${additionalCollections.join(",")}], shouldFanOut=${shouldFanOut}`);
|
|
1260
1261
|
if (shouldFanOut) {
|
|
1261
|
-
debugLog(`[ctxce] Fan-out: ${name} across ${additionalCollections.length} additional collection(s)`);
|
|
1262
|
+
debugLog(`[ctxce] Fan-out: ${name} across ${additionalCollections.length} additional collection(s): ${additionalCollections.join(", ")}`);
|
|
1262
1263
|
}
|
|
1263
1264
|
|
|
1264
1265
|
const timeoutMs = getBridgeToolTimeoutMs();
|
|
@@ -1766,9 +1767,21 @@ let _sessionCollectionsCache = null;
|
|
|
1766
1767
|
let _sessionCollectionsMtime = 0;
|
|
1767
1768
|
let _sessionCollectionsCacheKey = "";
|
|
1768
1769
|
|
|
1770
|
+
function _collectionRepoName(collection) {
|
|
1771
|
+
if (!collection || typeof collection !== "string") return null;
|
|
1772
|
+
const lastDash = collection.lastIndexOf("-");
|
|
1773
|
+
if (lastDash <= 0) return collection.toLowerCase();
|
|
1774
|
+
const maybeSuffix = collection.slice(lastDash + 1);
|
|
1775
|
+
if (/^[a-f0-9]{6,}$/.test(maybeSuffix)) {
|
|
1776
|
+
return collection.slice(0, lastDash).toLowerCase();
|
|
1777
|
+
}
|
|
1778
|
+
return collection.toLowerCase();
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1769
1781
|
function _findWorkspaceDirByCollection(collection) {
|
|
1770
1782
|
if (!collection) return null;
|
|
1771
1783
|
const wsRoot = path.join(os.homedir(), ".ctxce", "workspaces");
|
|
1784
|
+
const targetName = _collectionRepoName(collection);
|
|
1772
1785
|
try {
|
|
1773
1786
|
const realWsRoot = fs.realpathSync(wsRoot);
|
|
1774
1787
|
const dirs = fs.readdirSync(wsRoot).slice(0, MAX_WS_SCAN);
|
|
@@ -1782,8 +1795,9 @@ function _findWorkspaceDirByCollection(collection) {
|
|
|
1782
1795
|
} catch (_) { continue; }
|
|
1783
1796
|
try {
|
|
1784
1797
|
const cfg = JSON.parse(fs.readFileSync(path.join(realDir, "ctx_config.json"), "utf8"));
|
|
1785
|
-
if (cfg && cfg.default_collection
|
|
1786
|
-
return realDir;
|
|
1798
|
+
if (cfg && cfg.default_collection) {
|
|
1799
|
+
if (cfg.default_collection === collection) return realDir;
|
|
1800
|
+
if (targetName && _collectionRepoName(cfg.default_collection) === targetName) return realDir;
|
|
1787
1801
|
}
|
|
1788
1802
|
} catch (_) {}
|
|
1789
1803
|
}
|
|
@@ -1889,6 +1903,12 @@ function _mergeResults(primaryText, additionalTexts) {
|
|
|
1889
1903
|
}
|
|
1890
1904
|
|
|
1891
1905
|
primary._cross_collection = true;
|
|
1906
|
+
primary._fanout_debug = {
|
|
1907
|
+
additional_texts_count: additionalTexts.length,
|
|
1908
|
+
additional_ok_count: additionalTexts.filter(t => { try { return JSON.parse(t).ok; } catch(_) { return false; } }).length,
|
|
1909
|
+
final_results_count: Array.isArray(primary.results) ? primary.results.length : 0,
|
|
1910
|
+
original_limit: originalLimit || null,
|
|
1911
|
+
};
|
|
1892
1912
|
return JSON.stringify(primary);
|
|
1893
1913
|
} catch (_) {
|
|
1894
1914
|
return primaryText;
|