jenkins-mcp-server
Provides Jenkins integration with Claude Code, enabling job management, build operations, pipeline stages, and log search via 22 tools.
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
- Log in to Jenkins
- Click your username (top right) -> Configure
- API Token -> Add new Token -> Generate
- 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 beforetriggerBuildto 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.xmlfrom 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
includeto 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,
onlyResultsfilter, 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(ordescribeJobfor a structured subset) to read, modify, thenupdateJobConfig. For new configs from a spec, usepreviewJobConfigthen paste intoupdateJobConfig. - 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。