@syke1/mcp-server 1.4.7 → 1.4.9

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.
Files changed (2) hide show
  1. package/dist/web/server.js +15 -16
  2. package/package.json +1 -1
@@ -230,6 +230,11 @@ function getAllWarnings() {
230
230
  function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProjectRoot, getPackageName, getLicenseStatus, hasAIKeyFn, setLicenseKeyFn, setAIKeyFn, getAIInfoFn) {
231
231
  const app = (0, express_1.default)();
232
232
  app.use(express_1.default.json());
233
+ /** Check if current license is Pro (includes pro_trial) */
234
+ function isProPlan() {
235
+ const license = getLicenseStatus?.();
236
+ return license?.plan === "pro" || license?.plan === "pro_trial";
237
+ }
233
238
  // Serve static files from public/
234
239
  const publicDir = path.join(__dirname, "public");
235
240
  app.use(express_1.default.static(publicDir));
@@ -264,8 +269,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
264
269
  }
265
270
  app.get("/api/events", (_req, res) => {
266
271
  // Pro-only: real-time monitoring via SSE
267
- const license = getLicenseStatus?.();
268
- if (!license || license.plan !== "pro") {
272
+ if (!isProPlan()) {
269
273
  res.status(403).json(getProFeatureError("Real-time monitoring"));
270
274
  return;
271
275
  }
@@ -315,8 +319,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
315
319
  timestamp: change.timestamp,
316
320
  });
317
321
  // Run Gemini real-time analysis (Pro only)
318
- const license = getLicenseStatus?.();
319
- if (license && license.plan === "pro") {
322
+ if (isProPlan()) {
320
323
  broadcastSSE("analysis-start", { file: change.relativePath });
321
324
  try {
322
325
  const analysis = await (0, realtime_analyzer_1.analyzeChangeRealtime)(change, graph, (relPath) => currentFileCache?.getFileByRelPath(relPath) ?? null);
@@ -366,8 +369,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
366
369
  // GET /api/graph — Cytoscape.js compatible JSON
367
370
  app.get("/api/graph", (_req, res) => {
368
371
  const graph = getGraphFn();
369
- const license = getLicenseStatus?.();
370
- const isPro = license?.plan === "pro";
372
+ const isPro = isProPlan();
371
373
  const FREE_GRAPH_LIMIT = 50;
372
374
  const nodes = [];
373
375
  const edges = [];
@@ -460,8 +462,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
460
462
  });
461
463
  // POST /api/ai-analyze — AI semantic analysis (Pro or BYOK)
462
464
  app.post("/api/ai-analyze", async (req, res) => {
463
- const license = getLicenseStatus?.();
464
- const isPro = license?.plan === "pro";
465
+ const isPro = isProPlan();
465
466
  const hasKey = hasAIKeyFn?.() || false;
466
467
  if (!isPro && !hasKey) {
467
468
  return res.status(403).json({
@@ -498,8 +499,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
498
499
  });
499
500
  // GET /api/hub-files — Top hub files ranking (Pro only)
500
501
  app.get("/api/hub-files", (req, res) => {
501
- const license = getLicenseStatus?.();
502
- if (!license || license.plan !== "pro") {
502
+ if (!isProPlan()) {
503
503
  return res.status(403).json(getProFeatureError("Hub files ranking"));
504
504
  }
505
505
  const requested = parseInt(req.query.top) || 10;
@@ -573,8 +573,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
573
573
  });
574
574
  // GET /api/cycles — Detect circular dependencies (Pro only)
575
575
  app.get("/api/cycles", (_req, res) => {
576
- const license = getLicenseStatus?.();
577
- if (!license || license.plan !== "pro") {
576
+ if (!isProPlan()) {
578
577
  return res.status(403).json(getProFeatureError("Cycle detection"));
579
578
  }
580
579
  const graph = getGraphFn();
@@ -661,8 +660,7 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
661
660
  });
662
661
  // GET /api/simulate-delete/:file — Simulate file removal (Pro only)
663
662
  app.get("/api/simulate-delete/*splat", (req, res) => {
664
- const license = getLicenseStatus?.();
665
- if (!license || license.plan !== "pro") {
663
+ if (!isProPlan()) {
666
664
  return res.status(403).json(getProFeatureError("Delete simulation"));
667
665
  }
668
666
  const splat = req.params.splat;
@@ -841,8 +839,9 @@ function createWebServer(getGraphFn, initialFileCache, switchProjectFn, getProje
841
839
  }
842
840
  const normalized = path.normalize(projectRoot);
843
841
  // Free tier: only 1 project allowed — block switch to a different project
844
- const license = getLicenseStatus?.();
845
- if (!license || license.plan !== "pro") {
842
+ const licenseForLog = getLicenseStatus?.();
843
+ console.error(`[syke:switch] plan="${licenseForLog?.plan}" isProPlan=${isProPlan()}`);
844
+ if (!isProPlan()) {
846
845
  const currentRoot = getProjectRoot ? path.normalize(getProjectRoot()) : null;
847
846
  if (currentRoot && normalized !== currentRoot) {
848
847
  return res.status(403).json({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syke1/mcp-server",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
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",