@rishibhushan/jenkins-mcp-server 1.0.3 → 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/README.md CHANGED
@@ -346,6 +346,72 @@ Add to `claude_desktop_config.json`:
346
346
 
347
347
  ---
348
348
 
349
+ ## 🏢 Corporate Network / Proxy Setup
350
+
351
+ If you're behind a corporate proxy or firewall:
352
+
353
+ ### Option 1: Set Environment Variables (Recommended)
354
+ ```bash
355
+ # Set proxy environment variables
356
+ export HTTP_PROXY=http://your-proxy:8080
357
+ export HTTPS_PROXY=http://your-proxy:8080
358
+ export NO_PROXY=localhost,127.0.0.1
359
+
360
+ # Run the server (wrapper will auto-detect proxy)
361
+ npx @rishibhushan/jenkins-mcp-server --env-file .env
362
+ ```
363
+
364
+ ### Option 2: Configure npm and pip
365
+ ```bash
366
+ # Configure npm proxy
367
+ npm config set proxy http://your-proxy:8080
368
+ npm config set https-proxy http://your-proxy:8080
369
+
370
+ # Configure pip proxy (for SSL issues)
371
+ pip config set global.proxy http://your-proxy:8080
372
+ pip config set global.trusted-host "pypi.org pypi.python.org files.pythonhosted.org"
373
+
374
+ # Run the server
375
+ npx @rishibhushan/jenkins-mcp-server --env-file .env
376
+ ```
377
+
378
+ ### Option 3: Claude Desktop with Proxy
379
+
380
+ Add proxy settings to your `claude_desktop_config.json`:
381
+ ```json
382
+ {
383
+ "mcpServers": {
384
+ "jenkins": {
385
+ "command": "npx",
386
+ "args": [
387
+ "@rishibhushan/jenkins-mcp-server",
388
+ "--env-file",
389
+ "/path/to/.env"
390
+ ],
391
+ "env": {
392
+ "HTTP_PROXY": "http://your-proxy:8080",
393
+ "HTTPS_PROXY": "http://your-proxy:8080",
394
+ "NO_PROXY": "localhost,127.0.0.1"
395
+ }
396
+ }
397
+ }
398
+ }
399
+ ```
400
+
401
+ ### SSL Certificate Issues
402
+
403
+ If you encounter SSL certificate errors:
404
+ ```bash
405
+ # Disable SSL verification for pip (one-time setup)
406
+ pip config set global.trusted-host "pypi.org pypi.python.org files.pythonhosted.org"
407
+
408
+ # Or use environment variable
409
+ export PIP_TRUSTED_HOST="pypi.org pypi.python.org files.pythonhosted.org"
410
+ ```
411
+
412
+ The Node.js wrapper automatically handles SSL certificate issues when it detects proxy environment variables.
413
+
414
+ ---
349
415
  ## 💡 Usage Examples
350
416
 
351
417
  ### Natural Language Commands
@@ -30,9 +30,10 @@ const colors = {
30
30
  };
31
31
 
