@context-engine-bridge/context-engine-mcp-bridge 0.0.56 → 0.0.58
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 +17 -3
package/package.json
CHANGED
package/src/mcpServer.js
CHANGED
|
@@ -1251,8 +1251,9 @@ async function createBridgeServer(options) {
|
|
|
1251
1251
|
|
|
1252
1252
|
const primaryCollection = args && typeof args.collection === "string" ? args.collection : "";
|
|
1253
1253
|
const primaryLower = primaryCollection.toLowerCase();
|
|
1254
|
+
const fanOutCollectionHint = defaultCollection || primaryCollection || null;
|
|
1254
1255
|
const additionalCollections = _FANOUT_TOOLS.has(name)
|
|
1255
|
-
? _loadSessionCollections(workspace,
|
|
1256
|
+
? _loadSessionCollections(workspace, fanOutCollectionHint).filter(c => c.toLowerCase() !== primaryLower).slice(0, MAX_FANOUT_COLLECTIONS)
|
|
1256
1257
|
: [];
|
|
1257
1258
|
const shouldFanOut = additionalCollections.length > 0 && indexerClient;
|
|
1258
1259
|
|
|
@@ -1765,9 +1766,21 @@ let _sessionCollectionsCache = null;
|
|
|
1765
1766
|
let _sessionCollectionsMtime = 0;
|
|
1766
1767
|
let _sessionCollectionsCacheKey = "";
|
|
1767
1768
|
|
|
1769
|
+
function _collectionRepoName(collection) {
|
|
1770
|
+
if (!collection || typeof collection !== "string") return null;
|
|
1771
|
+
const lastDash = collection.lastIndexOf("-");
|
|
1772
|
+
if (lastDash <= 0) return collection.toLowerCase();
|
|
1773
|
+
const maybeSuffix = collection.slice(lastDash + 1);
|
|
1774
|
+
if (/^[a-f0-9]{6,}$/.test(maybeSuffix)) {
|
|
1775
|
+
return collection.slice(0, lastDash).toLowerCase();
|
|
1776
|
+
}
|
|
1777
|
+
return collection.toLowerCase();
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1768
1780
|
function _findWorkspaceDirByCollection(collection) {
|
|
1769
1781
|
if (!collection) return null;
|
|
1770
1782
|
const wsRoot = path.join(os.homedir(), ".ctxce", "workspaces");
|
|
1783
|
+
const targetName = _collectionRepoName(collection);
|
|
1771
1784
|
try {
|
|
1772
1785
|
const realWsRoot = fs.realpathSync(wsRoot);
|
|
1773
1786
|
const dirs = fs.readdirSync(wsRoot).slice(0, MAX_WS_SCAN);
|
|
@@ -1781,8 +1794,9 @@ function _findWorkspaceDirByCollection(collection) {
|
|
|
1781
1794
|
} catch (_) { continue; }
|
|
1782
1795
|
try {
|
|
1783
1796
|
const cfg = JSON.parse(fs.readFileSync(path.join(realDir, "ctx_config.json"), "utf8"));
|
|
1784
|
-
if (cfg && cfg.default_collection
|
|
1785
|
-
return realDir;
|
|
1797
|
+
if (cfg && cfg.default_collection) {
|
|
1798
|
+
if (cfg.default_collection === collection) return realDir;
|
|
1799
|
+
if (targetName && _collectionRepoName(cfg.default_collection) === targetName) return realDir;
|
|
1786
1800
|
}
|
|
1787
1801
|
} catch (_) {}
|
|
1788
1802
|
}
|