@syke1/mcp-server 1.1.8 → 1.2.0
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.d.ts +40 -1
- package/dist/index.js +101 -32
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Smithery sandbox server — returns a lightweight MCP server for tool/capability scanning.
|
|
5
|
+
* No project root, license, or file cache needed.
|
|
6
|
+
* See: https://smithery.ai/docs/deploy#sandbox-server
|
|
7
|
+
*/
|
|
8
|
+
export declare function createSandboxServer(): Server<{
|
|
9
|
+
method: string;
|
|
10
|
+
params?: {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
_meta?: {
|
|
13
|
+
[x: string]: unknown;
|
|
14
|
+
progressToken?: string | number | undefined;
|
|
15
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
16
|
+
taskId: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
method: string;
|
|
22
|
+
params?: {
|
|
23
|
+
[x: string]: unknown;
|
|
24
|
+
_meta?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
progressToken?: string | number | undefined;
|
|
27
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
28
|
+
taskId: string;
|
|
29
|
+
} | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
_meta?: {
|
|
35
|
+
[x: string]: unknown;
|
|
36
|
+
progressToken?: string | number | undefined;
|
|
37
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
38
|
+
taskId: string;
|
|
39
|
+
} | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
}>;
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.createSandboxServer = createSandboxServer;
|
|
37
38
|
// Silence dotenv stdout output (v17+ writes to stdout, corrupting MCP stdio protocol)
|
|
38
39
|
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
39
40
|
process.stdout.write = (() => true);
|
|
@@ -85,12 +86,18 @@ function isFileInFreeSet(resolvedPath, graph) {
|
|
|
85
86
|
}
|
|
86
87
|
const PRO_UPGRADE_MSG = "This file exceeds the Free tier limit (50 files). Upgrade to Pro for unlimited analysis: https://syke.cloud/dashboard/";
|
|
87
88
|
async function main() {
|
|
89
|
+
// Check license before starting (graceful fallback for hosted environments like Smithery)
|
|
90
|
+
try {
|
|
91
|
+
licenseStatus = await (0, validator_1.checkLicense)();
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
licenseStatus = { plan: "free", source: "default" };
|
|
95
|
+
}
|
|
88
96
|
if (!currentProjectRoot) {
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
// No project detected — still start MCP server for tool discovery (Smithery scan)
|
|
98
|
+
console.error("[syke] WARNING: No project root detected. Tools will return errors until a project is opened.");
|
|
99
|
+
console.error("[syke] Set SYKE_currentProjectRoot or run from a project directory.");
|
|
91
100
|
}
|
|
92
|
-
// Check license before starting
|
|
93
|
-
licenseStatus = await (0, validator_1.checkLicense)();
|
|
94
101
|
// Show device binding errors
|
|
95
102
|
if (licenseStatus.error) {
|
|
96
103
|
console.error(`[syke] LICENSE ERROR: ${licenseStatus.error}`);
|
|
@@ -452,8 +459,7 @@ async function main() {
|
|
|
452
459
|
};
|
|
453
460
|
}
|
|
454
461
|
});
|
|
455
|
-
// Pre-warm the graph
|
|
456
|
-
const detectedLangs = (0, plugin_1.detectLanguages)(currentProjectRoot).map(p => p.name).join(", ") || "none";
|
|
462
|
+
// Pre-warm the graph (skip if no project root — e.g. Smithery scan)
|
|
457
463
|
console.error(`[syke] Starting SYKE MCP Server v0.4.0`);
|
|
458
464
|
console.error(`[syke] License: ${licenseStatus.plan.toUpperCase()} (${licenseStatus.source})`);
|
|
459
465
|
if (licenseStatus.plan === "pro") {
|
|
@@ -463,26 +469,31 @@ async function main() {
|
|
|
463
469
|
console.error(`[syke] Free tier: ${FREE_MAX_FILES} file limit, ai_analyze/get_hub_files/check_warnings disabled`);
|
|
464
470
|
console.error(`[syke] Upgrade at https://syke.cloud/dashboard/`);
|
|
465
471
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
472
|
+
let fileCache = null;
|
|
473
|
+
if (currentProjectRoot) {
|
|
474
|
+
const detectedLangs = (0, plugin_1.detectLanguages)(currentProjectRoot).map(p => p.name).join(", ") || "none";
|
|
475
|
+
console.error(`[syke] Project root: ${currentProjectRoot}`);
|
|
476
|
+
console.error(`[syke] Detected languages: ${detectedLangs}`);
|
|
477
|
+
console.error(`[syke] Package name: ${currentPackageName}`);
|
|
478
|
+
const graph = (0, graph_1.getGraph)(currentProjectRoot, currentPackageName);
|
|
479
|
+
// Free tier: warn if over file limit
|
|
480
|
+
if (licenseStatus.plan === "free" && graph.files.size > FREE_MAX_FILES) {
|
|
481
|
+
console.error(`[syke] WARNING: Free tier limited to ${FREE_MAX_FILES} files. Your project has ${graph.files.size} files.`);
|
|
482
|
+
console.error(`[syke] Only the first ${FREE_MAX_FILES} files will be analyzed. Upgrade to Pro for unlimited files.`);
|
|
483
|
+
}
|
|
484
|
+
// Initialize file cache (load ALL source files into memory)
|
|
485
|
+
fileCache = new file_cache_1.FileCache(currentProjectRoot);
|
|
486
|
+
fileCache.initialize();
|
|
487
|
+
fileCache.startWatching();
|
|
474
488
|
}
|
|
475
|
-
// Initialize file cache (load ALL source files into memory)
|
|
476
|
-
let fileCache = new file_cache_1.FileCache(currentProjectRoot);
|
|
477
|
-
fileCache.initialize();
|
|
478
|
-
fileCache.startWatching();
|
|
479
489
|
// Switch project callback — reinitializes graph + file cache
|
|
480
490
|
function switchProject(newRoot) {
|
|
481
491
|
currentProjectRoot = newRoot;
|
|
482
492
|
const plugins = (0, plugin_1.detectLanguages)(newRoot);
|
|
483
493
|
currentPackageName = (0, plugin_1.detectPackageName)(newRoot, plugins);
|
|
484
494
|
// Stop old file cache and create new one
|
|
485
|
-
fileCache
|
|
495
|
+
if (fileCache)
|
|
496
|
+
fileCache.stop();
|
|
486
497
|
fileCache = new file_cache_1.FileCache(newRoot);
|
|
487
498
|
fileCache.initialize();
|
|
488
499
|
fileCache.startWatching();
|
|
@@ -503,19 +514,21 @@ async function main() {
|
|
|
503
514
|
edgeCount,
|
|
504
515
|
};
|
|
505
516
|
}
|
|
506
|
-
// Start Express web server with file cache for SSE
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
: `
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
// Start Express web server with file cache for SSE (only if project detected)
|
|
518
|
+
if (currentProjectRoot) {
|
|
519
|
+
const webApp = (0, server_1.createWebServer)(() => (0, graph_1.getGraph)(currentProjectRoot, currentPackageName), fileCache, switchProject, () => currentProjectRoot, () => currentPackageName, () => licenseStatus);
|
|
520
|
+
webApp.listen(WEB_PORT, () => {
|
|
521
|
+
const dashUrl = `http://localhost:${WEB_PORT}`;
|
|
522
|
+
console.error(`[syke] Web dashboard: ${dashUrl}`);
|
|
523
|
+
// Auto-open browser (disable with SYKE_NO_BROWSER=1)
|
|
524
|
+
if (process.env.SYKE_NO_BROWSER !== "1") {
|
|
525
|
+
const cmd = process.platform === "win32" ? `start ${dashUrl}`
|
|
526
|
+
: process.platform === "darwin" ? `open ${dashUrl}`
|
|
527
|
+
: `xdg-open ${dashUrl}`;
|
|
528
|
+
(0, child_process_1.exec)(cmd, () => { });
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
519
532
|
// Connect via stdio
|
|
520
533
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
521
534
|
await server.connect(transport);
|
|
@@ -525,3 +538,59 @@ main().catch((err) => {
|
|
|
525
538
|
console.error("[syke] Fatal error:", err);
|
|
526
539
|
process.exit(1);
|
|
527
540
|
});
|
|
541
|
+
/**
|
|
542
|
+
* Smithery sandbox server — returns a lightweight MCP server for tool/capability scanning.
|
|
543
|
+
* No project root, license, or file cache needed.
|
|
544
|
+
* See: https://smithery.ai/docs/deploy#sandbox-server
|
|
545
|
+
*/
|
|
546
|
+
function createSandboxServer() {
|
|
547
|
+
const sandboxServer = new index_js_1.Server({ name: "syke", version: "0.4.0" }, { capabilities: { tools: {} } });
|
|
548
|
+
sandboxServer.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
|
|
549
|
+
tools: [
|
|
550
|
+
{
|
|
551
|
+
name: "gate_build",
|
|
552
|
+
description: "MANDATORY: Call this BEFORE any build, deploy, or test command. Returns PASS, WARN, or FAIL verdict.",
|
|
553
|
+
inputSchema: { type: "object", properties: { files: { type: "array", items: { type: "string" }, description: "Files that were modified" } }, required: ["files"] },
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
name: "analyze_impact",
|
|
557
|
+
description: "Shows direct and transitive dependents when a file is modified.",
|
|
558
|
+
inputSchema: { type: "object", properties: { file: { type: "string", description: "File to analyze" } }, required: ["file"] },
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "check_safe",
|
|
562
|
+
description: "Quick safety verdict: HIGH/MEDIUM/LOW/NONE risk.",
|
|
563
|
+
inputSchema: { type: "object", properties: { file: { type: "string", description: "File to check" } }, required: ["file"] },
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: "get_dependencies",
|
|
567
|
+
description: "Lists internal imports (forward dependencies) of a file.",
|
|
568
|
+
inputSchema: { type: "object", properties: { file: { type: "string", description: "File to check" } }, required: ["file"] },
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: "get_hub_files",
|
|
572
|
+
description: "Pro: Ranks files by how many other files depend on them.",
|
|
573
|
+
inputSchema: { type: "object", properties: {} },
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: "refresh_graph",
|
|
577
|
+
description: "Re-scans all source files and rebuilds the dependency graph.",
|
|
578
|
+
inputSchema: { type: "object", properties: {} },
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
name: "ai_analyze",
|
|
582
|
+
description: "Pro: Gemini AI semantic analysis of a file and its dependents.",
|
|
583
|
+
inputSchema: { type: "object", properties: { file: { type: "string", description: "File to analyze" } }, required: ["file"] },
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "check_warnings",
|
|
587
|
+
description: "Pro: Real-time monitoring alerts for file changes.",
|
|
588
|
+
inputSchema: { type: "object", properties: {} },
|
|
589
|
+
},
|
|
590
|
+
],
|
|
591
|
+
}));
|
|
592
|
+
sandboxServer.setRequestHandler(types_js_1.CallToolRequestSchema, async () => ({
|
|
593
|
+
content: [{ type: "text", text: "Sandbox mode — no project loaded." }],
|
|
594
|
+
}));
|
|
595
|
+
return sandboxServer;
|
|
596
|
+
}
|
package/package.json
CHANGED