polydev-ai 1.2.8 → 1.2.10
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/mcp/stdio-wrapper.js +31 -16
- package/package.json +1 -1
package/mcp/stdio-wrapper.js
CHANGED
|
@@ -8,13 +8,12 @@ const { CLIManager } = require('../lib/cliManager');
|
|
|
8
8
|
class StdioMCPWrapper {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.userToken = process.env.POLYDEV_USER_TOKEN;
|
|
11
|
-
|
|
12
|
-
console.error('POLYDEV_USER_TOKEN environment variable is required');
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
11
|
+
// Don't exit immediately - wait for initialization to report error properly
|
|
15
12
|
|
|
16
|
-
// Initialize CLI Manager for local CLI functionality
|
|
17
|
-
this.
|
|
13
|
+
// Initialize CLI Manager for local CLI functionality (only if token exists)
|
|
14
|
+
if (this.userToken) {
|
|
15
|
+
this.cliManager = new CLIManager();
|
|
16
|
+
}
|
|
18
17
|
|
|
19
18
|
// Load manifest for tool definitions
|
|
20
19
|
this.loadManifest();
|
|
@@ -66,6 +65,18 @@ class StdioMCPWrapper {
|
|
|
66
65
|
};
|
|
67
66
|
|
|
68
67
|
case 'tools/call':
|
|
68
|
+
// Check if token is missing
|
|
69
|
+
if (!this.userToken) {
|
|
70
|
+
return {
|
|
71
|
+
jsonrpc: '2.0',
|
|
72
|
+
id,
|
|
73
|
+
error: {
|
|
74
|
+
code: -32603,
|
|
75
|
+
message: 'POLYDEV_USER_TOKEN environment variable is required. Please add it to your MCP configuration.'
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
// Handle CLI tools locally, forward others to remote server
|
|
70
81
|
const toolName = params.name;
|
|
71
82
|
if (toolName.startsWith('polydev.') && this.isCliTool(toolName)) {
|
|
@@ -852,18 +863,22 @@ class StdioMCPWrapper {
|
|
|
852
863
|
async start() {
|
|
853
864
|
console.log('Starting Polydev Stdio MCP Wrapper...');
|
|
854
865
|
|
|
855
|
-
//
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
866
|
+
// Only run initial CLI detection if we have a token
|
|
867
|
+
if (this.userToken && this.cliManager) {
|
|
868
|
+
console.error('[Stdio Wrapper] Running initial CLI detection...');
|
|
869
|
+
try {
|
|
870
|
+
await this.localForceCliDetection({});
|
|
871
|
+
console.error('[Stdio Wrapper] Initial CLI detection completed');
|
|
872
|
+
} catch (error) {
|
|
873
|
+
console.error('[Stdio Wrapper] Initial CLI detection failed:', error);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
// Start smart refresh scheduler for automatic updates
|
|
877
|
+
this.startSmartRefreshScheduler();
|
|
878
|
+
} else {
|
|
879
|
+
console.error('[Stdio Wrapper] No token provided - CLI detection disabled');
|
|
862
880
|
}
|
|
863
881
|
|
|
864
|
-
// Start smart refresh scheduler for automatic updates
|
|
865
|
-
this.startSmartRefreshScheduler();
|
|
866
|
-
|
|
867
882
|
process.stdin.setEncoding('utf8');
|
|
868
883
|
let buffer = '';
|
|
869
884
|
|
package/package.json
CHANGED