@rishibhushan/jenkins-mcp-server 1.0.6 ā 1.0.7
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 +396 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Designed to work seamlessly with automation clients such as:
|
|
6
6
|
- š„ļø **VS Code MCP** - Direct integration with Claude in VS Code
|
|
7
|
+
- š„ļø **Claude Desktop** - AI-powered Jenkins automation
|
|
7
8
|
- š **Any MCP-compatible client** - Universal compatibility
|
|
8
9
|
|
|
9
10
|
## ⨠About codebase
|
|
@@ -231,10 +232,6 @@ jenkins-mcp-server --env-file .env
|
|
|
231
232
|
npx github:rishibhushan/jenkins_mcp_server --env-file .env
|
|
232
233
|
```
|
|
233
234
|
|
|
234
|
-
[//]: # ([](https://www.npmjs.com/package/@rishibhushan/jenkins-mcp-server))
|
|
235
|
-
|
|
236
|
-
[//]: # ([](https://www.npmjs.com/package/@rishibhushan/jenkins-mcp-server))
|
|
237
|
-
|
|
238
235
|
---
|
|
239
236
|
|
|
240
237
|
This automatically:
|
|
@@ -471,13 +468,15 @@ if result['build_number']:
|
|
|
471
468
|
|
|
472
469
|
## š§ Troubleshooting
|
|
473
470
|
|
|
474
|
-
###
|
|
471
|
+
### Common Issues
|
|
472
|
+
|
|
473
|
+
#### Python Not Found
|
|
475
474
|
```
|
|
476
475
|
Error: Python 3 is required but not found.
|
|
477
476
|
```
|
|
478
477
|
**Solution**: Install Python 3.8+ from https://www.python.org/downloads/
|
|
479
478
|
|
|
480
|
-
|
|
479
|
+
#### Configuration Issues
|
|
481
480
|
```
|
|
482
481
|
ERROR: Jenkins configuration is incomplete!
|
|
483
482
|
```
|
|
@@ -495,7 +494,7 @@ env | grep JENKINS
|
|
|
495
494
|
cat ~/.config/Code/User/settings.json | grep jenkins
|
|
496
495
|
```
|
|
497
496
|
|
|
498
|
-
|
|
497
|
+
#### Connection Failed
|
|
499
498
|
```
|
|
500
499
|
Failed to connect to Jenkins at http://localhost:8080
|
|
501
500
|
```
|
|
@@ -505,7 +504,7 @@ Failed to connect to Jenkins at http://localhost:8080
|
|
|
505
504
|
3. Verify URL is correct (include port if needed)
|
|
506
505
|
4. Test authentication credentials
|
|
507
506
|
|
|
508
|
-
|
|
507
|
+
#### Dependency Installation Failed
|
|
509
508
|
```
|
|
510
509
|
Failed to install dependencies
|
|
511
510
|
```
|
|
@@ -514,6 +513,395 @@ Failed to install dependencies
|
|
|
514
513
|
2. If behind a proxy, set `HTTP_PROXY` and `HTTPS_PROXY` environment variables
|
|
515
514
|
3. Try manual installation: `.venv/bin/pip install -r requirements.txt`
|
|
516
515
|
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
### šØ VPN & Corporate Network Issues
|
|
519
|
+
|
|
520
|
+
If you're experiencing timeout issues with Claude Desktop or other MCP clients when using a VPN or corporate network, this section provides step-by-step solutions.
|
|
521
|
+
|
|
522
|
+
#### Symptom: Request Timeout After 60 Seconds
|
|
523
|
+
|
|
524
|
+
**Error in logs:**
|
|
525
|
+
```
|
|
526
|
+
McpError: MCP error -32001: Request timed out
|
|
527
|
+
Server transport closed unexpectedly
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
**Root Cause**: The Python process spawned by `npx` may not properly inherit VPN network routing, causing it to fail when connecting to internal Jenkins servers.
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
### Solution 1: Bypass Proxy for PyPI (For Dependency Installation Issues)
|
|
535
|
+
|
|
536
|
+
If you're getting proxy errors during dependency installation:
|
|
537
|
+
|
|
538
|
+
**Add to your `claude_desktop_config.json`:**
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"mcpServers": {
|
|
542
|
+
"jenkins": {
|
|
543
|
+
"command": "npx",
|
|
544
|
+
"args": [
|
|
545
|
+
"@rishibhushan/jenkins-mcp-server",
|
|
546
|
+
"--env-file",
|
|
547
|
+
"/path/to/.env"
|
|
548
|
+
],
|
|
549
|
+
"env": {
|
|
550
|
+
"NO_PROXY": "pypi.org,pypi.python.org,files.pythonhosted.org",
|
|
551
|
+
"PIP_NO_PROXY": "pypi.org,pypi.python.org,files.pythonhosted.org"
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
### Solution 2: Use Direct Python Execution (Recommended for VPN)
|
|
561
|
+
|
|
562
|
+
This bypasses the `npx` wrapper entirely and uses Python directly, which properly inherits your system's network routing.
|
|
563
|
+
|
|
564
|
+
#### Step 1: Locate the Installed Package
|
|
565
|
+
|
|
566
|
+
**For macOS/Linux:**
|
|
567
|
+
```bash
|
|
568
|
+
# Find the npx cache directory
|
|
569
|
+
PACKAGE_DIR=$(find ~/.npm/_npx -name "jenkins-mcp-server" -type d 2>/dev/null | head -1)
|
|
570
|
+
echo $PACKAGE_DIR
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**For Windows (PowerShell):**
|
|
574
|
+
```powershell
|
|
575
|
+
# Find the npx cache directory
|
|
576
|
+
$PACKAGE_DIR = Get-ChildItem -Path "$env:LOCALAPPDATA\npm-cache\_npx" -Recurse -Directory -Filter "jenkins-mcp-server" | Select-Object -First 1 -ExpandProperty FullName
|
|
577
|
+
Write-Host $PACKAGE_DIR
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
The output will be something like:
|
|
581
|
+
- **macOS/Linux**: `/Users/username/.npm/_npx/<hash>/node_modules/@rishibhushan/jenkins-mcp-server`
|
|
582
|
+
- **Windows**: `C:\Users\username\AppData\Local\npm-cache\_npx\<hash>\node_modules\@rishibhushan\jenkins-mcp-server`
|
|
583
|
+
|
|
584
|
+
#### Step 2: Update Claude Desktop Configuration
|
|
585
|
+
|
|
586
|
+
Replace `<PACKAGE_DIR>` with the path from Step 1:
|
|
587
|
+
|
|
588
|
+
**macOS/Linux:**
|
|
589
|
+
```json
|
|
590
|
+
{
|
|
591
|
+
"mcpServers": {
|
|
592
|
+
"jenkins": {
|
|
593
|
+
"command": "<PACKAGE_DIR>/.venv/bin/python",
|
|
594
|
+
"args": [
|
|
595
|
+
"-m",
|
|
596
|
+
"jenkins_mcp_server",
|
|
597
|
+
"--env-file",
|
|
598
|
+
"/path/to/your/.env"
|
|
599
|
+
],
|
|
600
|
+
"env": {
|
|
601
|
+
"PYTHONPATH": "<PACKAGE_DIR>/src"
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
**Windows:**
|
|
609
|
+
```json
|
|
610
|
+
{
|
|
611
|
+
"mcpServers": {
|
|
612
|
+
"jenkins": {
|
|
613
|
+
"command": "<PACKAGE_DIR>\\.venv\\Scripts\\python.exe",
|
|
614
|
+
"args": [
|
|
615
|
+
"-m",
|
|
616
|
+
"jenkins_mcp_server",
|
|
617
|
+
"--env-file",
|
|
618
|
+
"C:\\path\\to\\your\\.env"
|
|
619
|
+
],
|
|
620
|
+
"env": {
|
|
621
|
+
"PYTHONPATH": "<PACKAGE_DIR>\\src"
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
#### Step 3: Example Configuration
|
|
629
|
+
|
|
630
|
+
**Complete example for macOS:**
|
|
631
|
+
```json
|
|
632
|
+
{
|
|
633
|
+
"mcpServers": {
|
|
634
|
+
"jenkins": {
|
|
635
|
+
"command": "/Users/username/.npm/_npx/a88b5f55f40c4229/node_modules/@rishibhushan/jenkins-mcp-server/.venv/bin/python",
|
|
636
|
+
"args": [
|
|
637
|
+
"-m",
|
|
638
|
+
"jenkins_mcp_server",
|
|
639
|
+
"--env-file",
|
|
640
|
+
"/Users/username/projects/jenkins_mcp_server/.env"
|
|
641
|
+
],
|
|
642
|
+
"env": {
|
|
643
|
+
"PYTHONPATH": "/Users/username/.npm/_npx/a88b5f55f40c4229/node_modules/@rishibhushan/jenkins-mcp-server/src"
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
#### Step 4: Restart Claude Desktop
|
|
651
|
+
|
|
652
|
+
1. **Connect to your VPN first**
|
|
653
|
+
2. Quit Claude Desktop completely
|
|
654
|
+
3. Start Claude Desktop
|
|
655
|
+
4. Check the MCP server connection in settings
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
### Solution 3: Use Local Git Clone (Best for Development)
|
|
660
|
+
|
|
661
|
+
If you're developing or frequently updating, use a local clone:
|
|
662
|
+
|
|
663
|
+
#### Step 1: Clone and Setup
|
|
664
|
+
```bash
|
|
665
|
+
# Clone the repository
|
|
666
|
+
git clone https://github.com/rishibhushan/jenkins_mcp_server.git
|
|
667
|
+
cd jenkins_mcp_server
|
|
668
|
+
|
|
669
|
+
# Create virtual environment and install dependencies
|
|
670
|
+
python3 -m venv .venv
|
|
671
|
+
source .venv/bin/activate # On Windows: .venv\Scripts\activate
|
|
672
|
+
pip install -r requirements.txt
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
#### Step 2: Configure Claude Desktop
|
|
676
|
+
|
|
677
|
+
**macOS/Linux:**
|
|
678
|
+
```json
|
|
679
|
+
{
|
|
680
|
+
"mcpServers": {
|
|
681
|
+
"jenkins": {
|
|
682
|
+
"command": "/path/to/jenkins_mcp_server/.venv/bin/python",
|
|
683
|
+
"args": [
|
|
684
|
+
"-m",
|
|
685
|
+
"jenkins_mcp_server",
|
|
686
|
+
"--env-file",
|
|
687
|
+
"/path/to/jenkins_mcp_server/.env"
|
|
688
|
+
],
|
|
689
|
+
"env": {
|
|
690
|
+
"PYTHONPATH": "/path/to/jenkins_mcp_server/src"
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
**Windows:**
|
|
698
|
+
```json
|
|
699
|
+
{
|
|
700
|
+
"mcpServers": {
|
|
701
|
+
"jenkins": {
|
|
702
|
+
"command": "C:\\path\\to\\jenkins_mcp_server\\.venv\\Scripts\\python.exe",
|
|
703
|
+
"args": [
|
|
704
|
+
"-m",
|
|
705
|
+
"jenkins_mcp_server",
|
|
706
|
+
"--env-file",
|
|
707
|
+
"C:\\path\\to\\jenkins_mcp_server\\.env"
|
|
708
|
+
],
|
|
709
|
+
"env": {
|
|
710
|
+
"PYTHONPATH": "C:\\path\\to\\jenkins_mcp_server\\src"
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
### š§Ŗ Testing Your Connection
|
|
720
|
+
|
|
721
|
+
Before configuring MCP clients, test your Jenkins connection manually:
|
|
722
|
+
|
|
723
|
+
#### Create a Test Script
|
|
724
|
+
|
|
725
|
+
Save this as `test_jenkins_connection.py`:
|
|
726
|
+
|
|
727
|
+
```python
|
|
728
|
+
#!/usr/bin/env python3
|
|
729
|
+
"""
|
|
730
|
+
Test Jenkins connectivity for MCP server troubleshooting
|
|
731
|
+
"""
|
|
732
|
+
import os
|
|
733
|
+
import sys
|
|
734
|
+
import time
|
|
735
|
+
import requests
|
|
736
|
+
from dotenv import load_dotenv
|
|
737
|
+
|
|
738
|
+
def test_connection():
|
|
739
|
+
# Load environment
|
|
740
|
+
env_file = '/path/to/your/.env' # Update this path
|
|
741
|
+
print(f"Loading environment from: {env_file}")
|
|
742
|
+
load_dotenv(env_file)
|
|
743
|
+
|
|
744
|
+
url = os.getenv('JENKINS_URL')
|
|
745
|
+
username = os.getenv('JENKINS_USERNAME')
|
|
746
|
+
token = os.getenv('JENKINS_TOKEN')
|
|
747
|
+
|
|
748
|
+
print(f"\nJenkins Configuration:")
|
|
749
|
+
print(f" URL: {url}")
|
|
750
|
+
print(f" Username: {username}")
|
|
751
|
+
print(f" Token: {'***' if token else 'NOT SET'}")
|
|
752
|
+
|
|
753
|
+
# Test 1: DNS Resolution
|
|
754
|
+
print(f"\n[Test 1] Testing DNS resolution...")
|
|
755
|
+
import socket
|
|
756
|
+
try:
|
|
757
|
+
hostname = url.split('://')[1].split(':')[0]
|
|
758
|
+
ip = socket.gethostbyname(hostname)
|
|
759
|
+
print(f" ā DNS resolved: {hostname} -> {ip}")
|
|
760
|
+
except Exception as e:
|
|
761
|
+
print(f" ā DNS resolution failed: {e}")
|
|
762
|
+
return False
|
|
763
|
+
|
|
764
|
+
# Test 2: Basic connectivity
|
|
765
|
+
print(f"\n[Test 2] Testing basic HTTP connectivity...")
|
|
766
|
+
try:
|
|
767
|
+
start = time.time()
|
|
768
|
+
response = requests.get(f"{url}/api/json", timeout=5)
|
|
769
|
+
elapsed = time.time() - start
|
|
770
|
+
print(f" ā Connection successful (no auth): {response.status_code} in {elapsed:.2f}s")
|
|
771
|
+
except requests.exceptions.Timeout:
|
|
772
|
+
print(f" ā Connection timed out after 5 seconds")
|
|
773
|
+
return False
|
|
774
|
+
except Exception as e:
|
|
775
|
+
print(f" ā Connection failed: {e}")
|
|
776
|
+
return False
|
|
777
|
+
|
|
778
|
+
# Test 3: Authenticated request
|
|
779
|
+
print(f"\n[Test 3] Testing authenticated request...")
|
|
780
|
+
try:
|
|
781
|
+
start = time.time()
|
|
782
|
+
response = requests.get(
|
|
783
|
+
f"{url}/api/json",
|
|
784
|
+
auth=(username, token),
|
|
785
|
+
timeout=10
|
|
786
|
+
)
|
|
787
|
+
elapsed = time.time() - start
|
|
788
|
+
print(f" ā Authenticated request: {response.status_code} in {elapsed:.2f}s")
|
|
789
|
+
|
|
790
|
+
if response.status_code == 200:
|
|
791
|
+
data = response.json()
|
|
792
|
+
print(f" ā Jenkins version: {data.get('version', 'unknown')}")
|
|
793
|
+
print(f" ā Number of jobs: {len(data.get('jobs', []))}")
|
|
794
|
+
elif response.status_code == 401:
|
|
795
|
+
print(f" ā Authentication failed - check username/token")
|
|
796
|
+
return False
|
|
797
|
+
elif response.status_code == 403:
|
|
798
|
+
print(f" ā Access forbidden - check permissions")
|
|
799
|
+
return False
|
|
800
|
+
except Exception as e:
|
|
801
|
+
print(f" ā Authenticated request failed: {e}")
|
|
802
|
+
return False
|
|
803
|
+
|
|
804
|
+
# Test 4: python-jenkins library
|
|
805
|
+
print(f"\n[Test 4] Testing python-jenkins library...")
|
|
806
|
+
try:
|
|
807
|
+
import jenkins
|
|
808
|
+
start = time.time()
|
|
809
|
+
server = jenkins.Jenkins(url, username=username, password=token)
|
|
810
|
+
user = server.get_whoami()
|
|
811
|
+
elapsed = time.time() - start
|
|
812
|
+
print(f" ā python-jenkins connection: {user['fullName']} in {elapsed:.2f}s")
|
|
813
|
+
except Exception as e:
|
|
814
|
+
print(f" ā python-jenkins failed: {e}")
|
|
815
|
+
return False
|
|
816
|
+
|
|
817
|
+
print(f"\nā All tests passed! Jenkins MCP Server should work.")
|
|
818
|
+
return True
|
|
819
|
+
|
|
820
|
+
if __name__ == "__main__":
|
|
821
|
+
print("=" * 60)
|
|
822
|
+
print("Jenkins MCP Server - Connection Diagnostic")
|
|
823
|
+
print("=" * 60)
|
|
824
|
+
|
|
825
|
+
success = test_connection()
|
|
826
|
+
sys.exit(0 if success else 1)
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
#### Run the Test
|
|
830
|
+
|
|
831
|
+
```bash
|
|
832
|
+
# Connect to VPN first
|
|
833
|
+
# Then run:
|
|
834
|
+
cd /path/to/jenkins_mcp_server
|
|
835
|
+
source .venv/bin/activate
|
|
836
|
+
python test_jenkins_connection.py
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
**Expected output if everything works:**
|
|
840
|
+
```
|
|
841
|
+
============================================================
|
|
842
|
+
Jenkins MCP Server - Connection Diagnostic
|
|
843
|
+
============================================================
|
|
844
|
+
|
|
845
|
+
[Test 1] Testing DNS resolution...
|
|
846
|
+
ā DNS resolved: jenkins.example.com -> 10.0.0.1
|
|
847
|
+
|
|
848
|
+
[Test 2] Testing basic HTTP connectivity...
|
|
849
|
+
ā Connection successful (no auth): 200 in 0.45s
|
|
850
|
+
|
|
851
|
+
[Test 3] Testing authenticated request...
|
|
852
|
+
ā Authenticated request: 200 in 0.52s
|
|
853
|
+
ā Jenkins version: 2.401.3
|
|
854
|
+
ā Number of jobs: 42
|
|
855
|
+
|
|
856
|
+
[Test 4] Testing python-jenkins library...
|
|
857
|
+
ā python-jenkins connection: John Doe in 0.38s
|
|
858
|
+
|
|
859
|
+
ā All tests passed! Jenkins MCP Server should work.
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
If all tests pass but MCP still fails, use Solution 2 (Direct Python Execution).
|
|
863
|
+
|
|
864
|
+
---
|
|
865
|
+
|
|
866
|
+
### š Still Having Issues?
|
|
867
|
+
|
|
868
|
+
If you're still experiencing problems after trying the solutions above:
|
|
869
|
+
|
|
870
|
+
1. **Check Claude Desktop logs:**
|
|
871
|
+
- **macOS**: `~/Library/Logs/Claude/mcp-server-jenkins.log`
|
|
872
|
+
- **Windows**: `%APPDATA%\Claude\logs\mcp-server-jenkins.log`
|
|
873
|
+
- **Linux**: `~/.config/Claude/logs/mcp-server-jenkins.log`
|
|
874
|
+
|
|
875
|
+
2. **Enable verbose logging** by adding `--verbose` to args:
|
|
876
|
+
```json
|
|
877
|
+
"args": [
|
|
878
|
+
"-m",
|
|
879
|
+
"jenkins_mcp_server",
|
|
880
|
+
"--env-file",
|
|
881
|
+
"/path/to/.env",
|
|
882
|
+
"--verbose"
|
|
883
|
+
]
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
3. **Verify VPN is active** before starting Claude Desktop:
|
|
887
|
+
```bash
|
|
888
|
+
# Test if you can reach your Jenkins server
|
|
889
|
+
curl -I http://your-jenkins-server:8080
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
4. **Check if other tools can reach Jenkins** while on VPN:
|
|
893
|
+
- Try accessing Jenkins in your browser
|
|
894
|
+
- Try `curl` from terminal
|
|
895
|
+
- If both work but MCP doesn't, use Solution 2
|
|
896
|
+
|
|
897
|
+
5. **Open an issue** with:
|
|
898
|
+
- Your operating system
|
|
899
|
+
- Claude Desktop log file
|
|
900
|
+
- Output of the connection test script
|
|
901
|
+
- Your configuration (with credentials redacted)
|
|
902
|
+
|
|
903
|
+
---
|
|
904
|
+
|
|
517
905
|
### Enable Debug Logging
|
|
518
906
|
|
|
519
907
|
Run with verbose flag to see detailed logs:
|