@syke1/mcp-server 1.3.7 → 1.3.8
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/dist/index.js +8 -1
- package/dist/web/server.d.ts +8 -2
- package/dist/web/server.js +18 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -522,6 +522,8 @@ async function main() {
|
|
|
522
522
|
fileCache.initialize();
|
|
523
523
|
fileCache.startWatching();
|
|
524
524
|
}
|
|
525
|
+
// Web server handle (set after server starts)
|
|
526
|
+
let webServerHandle = null;
|
|
525
527
|
// Switch project callback — reinitializes graph + file cache
|
|
526
528
|
function switchProject(newRoot) {
|
|
527
529
|
currentProjectRoot = newRoot;
|
|
@@ -533,6 +535,10 @@ async function main() {
|
|
|
533
535
|
fileCache = new file_cache_1.FileCache(newRoot);
|
|
534
536
|
fileCache.initialize();
|
|
535
537
|
fileCache.startWatching();
|
|
538
|
+
// Re-wire SSE events to the new FileCache
|
|
539
|
+
if (webServerHandle) {
|
|
540
|
+
webServerHandle.setFileCache(fileCache);
|
|
541
|
+
}
|
|
536
542
|
// Rebuild graph
|
|
537
543
|
const graph = (0, graph_1.refreshGraph)(newRoot, currentPackageName);
|
|
538
544
|
console.error(`[syke] Switched to project: ${newRoot}`);
|
|
@@ -552,7 +558,8 @@ async function main() {
|
|
|
552
558
|
}
|
|
553
559
|
// Start Express web server with file cache for SSE (only if project detected)
|
|
554
560
|
if (currentProjectRoot) {
|
|
555
|
-
const webApp = (0, server_1.createWebServer)(() => (0, graph_1.getGraph)(currentProjectRoot, currentPackageName), fileCache, switchProject, () => currentProjectRoot, () => currentPackageName, () => licenseStatus, () => !!(0, provider_1.getAIProvider)());
|
|
561
|
+
const { app: webApp, setFileCache: setWebFileCache } = (0, server_1.createWebServer)(() => (0, graph_1.getGraph)(currentProjectRoot, currentPackageName), fileCache, switchProject, () => currentProjectRoot, () => currentPackageName, () => licenseStatus, () => !!(0, provider_1.getAIProvider)());
|
|
562
|
+
webServerHandle = { setFileCache: setWebFileCache };
|
|
556
563
|
webApp.listen(WEB_PORT, () => {
|
|
557
564
|
const dashUrl = `http://localhost:${WEB_PORT}`;
|
|
558
565
|
console.error(`[syke] Web dashboard: ${dashUrl}`);
|
package/dist/web/server.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import express from "express";
|
|
1
2
|
import { DependencyGraph } from "../graph";
|
|
2
3
|
import { FileCache } from "../watcher/file-cache";
|
|
3
4
|
import { RealtimeAnalysis } from "../ai/realtime-analyzer";
|
|
@@ -24,9 +25,14 @@ export interface SwitchProjectResult {
|
|
|
24
25
|
fileCount: number;
|
|
25
26
|
edgeCount: number;
|
|
26
27
|
}
|
|
27
|
-
export
|
|
28
|
+
export interface WebServerHandle {
|
|
29
|
+
app: ReturnType<typeof express>;
|
|
30
|
+
/** Re-wire SSE events when FileCache is replaced (e.g. after switchProject) */
|
|
31
|
+
setFileCache(cache: FileCache): void;
|
|
32
|
+
}
|
|
33
|
+
export declare function createWebServer(getGraphFn: () => DependencyGraph, initialFileCache?: FileCache, switchProjectFn?: (newRoot: string) => SwitchProjectResult, getProjectRoot?: () => string, getPackageName?: () => string, getLicenseStatus?: () => {
|
|
28
34
|
plan: string;
|
|
29
35
|
expiresAt?: string;
|
|
30
36
|
error?: string;
|
|
31
37
|
source?: string;
|
|
32
|
-
}, hasAIKeyFn?: () => boolean):
|
|
38
|
+
}, hasAIKeyFn?: () => boolean): WebServerHandle;
|
package/dist/web/server.js
CHANGED
|
@@ -226,7 +226,7 @@ function acknowledgeWarnings() {
|
|
|
226
226
|
function getAllWarnings() {
|
|
227
227
|
return [...warningStore];
|
|
228
228
|
}
|
|
229
|
-
function createWebServer(getGraphFn,
|
|
229
|
+
function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProjectRoot, getPackageName, getLicenseStatus, hasAIKeyFn) {
|
|
230
230
|
const app = (0, express_1.default)();
|
|
231
231
|
app.use(express_1.default.json());
|
|
232
232
|
// Serve static files from public/
|
|
@@ -234,6 +234,7 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
234
234
|
app.use(express_1.default.static(publicDir));
|
|
235
235
|
// ── SSE: Server-Sent Events for real-time updates ──
|
|
236
236
|
const sseClients = new Set();
|
|
237
|
+
let currentFileCache = initialFileCache || null;
|
|
237
238
|
function broadcastSSE(event, data) {
|
|
238
239
|
const payload = `event: ${event}\ndata: ${JSON.stringify(data)}\n\n`;
|
|
239
240
|
for (const client of sseClients) {
|
|
@@ -274,7 +275,7 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
274
275
|
"Access-Control-Allow-Origin": "*",
|
|
275
276
|
});
|
|
276
277
|
// Send initial connection event
|
|
277
|
-
res.write(`event: connected\ndata: ${JSON.stringify({ clients: sseClients.size + 1, cacheSize:
|
|
278
|
+
res.write(`event: connected\ndata: ${JSON.stringify({ clients: sseClients.size + 1, cacheSize: currentFileCache?.size || 0 })}\n\n`);
|
|
278
279
|
sseClients.add(res);
|
|
279
280
|
console.error(`[syke:sse] Client connected (${sseClients.size} total)`);
|
|
280
281
|
_req.on("close", () => {
|
|
@@ -283,8 +284,8 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
283
284
|
});
|
|
284
285
|
});
|
|
285
286
|
// Wire FileCache change events → SSE broadcast + AI analysis
|
|
286
|
-
|
|
287
|
-
|
|
287
|
+
function wireFileCacheEvents(cache) {
|
|
288
|
+
cache.on("change", async (change) => {
|
|
288
289
|
const graph = getGraphFn();
|
|
289
290
|
const absPath = path.normalize(path.join(graph.sourceDir, change.relativePath));
|
|
290
291
|
// Compute affected nodes for visual pulse
|
|
@@ -317,7 +318,7 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
317
318
|
if (license && license.plan === "pro") {
|
|
318
319
|
broadcastSSE("analysis-start", { file: change.relativePath });
|
|
319
320
|
try {
|
|
320
|
-
const analysis = await (0, realtime_analyzer_1.analyzeChangeRealtime)(change, graph, (relPath) =>
|
|
321
|
+
const analysis = await (0, realtime_analyzer_1.analyzeChangeRealtime)(change, graph, (relPath) => currentFileCache?.getFileByRelPath(relPath) ?? null);
|
|
321
322
|
broadcastSSE("analysis-result", analysis);
|
|
322
323
|
// Store warnings for MCP check_warnings tool
|
|
323
324
|
addWarning(analysis);
|
|
@@ -341,15 +342,23 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
341
342
|
}
|
|
342
343
|
});
|
|
343
344
|
}
|
|
345
|
+
if (currentFileCache)
|
|
346
|
+
wireFileCacheEvents(currentFileCache);
|
|
347
|
+
/** Replace the FileCache (called after switchProject) */
|
|
348
|
+
function setFileCache(cache) {
|
|
349
|
+
currentFileCache = cache;
|
|
350
|
+
wireFileCacheEvents(cache);
|
|
351
|
+
console.error(`[syke:sse] FileCache re-wired (${cache.size} files)`);
|
|
352
|
+
}
|
|
344
353
|
// GET /api/cache-status — Memory cache stats
|
|
345
354
|
app.get("/api/cache-status", (_req, res) => {
|
|
346
|
-
if (!
|
|
355
|
+
if (!currentFileCache) {
|
|
347
356
|
return res.json({ enabled: false });
|
|
348
357
|
}
|
|
349
358
|
res.json({
|
|
350
359
|
enabled: true,
|
|
351
|
-
fileCount:
|
|
352
|
-
totalLines:
|
|
360
|
+
fileCount: currentFileCache.size,
|
|
361
|
+
totalLines: currentFileCache.totalLines,
|
|
353
362
|
sseClients: sseClients.size,
|
|
354
363
|
});
|
|
355
364
|
});
|
|
@@ -804,5 +813,5 @@ function createWebServer(getGraphFn, fileCache, switchProjectFn, getProjectRoot,
|
|
|
804
813
|
res.status(500).json({ error: err.message || "Failed to switch project" });
|
|
805
814
|
}
|
|
806
815
|
});
|
|
807
|
-
return app;
|
|
816
|
+
return { app, setFileCache };
|
|
808
817
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syke1/mcp-server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"mcpName": "io.github.khalomsky/syke",
|
|
5
5
|
"description": "AI code impact analysis MCP server — dependency graphs, cascade detection, and a mandatory build gate for AI coding agents",
|
|
6
6
|
"main": "dist/index.js",
|