jenkins-mcp-server

jenkins-mcp-server

Provides Jenkins integration with Claude Code, enabling job management, build operations, pipeline stages, and log search via 22 tools.

Category
Visit Server

README

@alexsarrell/jenkins-mcp-server v1.3.0

A custom MCP (Model Context Protocol) server for Jenkins integration with Claude Code. Provides 22 tools (20 default + 2 unsafe) for comprehensive Jenkins management including pipeline replay, stage-level logs, structured config reads, parameter introspection, and rich log search.

Why?

The official Jenkins MCP plugin has timeout issues (30s timeouts). This standalone server connects directly to Jenkins REST API via stdio transport and works reliably.

Quick Start

Add to your ~/.claude.json:

{
  "mcpServers": {
    "jenkins": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@alexsarrell/jenkins-mcp-server"],
      "env": {
        "JENKINS_URL": "https://your-jenkins.example.com",
        "JENKINS_USER": "your-username",
        "JENKINS_API_TOKEN": "your-api-token"
      }
    }
  }
}

Restart Claude Code and the jenkins MCP server will be available.

Getting Your API Token

  1. Log in to Jenkins
  2. Click your username (top right) -> Configure
  3. API Token -> Add new Token -> Generate
  4. Copy the token

Environment Variables

Variable Required Description
JENKINS_URL Yes Jenkins server URL
JENKINS_USER Yes Jenkins username
JENKINS_API_TOKEN Yes Jenkins API token
JENKINS_ALLOW_UNSAFE_OPERATIONS No Set to true to enable unsafe tools (replayBuild, updateJobConfig)

Unsafe Operations

By default, tools that can execute arbitrary code or modify job configurations are disabled. This includes:

  • replayBuild — replays a build with arbitrary Groovy/Pipeline script
  • updateJobConfig — overwrites job XML configuration

To enable them, add the env variable to your MCP config:

"env": {
  "JENKINS_URL": "...",
  "JENKINS_USER": "...",
  "JENKINS_API_TOKEN": "...",
  "JENKINS_ALLOW_UNSAFE_OPERATIONS": "true"
}

Tools (20 default + 2 unsafe)

Job Management

  • getJobs - List jobs in a folder with status summary
  • getJob - Job details, parameters, health, branches (for multibranch pipelines)
  • getJobConfig - Get job XML configuration (config.xml)
  • getJobParameters - Structured ParameterSpec[] for the job (types, choices, defaults). Use this before triggerBuild to know what to pass.
  • describeJob - Structured read of config.xml (SCM url/branch, Jenkinsfile path, parameters, cron, retention) without parsing raw XML.
  • previewJobConfig - Generate a config.xml from a structured spec (pipeline / multibranch / folder), optionally diffed against an existing job. Read-only.
  • updateJobConfig - Update job XML configuration

Build Operations

  • triggerBuild - Trigger builds with optional parameters (string or string[] values for multi-value parameters)
  • getBuild - Build details (status, duration, parameters, artifacts, changes); use include to control returned sections
  • getBuildLog - Console output with tail / byte-pagination / grep modes (regex + before/after context)
  • stopBuild - Abort a running build
  • getBuildArtifacts - List build artifacts
  • getBuildTestResults - Test results with failure details

Pipeline

  • getPipelineStages - Stage overview (names, status, duration)
  • getStageLog - Log for a specific pipeline stage
  • getPipelineScript - Get Jenkinsfile content from replay page
  • replayBuild - Replay a build with optional script modifications
  • restartFromStage - Restart pipeline from a specific stage

Discovery & Utilities

  • searchBuildLogs - Grep across build logs (regex, before/after context, onlyResults filter, progressive read)
  • getQueue - View the build queue
  • getQueueItem - Map a queue item ID (returned by triggerBuild) to the build that started, or its current waiting/cancelled state
  • enableDisableJob - Enable or disable a job

Multibranch Pipelines

Job paths use / as separator: folder/pipeline/branch

For branches with slashes in the name, use :: separator:

my-pipeline::feature/my-branch

Multi-value parameters

triggerBuild accepts each parameter value as either a string or a string array. The string form is never split on commas — passing "hello, world" sends one value verbatim. For multi-select / ExtendedChoiceParameter (PT_CHECKBOX) parameters, pass an array:

triggerBuild({ jobPath: "x", parameters: { TAGS: ["alpha", "beta", "gamma"] } });

A legacy splitOnComma: true flag preserves the pre-1.3 behaviour (split string values on commas) — deprecated, will be removed in v2.0.

Log search and grep

Both getBuildLog and searchBuildLogs accept a pattern (with optional regex) and before/after context lines. getBuildLog switches to grep mode when pattern is set; otherwise it returns a tail. searchBuildLogs streams logs via Jenkins' progressive-text API and stops early once maxMatchesPerBuild is reached, and an onlyResults: ["FAILURE"] filter prunes builds before fetching their logs.

Notes

  • Replay uses Jenkins' form-based replay endpoint (not a clean REST API)
  • Restart from Stage requires the Declarative Pipeline plugin
  • Config editing works with raw XML — use getJobConfig (or describeJob for a structured subset) to read, modify, then updateJobConfig. For new configs from a spec, use previewJobConfig then paste into updateJobConfig.
  • Build logs are capped at 100KB per response; use grep mode or pagination for larger logs
  • CSRF crumbs are handled automatically
  • Authentication uses HTTP Basic Auth with user API token

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured