
jenkins-mcp
Jenkins for AI agents: diagnose, watch, trigger.
Ask Claude "why did the last master build fail?" and get the failing stage and step, the error lines, failed tests and the commits in that build, in one call.
Install · Tools · Watching builds · Release
Table of Contents
-
About The Project
- Project Structure
-
Getting Started
- Usage
- Tools
- Watching Builds
- Development
- Roadmap
- Contact
📖 About The Project
jenkins-mcp is a Rust MCP server plus a Claude skill (jenkins-mcp), shipped together as a Claude Code plugin. It is the Rust port of the jk Go CLI, phase 1: the shared core and the MCP server. A CLI on the same core comes later.
🧩 The Problem
Finding out why a pipeline failed means opening Blue Ocean or the stage view, finding the red stage, opening the right step, and scrolling a long console log. Following a build you just started means refreshing the page. An agent with raw API access does the same thing with more calls: it downloads whole logs, polls in a loop, and nothing stops it from triggering or stopping jobs it should not touch.
🧭 The Approach
- One call to diagnose.
build_diagnose returns the first failing stage and step, the end of that step's log with error highlights, failed tests and SCM changes.
- The server watches, not the model.
build_watch polls Jenkins itself, sends MCP progress, and returns as soon as a stage fails, even while the build still runs, with the diagnosis inside.
- Tiers.
JENKINS_TIER=read (default) registers only read tools; write adds build_trigger; danger adds build_stop. Tools above the tier do not exist for the model.
- Human confirmation.
build_stop asks the person through an MCP elicitation dialog, and fails closed. The model cannot approve its own stop.
- Scoped.
JENKINS_ALLOWED_JOBS takes globs with ! denies, checked before any request is sent.
- Small output. ANSI codes and timestamps are stripped; every result is capped at 64 KiB.
- No ports, no daemon. Claude Code starts the server as a child process over stdio. Settings come from environment variables only; the token never appears in output or logs.
🏗️ Architecture
flowchart LR
U([You]) -->|question| C[Claude Code]
S["skill: jenkins-mcp<br/>which tool, in which order,<br/>how to follow a build"] -.->|guides| C
C <-->|"JSON-RPC over stdio<br/>progress · elicitation"| M["jenkins-mcp<br/>rmcp 3.x, 11 tools"]
M -->|calls| K["jenkins-core<br/>config · tier + job guard ·<br/>stages · logs · watch"]
K -->|"HTTPS + Basic auth (API token)"| J[(Jenkins REST,<br/>Pipeline Graph View)]
A build_trigger followed by build_watch runs through these steps: