mcp-jenkins-client
v0.1.2MCP server for Jenkins CI/CD integration via python-jenkins
An open-source MCP server that exposes Jenkins CI/CD operations as tools for AI assistants. Built on python-jenkins and FastMCP. Run it from PyPI, install from source with uv, or build a Docker image. The source and Docker routes start from a clone. Requires uv. uvx downloads the package (and Python 3.10+ if none is installed) and runs it, so there is nothing to install first:
Summary extracted from the README.
mcp-jenkins-client
An open-source MCP server that exposes Jenkins CI/CD operations as tools for AI assistants. Built on python-jenkins and FastMCP.
Installation
Run it from PyPI, install from source with uv, or build a Docker image. The source and Docker routes start from a clone.
From PyPI
Requires uv. uvx downloads the package (and Python 3.10+ if none is installed) and runs it, so there is nothing to install first:
uvx mcp-jenkins-client # starts the server on stdio (needs the variables below)
uvx reuses its cached copy; uvx mcp-jenkins-client@latest fetches the newest release.
Without uv: pipx install mcp-jenkins-client, or pip install mcp-jenkins-client into a virtualenv. Both put a mcp-jenkins-client command on your PATH.
From source (uv)
Requires Python 3.10+ and uv.
git clone <repo-url> mcp-jenkins-client
cd mcp-jenkins-client
uv sync # creates .venv and installs the server
uv run mcp-jenkins-client # starts the server on stdio (needs the variables below)
To work on it, install the test dependencies and run the suite:
uv sync --extra dev
uv run pytest
Without uv: python -m venv .venv && .venv/bin/pip install -e ".[dev]".
Docker
Requires Docker. Python and uv are not needed.
git clone <repo-url> mcp-jenkins-client
cd mcp-jenkins-client
docker build -t mcp-jenkins-client .
The image is not published anywhere, so build it yourself. After git pull, rebuild it to update.
Configuration
Set the following environment variables:
| Variable | Required | Description |
|---|---|---|
JENKINS_URL |
Yes | Jenkins server URL |
JENKINS_USERNAME |
Yes | Jenkins username |
JENKINS_API_TOKEN |
Yes | Jenkins API token |
JENKINS_TIMEOUT |
No | Per-request HTTP timeout in seconds (default 60) |
JENKINS_LOG_CACHE_MB |
No | Disk cap for the log cache in MB (default 1024); 0 turns the cache off |
JENKINS_RETRIES |
No | Retries for transient failures — 502/503/504 responses and refused connections (default 3); 0 disables |
Claude Desktop / Claude Code
Add to your MCP client configuration. To run it from PyPI:
{
"mcpServers": {
"jenkins": {
"command": "uvx",
"args": ["mcp-jenkins-client"],
"env": {
"JENKINS_URL": "https://jenkins.example.com",
"JENKINS_USERNAME": "your-username",
"JENKINS_API_TOKEN": "your-api-token"
}
}
}
}
After pipx install or pip install, use "command": "mcp-jenkins-client" with no args instead.
For a uv install from source, use the path to your checkout:
{
"mcpServers": {
"jenkins": {
"command": "uv",
"args": ["--directory", "/path/to/mcp-jenkins-client", "run", "mcp-jenkins-client"],
"env": {
"JENKINS_URL": "https://jenkins.example.com",
"JENKINS_USERNAME": "your-username",
"JENKINS_API_TOKEN": "your-api-token"
}
}
}
}
For the Docker image, the client starts a container for each session:
{
"mcpServers": {
"jenkins": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "JENKINS_URL", "-e", "JENKINS_USERNAME", "-e", "JENKINS_API_TOKEN",
"mcp-jenkins-client"
],
"env": {
"JENKINS_URL": "https://jenkins.example.com",
"JENKINS_USERNAME": "your-username",
"JENKINS_API_TOKEN": "your-api-token"
}
}
}
}
-iis required: the server talks to the client over stdin and stdout.-e NAMEwithout a value passes the variable fromenvinto the container, so the token stays out of the command line. Add"-e", "JENKINS_TIMEOUT"or"-e", "JENKINS_LOG_CACHE_MB"to pass an optional setting.- Add
"-v", "mcp-jenkins-cache:/root/.cache/mcp-jenkins-client"toargsto keep the log cache across sessions; without it each container starts with an empty cache. - Inside the container,
localhostis the container itself. For a Jenkins on your own machine, usehttp://host.docker.internal:8080(on Linux, also add"--add-host=host.docker.internal:host-gateway"toargs).
Available Tools (54)
Jobs (14 tools)
list_jobs— List jobs with server-side paginationget_job_info— Get full job detailsget_job_config— Get job XML configurationcreate_job— Create a job from XML configreconfig_job— Update job configurationcopy_job— Copy a jobrename_job— Rename a jobdelete_job— Delete a jobenable_job— Enable a disabled jobdisable_job— Disable a jobjob_exists— Check if a job existscreate_folder— Create a folderset_next_build_number— Set next build numbersearch_jobs— Search jobs by regex across all folder depths
Builds (16 tools)
Every build tool except delete_build accepts lastBuild, lastSuccessfulBuild, lastFailedBuild or lastCompletedBuild in place of a build number; responses to an alias include the resolved build_number. Right after build_job, lastBuild is still the previous build — use the build number from wait_for_queue_item.
list_builds— List builds for a job with pagination (optionally with each build's result and parameters)build_job— Trigger a build (auto-routes parameterized jobs tobuildWithParameters; on a multibranch project, starts a branch scan)get_build_info— Get full build detailsget_build_status— Get just result/building/duration — cheap, use for pollingwait_for_build— Block until a build finishes (bounded, default 300s)get_build_console_output— Read a byte range of the console logsearch_build_console— Regex-search the console log, with context lines; page withfrom_offsetget_build_stages— Get pipeline stage infoget_stage_log— Read one pipeline stage's logget_failed_stage_log— Jump straight to the tail of the first failed stageget_build_env_vars— Get build environment variablesget_build_test_report— Get test resultsstop_build— Stop a running build (escalates/stop→/term→/kill)delete_build— Delete a buildget_build_artifact— Download a build artifactget_running_builds— List running builds
Nodes (6 tools)
list_nodes— List agent nodes with paginationget_node_info— Get node detailsget_node_config— Get node XML configurationdelete_node— Delete a nodeenable_node— Enable a nodedisable_node— Disable a node
Views (6 tools)
list_views— List views with paginationget_view_config— Get view XML configurationcreate_view— Create a viewreconfig_view— Update view configurationdelete_view— Delete a viewview_exists— Check if a view exists
Queue (4 tools)
get_queue_info— List queued items with paginationget_queue_item— Get queued item detailswait_for_queue_item— Wait for a queued item to start, return its build numbercancel_queue_item— Cancel a queued build
Plugins (2 tools)
list_plugins— List installed plugins with paginationget_plugin_info— Get plugin details
System (6 tools)
get_server_info— Get Jenkins server infoget_whoami— Get current user infoget_version— Get Jenkins versionquiet_down— Prepare Jenkins for shutdownrun_groovy_script— Execute Groovy scriptcheck_jenkinsfile_syntax— Validate Jenkinsfile syntax
Typical workflow
build_job → queue_id
wait_for_queue_item → build_number
wait_for_build → result
get_failed_stage_log (or search_build_console for a specific pattern)
Pagination
List tools support server-side pagination with offset and limit parameters:
Use list_jobs with offset=0, limit=10 to get the first 10 jobs
Console output supports byte-based pagination, capped at 100 KB per call:
Use get_build_console_output with offset=0, limit=5000 to read the first 5KB
Build logs routinely reach hundreds of megabytes. Don't scan them with offsets — search them:
Use search_build_console with pattern='ERROR|Traceback|FAILED' to find failures
Each match reports a byte_offset; pass it to get_build_console_output as
offset and the output starts exactly at the matched line. All offsets
(byte_offset, offset, next_offset, from_offset) are byte positions in the
text the tools return, not in Jenkins' raw log.
The search stops once it has max_matches matches (default 50) and their context,
so total_matches means "at least this many" unless scanned_all is true. Pass count_all=true to read the whole log for an exact count. For the
next batch, pass the result's next_offset as from_offset: paging that way
returns every match exactly once, with absolute line numbers (a running build's
unfinished last line may repeat).
Log cache
The first read of a build's log downloads it from Jenkins and keeps an exact copy
on disk, so later searches and reads of that build — also in later sessions — read
the local copy instead of downloading it again. A log is downloaded only as far as
a call needs (a search stops at its matches); a later call resumes from where the
last download stopped. A running build's copy is extended with only what was added.
Parallel calls in one session share one download per build. Word searches
(error|FAILED|traceback) use a fast substring path. Design:
docs/superpowers/specs/2026-11-29-log-reading-design.md.
- Location:
$XDG_CACHE_HOME/mcp-jenkins-client/logs/, default~/.cache/mcp-jenkins-client/logs/. - The cache stores build log text on disk. The directory is made private to your
user (mode
0700), and the cache turns itself off if someone else owns it. On Windows there is no such check, so no privacy promise. JENKINS_LOG_CACHE_MBcaps its size (default1024); the least recently read copies go first, and copies unread for 7 days are deleted.0turns the cache off: every call then streams the log from Jenkins.- A cache error (such as a full disk) turns the cache off for the rest of the session; a call caught by it mid-download fails once, asking for a retry.
License
MIT — see LICENSE.