loading…
Search for a command to run...
loading…
Enterprise-grade Jenkins CI/CD integration with multi-tier caching, pipeline monitoring, artifact management, and batch operations. Features 21 MCP tools for jo
Enterprise-grade Jenkins CI/CD integration with multi-tier caching, pipeline monitoring, artifact management, and batch operations. Features 21 MCP tools for job management, build status tracking, and queue management with CSRF protection and 2FA support.
An enterprise-grade MCP (Model Context Protocol) server for Jenkins CI/CD integration with advanced features including multi-tier caching, pipeline monitoring, artifact management, and batch operations.
# Clone this repository
git clone https://github.com/avisangle/jenkins-mcp-server
cd jenkins-mcp-server
# Install Node.js dependencies
npm install
# Install Python dependencies
pip install -e .
# Or using uv (recommended)
uv pip install -e .
# Verify installation
node bin/jenkins-mcp.js --help
Python packages (automatically installed):
mcp[cli]>=1.11.0 - Model Context Protocolrequests>=2.32.4 - HTTP librarycachetools>=5.5.0 - Caching utilitiespython-dotenv - Environment variable managementpydantic - Data validationfastapi - HTTP transport supportCreate a .env file in your working directory:
# Required Jenkins Configuration
JENKINS_URL="http://your-jenkins-server:8080"
JENKINS_USER="your-username"
JENKINS_API_TOKEN="your-api-token"
# Optional: Retry Configuration
JENKINS_MAX_RETRIES=3
JENKINS_RETRY_BASE_DELAY=1.0
JENKINS_RETRY_MAX_DELAY=60.0
JENKINS_RETRY_BACKOFF_MULTIPLIER=2.0
# Optional: Cache Configuration
JENKINS_CACHE_STATIC_TTL=3600 # 1 hour for static data
JENKINS_CACHE_SEMI_STATIC_TTL=300 # 5 minutes for semi-static
JENKINS_CACHE_DYNAMIC_TTL=30 # 30 seconds for dynamic data
JENKINS_CACHE_SHORT_TTL=10 # 10 seconds for short-lived
# Optional: Cache Size Limits
JENKINS_CACHE_STATIC_SIZE=1000
JENKINS_CACHE_SEMI_STATIC_SIZE=500
JENKINS_CACHE_DYNAMIC_SIZE=200
JENKINS_CACHE_PERMANENT_SIZE=2000
JENKINS_CACHE_SHORT_SIZE=100
# Optional: Content Limits
JENKINS_MAX_LOG_SIZE=1000
JENKINS_MAX_CONTENT_SIZE=10000
JENKINS_MAX_ARTIFACT_SIZE_MB=50
# Optional: Server Configuration
MCP_PORT=8010
MCP_HOST=0.0.0.0
Add to your claude_desktop_config.json:
{
"mcpServers": {
"jenkins": {
"command": "node",
"args": [
"/path/to/jenkins-mcp-server/bin/jenkins-mcp.js"
],
"env": {
"JENKINS_URL": "http://your-jenkins-server:8080",
"JENKINS_USER": "your-username",
"JENKINS_API_TOKEN": "your-api-token"
}
}
}
}
# STDIO mode (for Claude Desktop/MCP clients)
node bin/jenkins-mcp.js
# HTTP mode (for MCP Gateway)
node bin/jenkins-mcp.js --transport streamable-http --port 8010
# With custom host
node bin/jenkins-mcp.js --transport streamable-http --port 8080 --host localhost
STDIO Mode (default):
Streamable HTTP Mode:
The server exposes 21 MCP tools for Jenkins interaction:
trigger_jobTrigger a Jenkins job with optional parameters.
Parameters:
job_name (string): Job name or path (e.g., "my-job" or "folder/my-job")params (object, optional): Job parameters as key-value pairsExample:
{
"job_name": "build-project",
"params": {
"BRANCH": "main",
"VERSION": "1.0.0"
}
}
get_job_infoGet detailed information about a Jenkins job.
Parameters:
job_name (string): Job name or pathauto_search (boolean, default: true): Perform pattern search if direct lookup failsReturns: Job configuration, parameters, last build info, and health status
list_jobsList Jenkins jobs with advanced filtering.
Parameters:
recursive (boolean, default: true): Include jobs in subfoldersmax_depth (integer, default: 10): Maximum folder depthinclude_folders (boolean, default: false): Include folder itemsstatus_filter (string, optional): Filter by color (e.g., "blue", "red")last_build_result (string, optional): Filter by result ("SUCCESS", "FAILURE", "UNSTABLE")days_since_last_build (integer, optional): Filter by days since last buildenabled_only (boolean, optional): Show only enabled jobsReturns: Hierarchical list of jobs with statistics
search_jobsSearch for Jenkins jobs by pattern.
Parameters:
pattern (string): Search pattern (supports wildcards)job_type (string, default: "job"): Type filter ("job", "folder", "pipeline")use_regex (boolean, default: false): Use regex pattern matchingmax_depth (integer, default: 10): Maximum search depthReturns: List of matching jobs with details
search_and_triggerSearch for jobs and trigger all matches.
Parameters:
pattern (string): Search patternparams (object, optional): Parameters for all jobsmax_depth (integer, default: 10): Maximum search depthReturns: Trigger status for each matched job
get_folder_infoGet information about a Jenkins folder.
Parameters:
folder_path (string): Folder path (e.g., "team/project")Returns: Folder details and contained jobs
get_build_statusGet status of a specific build.
Parameters:
job_name (string): Job name or pathbuild_number (integer): Build numberReturns: Build status, result, duration, timestamp, and executor info
get_console_logGet console output from a build.
Parameters:
job_name (string): Job name or pathbuild_number (integer): Build numberstart (integer, default: 0): Starting byte offsetReturns: Console log content and metadata
summarize_build_logGet a summarized version of build console log.
Parameters:
job_name (string): Job name or pathbuild_number (integer): Build numberReturns: Summarized log content
get_pipeline_statusGet detailed pipeline execution status with stage information.
Parameters:
job_name (string): Pipeline job namebuild_number (integer): Build numberReturns: Pipeline stages with status, duration, and logs for each stage
list_build_artifactsList all artifacts from a build.
Parameters:
job_name (string): Job name or pathbuild_number (integer): Build numberReturns: List of artifacts with paths, sizes, and download URLs
download_build_artifactDownload a specific build artifact.
Parameters:
job_name (string): Job name or pathbuild_number (integer): Build numberartifact_path (string): Relative path to artifactmax_size_mb (integer, default: 50): Maximum download size in MBReturns: Artifact content (base64 encoded for binary) or text content
search_build_artifactsSearch for artifacts across multiple builds.
Parameters:
job_name (string): Job name or pathpattern (string): Search pattern for artifact namesmax_builds (integer, default: 10): Maximum builds to searchuse_regex (boolean, default: false): Use regex matchingReturns: List of matching artifacts across builds
batch_trigger_jobsTrigger multiple jobs in parallel with priority queuing.
Parameters:
operations (array): List of job operationsjob_name (string): Job nameparams (object, optional): Job parameterspriority (integer, default: 0): Execution priority (higher = earlier)max_concurrent (integer, default: 5): Maximum parallel executionsoperation_name (string, optional): Name for this batch operationReturns: Operation ID for monitoring
Example:
{
"operations": [
{"job_name": "build-frontend", "priority": 10},
{"job_name": "build-backend", "priority": 10},
{"job_name": "integration-tests", "priority": 5}
],
"max_concurrent": 2
}
batch_monitor_jobsMonitor the status of a batch operation.
Parameters:
operation_id (string): Operation ID from batch_trigger_jobsReturns: Status of each job in the batch operation
batch_cancel_jobsCancel a batch operation.
Parameters:
operation_id (string): Operation ID to cancelcancel_running_builds (boolean, default: false): Also cancel running buildsReturns: Cancellation status
get_queue_infoGet information about the Jenkins build queue.
Returns: List of queued items with job names, wait times, and reasons
server_infoGet basic Jenkins server information.
Returns: Version, root URL, and system information
get_cache_statisticsGet statistics about the caching system.
Returns: Cache hit/miss rates, sizes, and memory usage
clear_cacheClear cached data.
Parameters:
cache_type (string, optional): Specific cache to clear ("static", "dynamic", etc.)job_name (string, optional): Clear cache for specific jobReturns: Cache clear status
warm_cachePre-populate cache with commonly used data.
Parameters:
operations (array, optional): List of operations to warm (["list_jobs", "server_info"])Returns: Warm-up status and timing
The server implements a sophisticated 5-tier caching system for optimal performance:
| Tier | TTL | Use Case | Example Data |
|---|---|---|---|
| Static | 1 hour | Rarely changing data | Job definitions, server info |
| Semi-Static | 5 minutes | Occasionally changing | Job lists, folder structures |
| Dynamic | 30 seconds | Frequently changing | Build statuses, queue info |
| Short-Lived | 10 seconds | Real-time data | Active build logs |
| Permanent | No expiry | Immutable data | Completed build artifacts |
Caches are automatically invalidated when:
Customize cache behavior via environment variables (see Configuration section).
The server provides detailed error messages with suggestions:
Fully supports Jenkins folder structures:
{
"job_name": "team-alpha/backend/build-service"
}
All tools accept nested paths with automatic path handling.
max_depth when searchingstatus_filter to reduce data transferPython version error:
# Check Python version
python3 --version # Must be 3.12+
Missing dependencies:
# Reinstall Python packages
pip install -e .
# Or
uv pip install -e .
Connection refused:
JENKINS_URL is correct and accessibleAuthentication failed:
JENKINS_USER matches your Jenkins usernameJob not found:
search_jobs to find correct job nameThe server logs to stderr with request IDs for troubleshooting:
2025-11-12 10:30:45 - jenkins_mcp - INFO - [req-abc123] Received request to trigger job: 'build-project'
# Install test dependencies
pip install -e ".[test]"
# Run tests
pytest
jenkins-mcp-server/
├── bin/
│ └── jenkins-mcp.js # Node.js CLI entry point
├── python/
│ └── jenkins_mcp_server_enhanced.py # Main MCP server implementation
├── scripts/
│ └── check-python.js # Python environment checker
├── .env.example # Example environment configuration
├── pyproject.toml # Python package configuration
├── package.json # Node.js package configuration
└── README.md # This file
Contributions, bug reports, and feature requests are welcome.
Apache License 2.0 - See LICENSE file for details.
For issues and questions:
Version: 1.0.7 Last Updated: 2025-11-13
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"avisangle-jenkins-mcp-server": {
"command": "npx",
"args": []
}
}
}