Community Edition Model Context Protocol (MCP) server for Jenkins CI/CD integration
Project description
Jenkins MCP Server - Community Edition
A Community Edition Model Context Protocol (MCP) server for Jenkins CI/CD integration, providing essential Jenkins operations through standardized tools. This open-source version focuses on core functionality for AI assistants to interact with Jenkins instances.
๐ฏ Overview
The Jenkins MCP Server Community Edition provides essential Jenkins integration for AI assistants with:
- Core Job Management: List, create, and manage Jenkins jobs
- Build Operations: Trigger builds and monitor build status
- Lightweight Design: Focused on essential features without complexity
- Open Source: MIT licensed for community use and contribution
โจ Features
๐ Core Features (Community Edition)
- โ List Jenkins Jobs - Browse and filter Jenkins jobs with folder support
- โ Get Job Details - Retrieve detailed job information and build history
- โ Create Jenkins Jobs - Create freestyle, pipeline, and folder jobs
- โ Trigger Builds - Start builds with or without parameters
- โ Get Build Status - Monitor build progress and results
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ AI Assistant โโโโโบโ Jenkins MCP โโโโโบโ Jenkins Master โ
โ (Claude, etc) โ โ Server (CE) โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โ โผ
โผ โโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโ โ Jenkins Agents โ
โ 5 Core Tools โ โ (Build Nodes) โ
โ - list_jobs โ โโโโโโโโโโโโโโโโโโโ
โ - get_details โ โ
โ - create_job โ โผ
โ - trigger_build โ โโโโโโโโโโโโโโโโโโโ
โ - get_status โ โ Build Artifacts โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐ Prerequisites
System Requirements
- Python: 3.10 or higher
- Operating System: Linux, macOS, or Windows
- Memory: Minimum 256MB RAM
- Network: HTTP/HTTPS access to Jenkins server
Jenkins Requirements
- Jenkins Version: 2.400+ (LTS recommended)
- Required Plugins: Basic Jenkins installation (no additional plugins required)
Authentication Requirements
- Jenkins user account with appropriate permissions
- API token (recommended) or username/password
- Required Jenkins permissions:
- Overall/Read
- Job/Build, Job/Cancel, Job/Read
- Job/Create, Job/Configure (for job creation)
๐ Installation
Method 1: From Source
# Clone the repository
git clone <repository-url>
cd jenkins_mcp_community
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -e .
Method 2: Using Docker
# Build the Docker image
docker build -t jenkins-mcp-community .
# Run with Docker
docker run --rm \
jenkins-mcp-community \
--jenkins-url http://your-jenkins.com:8080 \
--jenkins-username your-username \
--jenkins-token your-api-token
Method 3: Using uvx (Recommended for Quick Testing)
# Run directly with uvx (no installation needed)
uvx jenkins-mcp-server@latest \
--jenkins-url http://your-jenkins.com:8080 \
--jenkins-username your-username \
--jenkins-token your-token
# With environment variables
JENKINS_URL=http://your-jenkins.com:8080 \
JENKINS_USERNAME=your-username \
JENKINS_TOKEN=your-token \
uvx jenkins-mcp-server@latest
โ๏ธ Configuration
Environment Variables
# Required Configuration
JENKINS_URL=http://your-jenkins-server:8080
JENKINS_USERNAME=your-username
JENKINS_TOKEN=your-api-token
# Optional Configuration
JENKINS_TIMEOUT=30 # Request timeout in seconds
Getting Jenkins API Token
- Log into your Jenkins instance
- Go to Manage Jenkins โ Manage Users
- Click on your username โ Configure
- Under API Token, click Add new Token
- Generate and copy the token (store securely)
๐ Usage
Command Line Interface
# Basic usage
python -m jenkins_mcp_server
# With custom configuration
python -m jenkins_mcp_server \
--jenkins-url http://localhost:8080 \
--jenkins-username your-username \
--jenkins-token your-token \
--log-level DEBUG
With AI Assistants
Amazon Q Developer CLI
Add to your MCP configuration:
{
"mcpServers": {
"jenkins": {
"command": "python",
"args": [
"-m", "jenkins_mcp_server",
"--jenkins-url", "http://your-jenkins.com",
"--jenkins-username", "your-username",
"--jenkins-token", "your-token"
]
}
}
}
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"jenkins": {
"command": "python",
"args": ["-m", "jenkins_mcp_server"],
"env": {
"JENKINS_URL": "http://your-jenkins.com",
"JENKINS_USERNAME": "your-username",
"JENKINS_TOKEN": "your-token"
}
}
}
}
Available MCP Tools (Community Edition)
| Tool | Description | Example Usage |
|---|---|---|
list_jenkins_jobs |
List jobs with filtering | List all jobs in "production" folder |
get_job_details |
Get detailed job information | Get details for "my-pipeline" job |
create_jenkins_job |
Create new jobs | Create a freestyle job with build steps |
trigger_jenkins_build |
Trigger builds with parameters | Trigger build with BRANCH=main |
get_build_status |
Get build status and info | Get status of build #42 |
Example Interactions
# List all jobs
"Show me all Jenkins jobs"
# Create a new job
"Create a freestyle job called 'my-app-build'"
# Trigger a build with parameters
"Trigger a build for 'my-pipeline' with ENVIRONMENT=staging"
# Get build status
"What's the status of the latest build for 'my-app'?"
# Get job details
"Show me details for the 'deployment-pipeline' job"
๐ Project Structure
jenkins_mcp_community/
โโโ ๐ README.md # This file
โโโ ๐ LICENSE # MIT license
โโโ โ๏ธ pyproject.toml # Project configuration
โโโ ๐ณ Dockerfile # Docker image definition
โโโ ๐ฆ jenkins_mcp_server/ # Main package
โ โโโ ๐ __init__.py # Package initialization
โ โโโ ๐ __main__.py # CLI entry point
โ โโโ ๐ server.py # FastMCP server implementation
โ โโโ ๐ models.py # Pydantic data models
โ โโโ ๐ exceptions.py # Custom exception classes
โ โโโ ๐ handlers/ # Request handlers
โ โ โโโ ๐ base_handler.py # Base handler with common functionality
โ โ โโโ ๐ job_handler.py # Job management operations
โ โ โโโ ๐ build_handler.py # Build management operations
โ โโโ ๐ utils/ # Utility modules
โ โโโ ๐ cache.py # Simple caching system
โ โโโ ๐ connection_pool.py # HTTP connection pooling
โ โโโ ๐ retry.py # Retry logic with backoff
โ โโโ ๐ validation.py # Input validation
โ โโโ ๐ logging_helper.py # Structured logging
โ โโโ ๐ path_utils.py # Path manipulation utilities
โโโ ๐งช tests/ # Test suite
โโโ ๐งช conftest.py # Pytest configuration
โโโ ๐ unit/ # Unit tests
โโโ ๐ integration/ # Integration tests
๐งช Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=jenkins_mcp_server --cov-report=html
# Run specific test categories
pytest tests/unit/ # Unit tests only
pytest tests/integration/ # Integration tests only
๐ Security Considerations
Authentication & Authorization
- API Tokens: Use Jenkins API tokens instead of passwords
- Least Privilege: Grant minimum required permissions
- Secure Storage: Store credentials in environment variables
Required Jenkins Permissions
Overall:
- Read
Job:
- Build (for triggering builds)
- Configure (for creating/updating jobs)
- Create (for creating new jobs)
- Read (for viewing job details)
Network Security
- HTTPS: Use HTTPS for Jenkins connections in production
- Firewall: Restrict network access to Jenkins server
- Certificate Validation: Enable SSL certificate verification
๐ค Contributing
We welcome contributions to this open-source project!
Development Setup
# Fork and clone the repository
git clone <your-fork-url>
cd jenkins_mcp_community
# Create development environment
python -m venv venv
source venv/bin/activate
# Install development dependencies
pip install -e ".[dev,test]"
# Run tests
pytest
Pull Request Process
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes with tests
- Ensure all tests pass (
pytest) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Code Standards
- Code Style: Follow PEP 8 (enforced by
ruff) - Type Hints: Use type hints throughout
- Documentation: Update docstrings and documentation
- Tests: Add tests for new functionality
- Commit Messages: Use conventional commit format
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Jenkins MCP Community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
๐ Acknowledgements
Core Dependencies
- FastMCP - Modern MCP server framework
- python-jenkins - Jenkins API client
- Pydantic - Data validation and settings management
- httpx - Modern HTTP client
Special Thanks
- Jenkins Community - For the amazing CI/CD platform
- MCP Protocol Team - For the standardized AI integration protocol
- Python Community - For the excellent ecosystem of tools and libraries
Jenkins MCP Server Community Edition - Open Source Jenkins Integration for AI
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jenkins_mcp_community-1.0.0.tar.gz.
File metadata
- Download URL: jenkins_mcp_community-1.0.0.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd4aee83572d7ee5058099930258e3bad5161f4aa63370174a1f694a85d74030
|
|
| MD5 |
33a9c91dd78ed6c8f32efef172095552
|
|
| BLAKE2b-256 |
25725e7df6905fce0be29965acb3c237c42b330a0c548b0b48301730429ffa73
|
File details
Details for the file jenkins_mcp_community-1.0.0-py3-none-any.whl.
File metadata
- Download URL: jenkins_mcp_community-1.0.0-py3-none-any.whl
- Upload date:
- Size: 42.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc354096170df43d4cfe759aa5f6bfcc90ba3056f33b21ad83aa1e7880f7e4e1
|
|
| MD5 |
f976b8fb56d96dcae842d8c1ad36cae9
|
|
| BLAKE2b-256 |
38df92c2b4702aaeee2be88e98314329f0df7363b69e8d9a17bc836afb4d83a8
|