32
32
  function log(message, color = 'reset') {
33
- const colorCode = process.stdout.isTTY ? colors[color] : '';
34
- const resetCode = process.stdout.isTTY ? colors.reset : '';
35
- console.log(`${colorCode}${message}${resetCode}`);
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) {
@@ -172,13 +173,36 @@ function installDependencies(venvPath) {
172
173
  log('Installing Python dependencies...', 'yellow');
173
174
  log('This may take a minute...', 'blue');
174
175
 
175
- const result = spawnSync(pip, ['install', '-r', requirementsPath], {
176
+ // Build pip install command with proxy-friendly options
177
+ const pipArgs = ['install', '-r', requirementsPath];
178
+
179
+ // Add proxy-friendly options to handle corporate networks
180
+ const proxyFriendlyArgs = [
181
+ '--trusted-host', 'pypi.org',
182
+ '--trusted-host', 'pypi.python.org',
183
+ '--trusted-host', 'files.pythonhosted.org'
184
+ ];
185
+
186
+ // Add proxy if environment variable is set
187
+ const proxy = process.env.HTTP_PROXY || process.env.http_proxy ||
188
+ process.env.HTTPS_PROXY || process.env.https_proxy;
189
+
190
+ if (proxy) {
191
+ log(`Using proxy: ${proxy}`, 'blue');
192
+ pipArgs.push('--proxy', proxy);
193
+ }
194
+
195
+ // Add all proxy-friendly args
196
+ pipArgs.push(...proxyFriendlyArgs);
197
+
198
+ // Install requirements
199
+ const installReqs = spawnSync(pip, pipArgs, {
176
200
  cwd: projectRoot,
177
201
  stdio: 'inherit'
178
202
  });
179
203
 
180
- if (result.status !== 0) {
181
- error('Failed to install dependencies');
204
+ if (installReqs.status !== 0) {
205
+ error('Failed to install dependencies from requirements.txt');
182
206
  console.error('\nTroubleshooting:');
183
207
  console.error(' 1. Check your internet connection');
184
208
  console.error(' 2. If behind a proxy, set HTTP_PROXY/HTTPS_PROXY env vars');
@@ -186,7 +210,33 @@ function installDependencies(venvPath) {
186
210
  process.exit(1);
187
211
  }
188
212
 
189
- log('✓ Dependencies installed', 'green');
213
+ log('✓ Requirements installed', 'green');
214
+
215
+ // Install the package itself in editable mode
216
+ log('Installing jenkins-mcp-server package...', 'yellow');
217
+
218
+ const packageArgs = ['install', '-e', '.'];
219
+
220
+ // Add same proxy-friendly options
221
+ if (proxy) {
222
+ packageArgs.push('--proxy', proxy);
223
+ }
224
+ packageArgs.push(...proxyFriendlyArgs);
225
+
226
+ const installPkg = spawnSync(pip, packageArgs, {
227
+ cwd: projectRoot,
228
+ stdio: 'inherit'
229
+ });
230
+
231
+ if (installPkg.status !== 0) {
232
+ error('Failed to install jenkins-mcp-server package');
233
+ console.error('\nTroubleshooting:');
234
+ console.error(' 1. Ensure pyproject.toml or setup.py exists');
235
+ console.error(' 2. Try manually: .venv/bin/pip install -e .');
236
+ process.exit(1);
237
+ }
238
+
239
+ log('✓ Package installed', 'green');
190
240
  }
191
241
 
192
242
  /**
@@ -239,27 +289,43 @@ function runServer(venvPath) {
239
289
  const env = {
240
290
  ...process.env,
241
291
  PYTHONPATH: path.join(projectRoot, 'src'),
242
- PYTHONUNBUFFERED: '1' // Ensure output is not buffered
292
+ PYTHONUNBUFFERED: '1'
243
293
  };
244
294
 
245
295
  const serverArgs = [...entryPoint.args, ...args];
246
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
+
247
306
  log('Starting Jenkins MCP Server...', 'green');
248
307
  log(`Command: ${python} ${serverArgs.join(' ')}`, 'blue');
249
308
 
309
+ // CRITICAL: stdin=pipe, stdout=inherit (for JSON-RPC), stderr=inherit (for logs)
250
310
  const server = spawn(python, serverArgs, {
251
311
  cwd: projectRoot,
252
- stdio: 'inherit',
312
+ stdio: ['pipe', 'inherit', 'inherit'],
253
313
  env: env,
254
314
  shell: isWindows
255
315
  });
256
316
 
257
317
  server.on('error', (err) => {
318
+ console.error('=== SPAWN ERROR ===', err);
258
319
  error(`Failed to start server: ${err.message}`);
259
320
  process.exit(1);
260
321
  });
261
322
 
262
- server.on('close', (code) => {
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} ===`);
263
329
  if (code !== 0 && code !== null) {
264
330
  log(`Server exited with code ${code}`, 'yellow');
265
331
  }
@@ -288,14 +354,14 @@ function main() {
288
354
  try {
289
355
  // Check for help flag
290
356
  if (args.includes('--help') || args.includes('-h')) {
291
- console.log('Jenkins MCP Server - Node.js Wrapper');
292
- console.log('\nUsage: jenkins-mcp-server [options]');
293
- console.log('\nOptions:');
294
- console.log(' --env-file PATH Path to custom .env file');
295
- console.log(' --verbose, -v Enable verbose logging');
296
- console.log(' --no-vscode Skip loading VS Code settings');
297
- console.log(' --version Show version');
298
- console.log(' --help, -h Show this help message');
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');
299
365
  process.exit(0);
300
366
  }
301
367
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rishibhushan/jenkins-mcp-server",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "AI-enabled Jenkins automation via Model Context Protocol (MCP)",
5
5
  "main": "bin/jenkins-mcp.js",
6
6
  "bin": {