@context-engine-bridge/context-engine-mcp-bridge 0.0.35 → 0.0.36
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 +13 -6
package/package.json
CHANGED
package/src/mcpServer.js
CHANGED
|
@@ -171,6 +171,11 @@ function _callLspHandler(port, secret, operation, params) {
|
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
function _lspTarget(parsed) {
|
|
175
|
+
const r = parsed.result;
|
|
176
|
+
return r && typeof r === "object" && !Array.isArray(r) ? r : parsed;
|
|
177
|
+
}
|
|
178
|
+
|
|
174
179
|
async function _enrichWithLsp(result, lspConn, workspace) {
|
|
175
180
|
try {
|
|
176
181
|
debugLog("[ctxce] LSP enrich: workspace=" + workspace + " port=" + lspConn?.port);
|
|
@@ -183,7 +188,8 @@ async function _enrichWithLsp(result, lspConn, workspace) {
|
|
|
183
188
|
return result;
|
|
184
189
|
}
|
|
185
190
|
if (!parsed.ok) return result;
|
|
186
|
-
|
|
191
|
+
const target = _lspTarget(parsed);
|
|
192
|
+
target._lsp_status = await _resolveLspStatus(target, lspConn, workspace);
|
|
187
193
|
textBlock.text = JSON.stringify(parsed);
|
|
188
194
|
return result;
|
|
189
195
|
} catch (err) {
|
|
@@ -193,10 +199,10 @@ async function _enrichWithLsp(result, lspConn, workspace) {
|
|
|
193
199
|
}
|
|
194
200
|
}
|
|
195
201
|
|
|
196
|
-
async function _resolveLspStatus(
|
|
202
|
+
async function _resolveLspStatus(target, lspConn, workspace) {
|
|
197
203
|
if (_lspCircuitOpen()) return "circuit_open";
|
|
198
204
|
const paths = new Set();
|
|
199
|
-
_extractPaths(
|
|
205
|
+
_extractPaths(target, paths, workspace);
|
|
200
206
|
if (paths.size === 0) return "no_paths";
|
|
201
207
|
const diag = await _callLspHandler(lspConn.port, lspConn.secret, "diagnostics_recent", { paths: [...paths] });
|
|
202
208
|
if (!diag) {
|
|
@@ -205,7 +211,7 @@ async function _resolveLspStatus(parsed, lspConn, workspace) {
|
|
|
205
211
|
}
|
|
206
212
|
_lspCircuitRecordSuccess();
|
|
207
213
|
if (!diag.ok || !diag.files || diag.total === 0) return "no_diagnostics";
|
|
208
|
-
|
|
214
|
+
target._lsp = { diagnostics: diag.files, total: diag.total };
|
|
209
215
|
return "ok";
|
|
210
216
|
}
|
|
211
217
|
|
|
@@ -1298,10 +1304,11 @@ async function createBridgeServer(options) {
|
|
|
1298
1304
|
const tb = Array.isArray(finalResult?.content) && finalResult.content.find(c => c.type === "text");
|
|
1299
1305
|
if (tb?.text) {
|
|
1300
1306
|
const p = JSON.parse(tb.text);
|
|
1301
|
-
|
|
1307
|
+
const t = _lspTarget(p);
|
|
1308
|
+
t._lsp_status = "not_available";
|
|
1302
1309
|
tb.text = JSON.stringify(p);
|
|
1303
1310
|
}
|
|
1304
|
-
} catch (
|
|
1311
|
+
} catch (e) { debugLog("[ctxce] LSP not_available inject failed: " + String(e)); }
|
|
1305
1312
|
}
|
|
1306
1313
|
return finalResult;
|
|
1307
1314
|
} catch (err) {
|