@rishibhushan/jenkins-mcp-server 1.0.4 → 1.0.5
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/bin/jenkins-mcp.js +31 -14
- package/package.json +1 -1
package/bin/jenkins-mcp.js
CHANGED
|
@@ -30,9 +30,10 @@ const colors = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
function log(message, color = 'reset') {
|
|
33
|
-
const colorCode = process.
|
|
34
|
-
const resetCode = process.
|
|
35
|
-
|
|
33
|
+
const colorCode = process.stderr.isTTY ? colors[color] : '';
|
|
34
|
+
const resetCode = process.stderr.isTTY ? colors.reset : '';
|
|
35
|
+
// CRITICAL: Use stderr for all output, stdout is for JSON-RPC only
|
|
36
|
+
console.error(`${colorCode}${message}${resetCode}`);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
function error(message) {
|
|
@@ -288,27 +289,43 @@ function runServer(venvPath) {
|
|
|
288
289
|
const env = {
|
|
289
290
|
...process.env,
|
|
290
291
|
PYTHONPATH: path.join(projectRoot, 'src'),
|
|
291
|
-
PYTHONUNBUFFERED: '1'
|
|
292
|
+
PYTHONUNBUFFERED: '1'
|
|
292
293
|
};
|
|
293
294
|
|
|
294
295
|
const serverArgs = [...entryPoint.args, ...args];
|
|
295
296
|
|
|
297
|
+
// All logging to stderr (stdout reserved for JSON-RPC)
|
|
298
|
+
console.error('=== NODE WRAPPER DEBUG ===');
|
|
299
|
+
console.error('Project root:', projectRoot);
|
|
300
|
+
console.error('Python path:', python);
|
|
301
|
+
console.error('Entry point:', entryPoint);
|
|
302
|
+
console.error('Server args:', serverArgs);
|
|
303
|
+
console.error('PYTHONPATH:', env.PYTHONPATH);
|
|
304
|
+
console.error('=== ATTEMPTING TO START PYTHON ===');
|
|
305
|
+
|
|
296
306
|
log('Starting Jenkins MCP Server...', 'green');
|
|
297
307
|
log(`Command: ${python} ${serverArgs.join(' ')}`, 'blue');
|
|
298
308
|
|
|
309
|
+
// CRITICAL: stdin=pipe, stdout=inherit (for JSON-RPC), stderr=inherit (for logs)
|
|
299
310
|
const server = spawn(python, serverArgs, {
|
|
300
311
|
cwd: projectRoot,
|
|
301
|
-
stdio: 'inherit',
|
|
312
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
302
313
|
env: env,
|
|
303
314
|
shell: isWindows
|
|
304
315
|
});
|
|
305
316
|
|
|
306
317
|
server.on('error', (err) => {
|
|
318
|
+
console.error('=== SPAWN ERROR ===', err);
|
|
307
319
|
error(`Failed to start server: ${err.message}`);
|
|
308
320
|
process.exit(1);
|
|
309
321
|
});
|
|
310
322
|
|
|
311
|
-
server.on('
|
|
323
|
+
server.on('spawn', () => {
|
|
324
|
+
console.error('=== PYTHON PROCESS SPAWNED ===');
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
server.on('close', (code, signal) => {
|
|
328
|
+
console.error(`=== PYTHON PROCESS CLOSED: code=${code}, signal=${signal} ===`);
|
|
312
329
|
if (code !== 0 && code !== null) {
|
|
313
330
|
log(`Server exited with code ${code}`, 'yellow');
|
|
314
331
|
}
|
|
@@ -337,14 +354,14 @@ function main() {
|
|
|
337
354
|
try {
|
|
338
355
|
// Check for help flag
|
|
339
356
|
if (args.includes('--help') || args.includes('-h')) {
|
|
340
|
-
console.
|
|
341
|
-
console.
|
|
342
|
-
console.
|
|
343
|
-
console.
|
|
344
|
-
console.
|
|
345
|
-
console.
|
|
346
|
-
console.
|
|
347
|
-
console.
|
|
357
|
+
console.error('Jenkins MCP Server - Node.js Wrapper');
|
|
358
|
+
console.error('\nUsage: jenkins-mcp-server [options]');
|
|
359
|
+
console.error('\nOptions:');
|
|
360
|
+
console.error(' --env-file PATH Path to custom .env file');
|
|
361
|
+
console.error(' --verbose, -v Enable verbose logging');
|
|
362
|
+
console.error(' --no-vscode Skip loading VS Code settings');
|
|
363
|
+
console.error(' --version Show version');
|
|
364
|
+
console.error(' --help, -h Show this help message');
|
|
348
365
|
process.exit(0);
|
|
349
366
|
}
|
|
350
367
|
|