A Model Context Protocol (MCP) server for Jenkins automation, enabling AI assistants to interact with Jenkins instances.
This project provides a stdio MCP server that exposes Jenkins functionality to AI assistants through the Model Context Protocol, enabling seamless automation and interaction with Jenkins instances.
The server includes efficient tools for working with large outputs, using grep patterns and pagination to explore logs progressively without overwhelming context windows. It also provides flexible test result analysis with filtering options to manage output size for large test suites.
- Clone and build the project:
git clone https://github.com/your-org/jenkins-mcp.git
cd jenkins-mcp
swift build -c release
-
Set up authentication (see Authentication section)
-
Add to your MCP configuration (e.g., Claude Desktop):
{
"mcpServers": {
"jenkins": {
"type": "stdio",
"command": "/path/to/jenkins-mcp/.build/release/jenkins-mcp",
"args": ["--jenkins-url", "https://your-jenkins.com"]
}
}
}
-
Store credential in a netrc file. See Authentication section.
-
Add to your MCP configuration (e.g., Claude Desktop):
{
"mcpServers": {
"jenkins": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-v",
"/path/to/.netrc:/var/jenkins/.netrc",
"ghcr.io/t089/jenkins-mcp:0.2.1",
"--jenkins-url",
"https://your-jenkins.com",
"--netrc-file",
"/var/jenkins/.netrc"
]
}
}
}
Job Management:
get_overview
- Jenkins server overviewlist_jobs
- List jobs in a folderget_job
/get_job_by_url
- Get job detailstrigger_build
- Trigger builds with parameters
Build Operations:
get_build
/get_build_by_url
- Get build detailsstop_build
- Stop running buildsget_queue
- View build queueget_queue_item
- Get specific queue item detailscancel_queue_item
- Cancel queued builds
Log Analysis:
get_build_logs
- Get console output with paginationget_build_logs_offset
- Read logs from specific offsetgrep_build_logs
- Search logs with regex patterns
Test Results:
get_build_test_report
- Get test results with filtering options:level
: Control output detail (summary
,suite
,full
)status
: Filter by test status (all
,failed
,passed
,skipped
)namePattern
: Filter tests by regex patternmaxTests
: Limit number of test cases returned (when usingfull
level)maxErrorLength
: Maximum length for error details and stack traces (default: 1000, 0 = no truncation)limit
: Maximum number of test suites to return (default: 50)offset
: Number of test suites to skip for pagination (default: 0)
The server supports two authentication methods:
Netrc File (Recommended):
Create ~/.netrc
:
machine your-jenkins.com
login your-username
password your-api-token
Set permissions:
chmod 600 ~/.netrc
Environment Variables:
export JENKINS_USERNAME=your-username
export JENKINS_PASSWORD=your-api-token
Keychain (macOS - recommended):
Not yet implemented.
# Build all targets
swift build
# Run tests
swift test
# Build release version
swift build -c release
# Build Docker images
make docker
Copyright 2025 Tobias Haeberle