Jenkins Investigator MCP Server
Enables AI assistants to investigate and debug Jenkins CI jobs by fetching build info, stages, error logs, test failures, SCM changes, parameters, trends, node health, queue details, and job configs, with bundles for failure triage and flakiness analysis.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Jenkins Investigator MCP Server
A Model Context Protocol server that helps AI assistants debug failing Jenkins CI jobs efficiently — without blowing through a context window.
Note: This codebase was generated with AI assistance (Claude/Cursor) and reviewed, tested, and validated by humans.
How It Works
Raw Jenkins API responses are enormous. This server acts as a filter: it fetches the verbose data, strips the noise, and returns only what matters — error snippets, commit messages, failing tests.
Related MCP server: Jenkins MCP Server
Tools
Bundles — Start Here
Bundles combine multiple API calls into a single tool invocation, saving tokens and latency.
Bundle | What It Does |
| Primary entry point. Returns build info, stages, errors, tests, commits, params, and trend in one call. |
| Diffs the last failing vs last passing build: parameter changes, agent, trigger, cumulative commits. |
| Traces each failing test back through recent builds to find the regression point and suspect commit. Enriches with JUnit XML artifacts when available (failure classification, blast-radius detection, extended stdout/stderr). |
| Scores flakiness and clusters failures by node, stage, and time of day. |
| Checks node health and per-node failure correlation to determine if a failure is infra-related. |
| Searches console logs across all jobs in a folder for a specific error pattern. Concurrent, with status filtering and early termination. |
| Scans a folder for broken jobs with consecutive-failure counts — a team health dashboard. |
Individual Tools
Use these for targeted follow-up after a bundle gives you the big picture.
Tool | When to Use |
| Discover the latest (or latest failed) build number from a job name. |
| Browse jobs in a Jenkins folder. |
| Quick build overview: status, runtime, agent, trigger. |
| Stage table with status and duration. |
| See build parameters (branch, env, flags). |
| Recent build results with trend analysis. |
| Commits in this build (Git, SVN, Mercurial). |
| Prioritized error extract from the console log (≤250 lines). |
| Error extract from a specific pipeline stage's log. |
| Grep the console log for a string or regex with context lines. |
| Failing tests with error messages and stack traces. |
| List artifacts or fetch a specific artifact's content. |
| Parsed job config: SCM, triggers, agent label, pipeline definition. |
| CI-relevant environment variables (requires EnvInject plugin). |
| Build queue with reasons why builds are waiting. |
| Diff any two builds (params, agent, trigger, commits). |
| Upstream trigger chain for a build. |
| Agent online status and disk space. |
| All agents with labels, executors, and disk space. |
| Parallel branches and step-level detail inside a stage. |
Setup
1. Install dependencies
pip install uv
uv pip install -e .Or with plain pip:
pip install fastmcp>=3.0.0 requests>=2.31 pydantic>=2.0 python-dotenv>=1.02. Configure credentials
cp .env.example .envEdit .env:
JENKINS_URL=http://your-jenkins:8080
JENKINS_USER=your-username
JENKINS_TOKEN=your-api-tokenYour API token can be generated from Jenkins → your user → Configure → API Token.
3. Run the server
python server.pyBy default the server starts with Streamable HTTP transport on 0.0.0.0:8000. You'll see the local and network URLs printed on startup.
4. Connect from Cursor / Claude Desktop
HTTP transport (default):
{
"mcpServers": {
"jenkins-investigator": {
"url": "http://192.168.1.42:8000/mcp"
}
}
}Replace the IP with the Network URL printed at server startup.
Stdio transport (set MCP_TRANSPORT=stdio in .env):
{
"mcpServers": {
"jenkins-investigator": {
"command": "python",
"args": ["/absolute/path/to/jenkins-mcp/server.py"],
"env": {
"MCP_TRANSPORT": "stdio",
"JENKINS_URL": "http://your-jenkins:8080",
"JENKINS_USER": "your-username",
"JENKINS_TOKEN": "your-api-token"
}
}
}
}Job Names
For simple jobs, use the job name directly: my-job.
For jobs inside folders or multibranch pipelines, use slash-separated paths:
my-org/my-repo/mainThe server automatically converts this to the correct Jenkins API path (/job/my-org/job/my-repo/job/main/).
Configuration
Environment Variables
Variable | Required | Default | Description |
| Yes | — | Base URL of your Jenkins instance |
| No* | — | Jenkins username (fallback when no per-request headers) |
| No* | — | Jenkins API token (fallback when no per-request headers) |
| No |
| Set to |
| No | — | Path to CA certificate file for corporate/internal CAs |
| No |
| Transport protocol: |
| No |
| Bind address for HTTP transport |
| No |
| Port for HTTP transport |
| No |
| Delay between tool calls to avoid hitting AI provider TPM limits |
*Required when not using per-request authentication headers.
Per-User Authentication (HTTP Headers)
When deployed as a shared server, each user supplies their own Jenkins credentials via HTTP headers in their Cursor MCP config:
Header | Description |
| Jenkins username |
| Jenkins API token |
Per-request headers take priority over server-wide JENKINS_USER / JENKINS_TOKEN env vars.
Documentation
See Architecture for system design, layer responsibilities, and resilience strategy.
See Tool Flow for decision trees, bundle internals, and per-tool quick reference.
Project Structure
jenkins-mcp/
├── server.py # FastMCP server — 20 individual tools + 7 bundles
├── utils/
│ ├── __init__.py
│ ├── jenkins_api.py # Jenkins REST wrappers with retry/backoff
│ ├── junit_parser.py# JUnit XML parser (assertion vs exception classification, blast radius)
│ ├── log_parser.py # Priority-budgeted error extraction
│ └── scm.py # changeSet/changeSets normalization across SCMs
├── docs/
│ ├── architecture.md # System design and layer diagrams
│ └── tool-flow.md # Decision trees and bundle internals
├── tests/ # pytest suite (162 tests)
├── .env # Your credentials (gitignored)
├── .env.example # Template
├── .gitignore
└── pyproject.tomlOpenShift Deployment
Prerequisites
ocCLI logged in to your clusterA container registry accessible from the cluster (e.g.
images.paas.redhat.com)The Jenkins CA certificate file (
jenkins-ca.pem)
1. Build and push the image
IMAGE=images.paas.redhat.com/your-org/jenkins-investigator:latest
podman build -t $IMAGE .
podman push $IMAGE2. Create the namespace resources
NAMESPACE=your-namespace
# Create the secret with Jenkins credentials
oc create secret generic jenkins-investigator-credentials \
--from-literal=JENKINS_URL="https://jenkins-csb-ant-main.dno.corp.redhat.com/" \
--from-literal=JENKINS_USER="your-username" \
--from-literal=JENKINS_TOKEN="your-api-token" \
-n $NAMESPACE
# Create the CA certificate ConfigMap
oc create configmap jenkins-investigator-ca \
--from-file=jenkins-ca.pem=/path/to/jenkins-ca.pem \
-n $NAMESPACE3. Deploy
Update IMAGE_REGISTRY/jenkins-investigator:latest in k8s/deployment.yaml to your actual image, then:
oc apply -f k8s/deployment.yaml -n $NAMESPACE
oc apply -f k8s/service.yaml -n $NAMESPACE
oc apply -f k8s/route.yaml -n $NAMESPACE4. Connect from Cursor (per-user setup)
Get the route URL:
oc get route jenkins-investigator -n $NAMESPACE -o jsonpath='{.spec.host}'Each user adds this to their ~/.cursor/mcp.json, using their own Jenkins API token:
{
"mcpServers": {
"jenkins-investigator": {
"url": "https://<route-host>/mcp",
"headers": {
"X-Jenkins-User": "your-jenkins-username",
"X-Jenkins-Token": "your-jenkins-api-token"
}
}
}
}To generate a Jenkins API token: Jenkins → your profile (top right) → Configure → API Token → Add new Token.
Without headers: If
JENKINS_USERandJENKINS_TOKENare set in the server Secret, requests without headers will fall back to those credentials. If neither headers nor env vars are set, the server returns an error.
Manifest Reference
File | Purpose |
| Template for Jenkins credentials (use |
| Template for Jenkins CA certificate |
| Deployment with cert mount and health checks |
| ClusterIP service on port 8000 |
| OpenShift route with TLS edge termination |
Security
Credentials are read from environment variables only — never hardcoded.
The server is read-only: no tools delete jobs, wipe workspaces, or trigger builds.
The
.envfile is gitignored by default.Console logs are capped at 10 MB to prevent memory exhaustion on large builds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Triage failing GitHub Actions jobs and see what self-heal repaired, in natural language.
Direct access to Cypress tests results and accessibility reports in your AI workflow.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Structured knowledge base for AI agent solutions. Search, explore, and retrieve build logs.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Jenkins CI/CD systems through natural language, providing build management, job monitoring, log analysis, and debugging capabilities.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Jenkins CI/CD systems for build management, job monitoring, console log analysis, and debugging through natural language commands.2MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to securely interact with Jenkins through its API, exposing tools for inspecting items, nodes, views, queues, and builds, reading console output, test reports, and artifacts, managing plugins, and triggering, stopping, or approving pipeline builds, including executing Groovy scripts. Supports stdio, SSE, and streamable-HTTP transports with configurable authentication, SSL verification, and a read-only mode.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Jenkins through secure, contextual tools for querying and managing jobs, builds, nodes, queues, views, plugins, artifacts, and Groovy scripts, with configurable authentication and read-only safety.-