@syke1/mcp-server 1.4.0 → 1.4.2

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/config.d.ts CHANGED
@@ -14,6 +14,10 @@ export declare function getConfig(key: keyof SykeConfig, envVar?: string): strin
14
14
  * Get all resolved config (for logging/debug)
15
15
  */
16
16
  export declare function getAllConfig(): Record<string, string | undefined>;
17
+ /**
18
+ * Set a config value in ~/.syke/config.json
19
+ */
20
+ export declare function setConfig(key: keyof SykeConfig, value: string | null): void;
17
21
  export declare const CONFIG_DIR_PATH: string;
18
22
  export declare const CONFIG_FILE_PATH: string;
19
23
  export {};
package/dist/config.js CHANGED
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.CONFIG_FILE_PATH = exports.CONFIG_DIR_PATH = void 0;
37
37
  exports.getConfig = getConfig;
38
38
  exports.getAllConfig = getAllConfig;
39
+ exports.setConfig = setConfig;
39
40
  /**
40
41
  * Central config reader for SYKE MCP Server.
41
42
  *
@@ -94,5 +95,27 @@ function getAllConfig() {
94
95
  port: getConfig("port", "SYKE_WEB_PORT"),
95
96
  };
96
97
  }
98
+ /**
99
+ * Set a config value in ~/.syke/config.json
100
+ */
101
+ function setConfig(key, value) {
102
+ const file = readConfigFile();
103
+ if (value === null) {
104
+ delete file[key];
105
+ }
106
+ else {
107
+ file[key] = value;
108
+ }
109
+ try {
110
+ if (!fs.existsSync(CONFIG_DIR)) {
111
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
112
+ }
113
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(file, null, 2));
114
+ cached = file;
115
+ }
116
+ catch {
117
+ // ignore write errors
118
+ }
119
+ }
97
120
  exports.CONFIG_DIR_PATH = CONFIG_DIR;
98
121
  exports.CONFIG_FILE_PATH = CONFIG_FILE;
package/dist/index.js CHANGED
@@ -121,7 +121,7 @@ async function main() {
121
121
  };
122
122
  process.on("SIGINT", shutdown);
123
123
  process.on("SIGTERM", shutdown);
124
- const server = new index_js_1.Server({ name: "syke", version: "1.3.5" }, { capabilities: { tools: {} } });
124
+ const server = new index_js_1.Server({ name: "syke", version: "1.4.2" }, { capabilities: { tools: {} } });
125
125
  // List tools
126
126
  server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
127
127
  tools: [
@@ -485,7 +485,7 @@ async function main() {
485
485
  }
486
486
  });
487
487
  // Pre-warm the graph (skip if no project root — e.g. Smithery scan)
488
- console.error(`[syke] Starting SYKE MCP Server v1.3.5`);
488
+ console.error(`[syke] Starting SYKE MCP Server v1.4.1`);
489
489
  console.error(`[syke] License: ${licenseStatus.plan.toUpperCase()} (${licenseStatus.source})`);
490
490
  if (licenseStatus.expiresAt) {
491
491
  console.error(`[syke] Expires: ${licenseStatus.expiresAt}`);
@@ -558,7 +558,33 @@ async function main() {
558
558
  }
559
559
  // Start Express web server with file cache for SSE (only if project detected)
560
560
  if (currentProjectRoot) {
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)());
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)(), async (key) => {
562
+ // Stop existing heartbeat/session
563
+ await (0, validator_1.stopAndDeactivate)();
564
+ if (key && key.startsWith("SYKE-")) {
565
+ (0, config_1.setConfig)("licenseKey", key);
566
+ (0, validator_1.clearLicenseCache)(); // clear stale cache from previous key
567
+ try {
568
+ licenseStatus = await (0, validator_1.checkLicense)();
569
+ }
570
+ catch {
571
+ licenseStatus = { plan: "free", source: "default" };
572
+ }
573
+ if (licenseStatus.plan === "pro") {
574
+ return { success: true, plan: licenseStatus.plan, expiresAt: licenseStatus.expiresAt };
575
+ }
576
+ else {
577
+ return { success: false, error: licenseStatus.error || "Invalid or expired key" };
578
+ }
579
+ }
580
+ else {
581
+ // Remove key
582
+ (0, config_1.setConfig)("licenseKey", null);
583
+ (0, validator_1.clearLicenseCache)();
584
+ licenseStatus = { plan: "free", source: "default" };
585
+ return { success: true, plan: "free" };
586
+ }
587
+ });
562
588
  webServerHandle = { setFileCache: setWebFileCache };
563
589
  webApp.listen(WEB_PORT, () => {
564
590
  const dashUrl = `http://localhost:${WEB_PORT}`;
@@ -587,7 +613,7 @@ main().catch((err) => {
587
613
  * See: https://smithery.ai/docs/deploy#sandbox-server
588
614
  */
589
615
  function createSandboxServer() {
590
- const sandboxServer = new index_js_1.Server({ name: "syke", version: "1.3.5" }, { capabilities: { tools: {} } });
616
+ const sandboxServer = new index_js_1.Server({ name: "syke", version: "1.4.2" }, { capabilities: { tools: {} } });
591
617
  sandboxServer.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
592
618
  tools: [
593
619
  {
@@ -17,6 +17,10 @@ export declare function stopAndDeactivate(): Promise<void>;
17
17
  * Get current device fingerprint (exported for use by index.ts)
18
18
  */
19
19
  export declare function getDeviceId(): string;
20
+ /**
21
+ * Clear license cache file (called when license key changes)
22
+ */
23
+ export declare function clearLicenseCache(): void;
20
24
  /**
21
25
  * Main license validation — called on MCP server startup
22
26
  */
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.startHeartbeat = startHeartbeat;
37
37
  exports.stopAndDeactivate = stopAndDeactivate;
38
38
  exports.getDeviceId = getDeviceId;
39
+ exports.clearLicenseCache = clearLicenseCache;
39
40
  exports.checkLicense = checkLicense;
40
41
  const fs = __importStar(require("fs"));
41
42
  const path = __importStar(require("path"));
@@ -219,6 +220,19 @@ async function stopAndDeactivate() {
219
220
  function getDeviceId() {
220
221
  return getDeviceFingerprint();
221
222
  }
223
+ /**
224
+ * Clear license cache file (called when license key changes)
225
+ */
226
+ function clearLicenseCache() {
227
+ try {
228
+ if (fs.existsSync(CACHE_FILE)) {
229
+ fs.unlinkSync(CACHE_FILE);
230
+ }
231
+ }
232
+ catch {
233
+ // silently fail
234
+ }
235
+ }
222
236
  /**
223
237
  * Main license validation — called on MCP server startup
224
238
  */