Supports containerized deployment for easy integration, allowing the MCP to be run as a Docker container with configuration and token management via environment variables and mounted volumes.
Provides tools for managing multiple Jenkins servers, supporting job search, parameterized build management, real-time build monitoring, and job creation from Jenkinsfiles. Enables automation of common DevOps scenarios like user permission sync, application deployment, and container image sync.
Uses Python 3.11+ as its runtime environment, providing a foundation for the server's implementation and supporting both local development and containerized deployment options.
Jenkins MCP Tool
🚀 Introduction
Jenkins MCP is an multi-Jenkins server management and automation tool developed based on the FastMCP framework, designed for DevOps processes. It supports intelligent scenario mapping, multi-server management, complete CI/CD lifecycle operations, and dynamic job creation.
✨ Core Features
🏢 Multi-Server Management
- Dynamic Configuration: Supports configuration and dynamic addition/removal of multiple Jenkins servers
- Environment Isolation: Supports management of multiple environments such as development, testing, and production
- Secure Authentication: Supports token and environment variable-based authentication
🎯 Intelligent Scenario Mapping
- Pre-configured Scenarios: Built-in common DevOps scenarios (user permission sync, app deployment, image sync)
- Smart Recommendation: Automatically selects server and job path based on scenario
- Personalized Guidance: Each scenario provides customized operation guidance
⚙️ Full CI/CD Support
- Job Search: Supports fuzzy and exact search across multi-level directories
- Parameterized Build: Automatically detects and validates required parameters
- Real-time Monitoring: Build status query and log retrieval
- Build Control: Supports build trigger, stop, and management
- Job Creation: Create/update Jenkins jobs from Jenkinsfile with automatic directory management
🔧 Developer Friendly
- MCP Standard: Complies with Model Context Protocol specification
- Dockerized: Containerized deployment for easy integration
- Multiple Operation Modes: Supports stdio, SSE, and HTTP transport modes
⚙️ Configuration Guide
📁 Config File Structure
Create a config.yaml
file to configure Jenkins servers and application scenarios:
🔐 Security Configuration
Recommended: Use environment variables to manage sensitive information
Configuration Priority:
- Environment variable (variable name specified by
tokenEnv
) - Direct configuration (
token
field) - Interactive input (if neither is configured)
🚀 Quick Start
🐳 Docker Method (Recommended)
1. Build Image
2. Prepare Configuration
Create a config.yaml
file (refer to the configuration guide above)
3. Run Container
🎨 MCP Client Integration
Cursor Integration
- Set Environment Variables:
- Create Config File:
Create
jenkins-config.yaml
in the project root: - Configure Cursor MCP Settings:
Add to Cursor's MCP config:
- Usage Example:
In Cursor, ask:
Method 2: Local Installation
- Install Dependencies:
- Configure Cursor MCP Settings:
🔧 Command Line Arguments
Jenkins MCP supports the following command line arguments:
🔧 Traditional Startup
📋 Available Tools (11)
🔧 Server Management
Tool | Description | Params |
---|---|---|
get_server_names() | Get the list of all available Jenkins servers | None |
validate_jenkins_config() | Validate the integrity of Jenkins config | None |
🎯 Intelligent Scenarios (Recommended Workflow)
Tool | Description | Params |
---|---|---|
get_scenario_list() | Get all available scenarios | None |
search_jobs_by_scenario(scenario) | Search Jenkins jobs by scenario | scenario : scenario name |
🔍 Job Search and Management
Tool | Description | Params |
---|---|---|
search_jobs(server_name, keyword) | Search Jenkins jobs on a server | server_name : server namekeyword : search term |
get_job_parameters(server_name, job_full_name) | Get job parameter definitions | server_name : server namejob_full_name : job name |
⚙️ Build Management
Tool | Description | Params |
---|---|---|
trigger_build(server_name, job_full_name, params) | Trigger Jenkins build | server_name : server namejob_full_name : job nameparams : build params (optional) |
get_build_status(server_name, job_full_name, build_number) | Get build status | server_name : server namejob_full_name : job namebuild_number : build number |
stop_build(server_name, job_full_name, build_number) | Stop Jenkins build | server_name : server namejob_full_name : job namebuild_number : build number |
get_build_log(server_name, job_full_name, build_number) | Get build log | server_name : server namejob_full_name : job namebuild_number : build number |
🚀 Job Creation and Management
Tool | Description | Params |
---|---|---|
create_or_update_job_from_jenkinsfile(server_name, job_name, jenkinsfile_content, description, folder_path) | Create or update Jenkins job from Jenkinsfile | server_name : server namejob_name : job namejenkinsfile_content : Jenkinsfile contentdescription : job description (optional)folder_path : folder path (optional) |
🚀 Recommended Workflow
Scenario-based Deployment (Recommended)
General Job Search
Job Creation Workflow
💡 Usage Examples
Scenario-based Deployment Example
Direct Operation Example
Job Creation Example
🔍 Enhanced Job Information
When searching or getting job information, the following details are returned:
- Basic Info: Job name, full name, URL, description
- Status: Buildable status, color indicator, parameterization status
- Build History: Last build number, last build URL
- Parameters: Complete parameter definitions with types and default values
🏗️ Job Creation Features
Automatic Directory Management
- User Organization: All created jobs are organized under
MCPS/{username}/
directory - Username Extraction: Automatically extracts username from Jenkins server configuration (handles email formats)
- Folder Creation: Automatically creates necessary folder structure
- Nested Folders: Supports creating jobs in nested folder paths
Job Creation Process
- Folder Structure: Jobs are created in
MCPS/{username}/{optional_folder_path}/
- Conflict Handling: Automatically detects existing jobs and updates configuration
- Pipeline Jobs: Creates pipeline jobs with sandbox security enabled
- Error Recovery: Robust error handling for folder creation and job updates
🎯 Pre-configured Scenarios
Jenkins MCP comes with 3 common DevOps scenarios:
Scenario | Description | Server | Job Path |
---|---|---|---|
Sync User Permissions | User permission sync scenario | shlab | maglev/tool/permission-replicate/ |
Deploy Application | Application deployment, supports diff/sync/build | maglev-sre | release/deploy/ |
Sync Image to mldc | Sync container image to mldc environment | shlab | mldc-prod/sync-container-image-to-docker-af |
🎨 Custom Scenario Configuration
📁 Scenario File Support
Jenkins MCP supports multiple ways to configure custom scenarios:
- Standalone Scenario File (Recommended):
- Environment Variable:
- Configure in config.yaml:
🔄 Scenario Merge Rules
- Default Scenarios: Load built-in scenarios from
scenarios.default.yaml
- User Scenarios: Load from custom scenario file
- Merge Strategy: User scenarios take precedence, same-name scenarios override defaults
📝 Scenario File Example
Create a scenarios.yaml
file:
🧪 Testing
Unit Tests
Docker Test
MCP Inspector Testing
🔧 Development
Local Development Environment
Contribution Guide
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📚 Documentation
- Tool Documentation - Complete tool list and usage
- FastMCP Documentation - MCP framework docs
- Model Context Protocol - MCP protocol standard
🆘 Troubleshooting
Common Issues
Q: Failed to connect to Jenkins server?
A: Check network, URL, and authentication info. Use validate_jenkins_config()
to validate config.
Q: Build parameter validation failed?
A: Use get_job_parameters()
to check required parameters and ensure all are provided.
Q: Docker container failed to start?
A: Check config file mount path and environment variable settings.
Q: Job creation failed with 500 error?
A: Check Jenkins permissions and CSRF settings. The tool automatically handles CSRF tokens.
Q: Cannot create job in specified folder?
A: Ensure you have permission to create folders and jobs. Jobs are automatically organized under MCPS/{username}/
.
Log Debugging
Performance Optimization
- Multi-level Directory Support: Efficiently handles nested Jenkins folders
- Intelligent Parameter Detection: Reduces API calls through smart caching
- CSRF Token Management: Automatic token handling for secure Jenkins instances
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Support
If you have questions or suggestions:
- Check known issues in Issues
- Create a new Issue to report problems
- Contact the development team for support
Jenkins MCP - Make Jenkins automation easier 🚀
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
A multi-Jenkins server management and automation tool that enables intelligent scenario mapping, multi-server management, and complete CI/CD lifecycle operations through natural language interactions.
Related MCP Servers
- AsecurityAlicenseAqualityEnables managing Jenkins operations like listing jobs, triggering builds, and checking build statuses through a configurable MCP server.Last updated -38PythonApache 2.0
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with Jenkins CI/CD servers, providing tools to check build statuses, trigger builds, and retrieve build logs.Last updated -310JavaScriptMIT License
- -securityFlicense-qualityAn integration tool that allows interaction with Jenkins CI/CD servers through a Model Context Protocol interface, enabling users to view server info, manage jobs, inspect builds, and trigger builds with parameters.Last updated -Python
- -securityFlicense-qualityA natural language-based server analysis and monitoring system that automatically processes user queries about server status and provides detailed responses with visualizations.Last updated -JavaScript