@znmin/jenkins-mcp-server
Connects to an existing Jenkins instance to query and manage jobs (list, get, query, read/update job config, trigger builds), inspect and control builds (status, running builds, test reports, stop builds), read and search console logs, manage nodes and their configurations, and view/cancel queue items. It also supports Pipeline Replay, allowing retrieval of a build's main and loaded scripts and re-submitting edited scripts to schedule a new build.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@znmin/jenkins-mcp-server show the console tail for the latest failed build of my-app"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@znmin/jenkins-mcp-server
通过 npx 启动的 Jenkins MCP,支持任务查询、构建、日志、队列、节点配置及 Pipeline Replay。
直接连接现有 Jenkins,不需要安装 Jenkins MCP Server 插件或升级 Jenkins 核心。
基于 MIT 许可的 mcpland/jenkins-mcp 维护,版权声明保留在 LICENSE / THIRD_PARTY_NOTICES.md。
安装与启动
需要 Node.js 20.19 或更新版本,推荐当前 Node.js LTS。MCP 客户端使用 stdio:
{
"mcpServers": {
"jenkins": {
"command": "npx",
"args": ["-y", "@znmin/jenkins-mcp-server@1.0.0"],
"env": {
"JENKINS_URL": "http://jenkins.example.internal",
"JENKINS_USERNAME": "your-account",
"JENKINS_PASSWORD": "your-password"
}
}
}
}支持密码认证,也支持 API Token:将 JENKINS_PASSWORD 换成 JENKINS_API_TOKEN。
环境变量只需在 MCP 配置中填写一次,AI 每次调用工具时无需再次提供服务器地址和密码。
修改配置后重启 MCP 并刷新工具列表;必要时新建对话。
Related MCP server: MCP Jenkins
全部环境变量
参数 | 必填 | 默认值 | 说明 |
| 是 | 无 | Jenkins 根地址,支持 |
| 是 | 无 | Jenkins 用户名 |
| 二选一 | 无 | 登录密码,也可填 API Token |
| 二选一 | 无 | API Token;同时设置时优先于环境中的密码 |
| 否 |
|
|
| 否 |
| 单次请求等待响应头的超时秒数,必须为正数 |
| 否 |
| 复用连接、crumb 和会话 Cookie |
| 否 |
|
|
兼容原包的 jenkins_url、jenkins_username、jenkins_password、jenkins_verify_ssl、
jenkins_timeout、jenkins_session_singleton、jenkins_read_only 小写变量;同名大写变量优先。
程序不会自动读取 .env 文件。
兼容启动选项:--jenkins-url、--jenkins-username、--jenkins-password、
--jenkins-timeout、--jenkins-verify-ssl、--no-jenkins-verify-ssl、
--jenkins-session-singleton、--no-jenkins-session-singleton、--read-only、
--allow-full-console-output。显式 CLI 值优先。此版本只启动 stdio,不开放 HTTP/SSE 监听端口。
默认开放已实现的读写工具;实际操作仍受 Jenkins 账号权限控制。
Replay
先读取指定构建的原始脚本:
{"fullname":"folder/pipeline-job","number":123}调用工具 get_replay_scripts,返回 mainScript、mainScriptSha256、loadedScripts 和源构建号。
loadedScripts 的键来自 Replay 表单的脚本名称,例如 org.example.Script1。
调用工具 replay_build:
{
"fullname":"folder/pipeline-job",
"number":123,
"mainScript":"node { echo 'updated pipeline' }",
"loadedScripts":{"org.example.Script1":"return 'updated helper'"}
}number 可省略,工具会先解析为确定的最近一次构建号。mainScript 必填,
loadedScripts 可省略;未修改的加载脚本保持原样,名称错误时在提交前拒绝。
内部按照 Jenkins Replay 表单协议发送 json 字段,正确处理点号到下划线的字段映射。
Replay 是对已有运行脚本的重放,不修改任务配置或仓库中的 Jenkinsfile。
此操作会调度真实构建,可能包含部署。Jenkins 接受后通常重定向回任务页面,不返回队列 ID,
所以结果中的 queueId 和 buildNumber 为 null;需要继续查询队列和构建历史来定位新运行。
不猜测下一次构建号,也不把“已接受调度”解释成“构建成功”。
提交遇到超时或异常响应时不会自动重试;请先检查队列和构建历史,避免重复部署。 账号需要任务读取、构建以及 Run/Replay 权限;非沙箱脚本还受 Jenkins 管理员权限和脚本审批规则约束。 仅有 Rebuild 权限、非 Pipeline 任务或不存在可编辑 Replay 表单时,工具会返回错误。 这些限制由 Jenkins 自身执行,此包不会绕过。
工具
类别 | 工具 |
Replay |
|
任务 |
|
构建 |
|
日志 |
|
节点 |
|
队列 |
|
get_build_scripts 保留原包兼容接口。需要完整的主脚本和加载脚本名称时使用 get_replay_scripts。
build_item 的 build_type 为 build 或 buildWithParameters;参数化构建通过 params 提供键值。
fullname 使用实际任务名称和文件夹路径,如 folder/job;普通路径分隔符表示文件夹层级。
日志优先用 tail / search / chunk;这些工具对返回字节数设有上限。
get_build_console_output 默认不注册,只有显式加 --allow-full-console-output 才启用,以免完整大日志占满上下文。
密码认证时自动获取 crumb 并保留同一会话的 Cookie。API Token 也支持;服务没有 crumbIssuer 时兼容其 404 响应。 不会自动跟随认证请求的重定向,也不会把凭据发送到其他域名。
验证范围
自动测试覆盖原包常用能力、Replay 表单读取、加载脚本保留/替换、密码会话 Cookie、crumb、只读模式、异常重定向与不自动重试。
在 Jenkins 2.462.1 实例完成登录、任务列表、Replay 脚本读取及日志读取联调。
未在真实业务任务上提交 Replay 或触发部署;写入路径通过本地 HTTP 模拟服务验证。
无需安装 Jenkins MCP Server 插件。Pipeline Replay 需要现有 Pipeline/Groovy 插件提供 Replay 页面。
开发
npm ci
npm run checkCI 在 Windows / Ubuntu、Node.js 20 / 24 上运行检查。
Available Tools
24 toolsbuild_itemC
Build an item in Jenkins.
Inputs: fullname (required), build_type (required), params.
cancel_queue_itemA
Cancel a specific item in Jenkins queue by id.
Inputs: id (required).
get_all_itemsBRead-only
Get all items from Jenkins.
Inputs: no named parameters.
get_all_nodesBRead-only
Get all nodes from Jenkins.
Inputs: no named parameters.
get_all_queue_itemsARead-only
Get all items in Jenkins queue.
Inputs: no named parameters.
get_buildCRead-only
Get specific build info from Jenkins.
Inputs: fullname (required), number.
get_build_console_chunkBRead-only
Read incremental console output from a specific byte offset.
Inputs: start (required), fullname (required), number, max_bytes.
get_build_console_tailCRead-only
Get the tail of a specific build console output.
Inputs: fullname (required), number, max_bytes.
get_build_failure_excerptBRead-only
Get focused failure excerpts and failing tests via incremental log scanning.
Inputs: fullname (required), number, max_bytes, max_excerpts.
get_build_scriptsCRead-only
Get scripts used in a specific build.
Inputs: fullname (required), number.
get_build_test_reportCRead-only
Get test report of a specific build.
Inputs: fullname (required), number.
get_itemBRead-only
Get specific item from Jenkins.
Inputs: fullname (required).
get_item_configCRead-only
Get specific item config from Jenkins.
Inputs: fullname (required).
get_nodeBRead-only
Get a specific node from Jenkins.
Inputs: name (required).
get_node_configCRead-only
Get node config from Jenkins.
Inputs: name (required).
get_queue_itemARead-only
Get a specific item in Jenkins queue by id.
Inputs: id (required).
get_replay_scriptsARead-only
Read the main and loaded scripts from an existing editable Pipeline Replay form. Does not run a build.
Inputs: fullname (required), number.
get_running_buildsARead-only
Get all running builds from Jenkins.
Inputs: no named parameters.
query_itemsDRead-only
Query items from Jenkins.
Inputs: class_pattern, color_pattern, fullname_pattern.
replay_buildADestructive
Run an existing Pipeline build again using a replacement mainScript and optional loadedScripts. This schedules a real build and can deploy. Read get_replay_scripts first. Never automatically retry after a submitted/uncertain POST.
Inputs: fullname (required), mainScript (required), number, loadedScripts.
search_build_consoleCRead-only
Search build console output incrementally and return matching excerpts.
Inputs: query (required), fullname (required), number, max_bytes, +3 more.
set_item_configC
Set specific item config in Jenkins.
Inputs: fullname (required), config_xml (required).
set_node_configC
Set specific node config in Jenkins.
Inputs: name (required), config_xml (required).
stop_buildC
Stop a specific build.
Inputs: number (required), fullname (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools are clearly separated by resource and action (items, nodes, queue, builds, console output). The main overlap is between get_all_items and query_items, whose boundary is not obvious from the names; get_item/get_item_config are related but distinguishably scoped. The build-console tools overlap somewhat but have distinct offset/search/excerpt purposes.
Tool names consistently use snake_case with a predictable verb_noun pattern such as get_item, set_item_config, build_item, cancel_queue_item, and get_build_console_tail. Resource-specific plurals are used sensibly (get_all_nodes, get_all_queue_items). The one deviation, query_items, still fits the overall naming style.
At 24 tools the surface is on the heavy side, but Jenkins is broad enough to justify separate item, node, queue, build, and console-log operations. The multiple console-reading tools are specialized rather than redundant. It is slightly over-scoped but still reasonable for the domain.
The server covers core Jenkins workflows: inspecting items, changing configs, triggering builds, monitoring queue and running builds, reading logs/tests, and stopping builds. Gaps remain around job creation/deletion, credential handling, and some administrative lifecycle operations, but most day-to-day build and inspection workflows are covered.
Maintenance
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Develop, manage, and debug Railway projects, services, and deployments from within agents.
Termalin's hosted MCP server. Claude, ChatGPT or any MCP client runs commands, moves files over SFTP, queries databases and reads server metrics and monitoring alerts on your servers, keylessly through Termalin Connectors: no SSH key is handed over and no inbound port is opened. Per-host command policy and an audit log. Needs a termal.in Pro or Team account (new accounts start with a 14-day Pro trial).
Read a project's prompts, logs and agents, and send new work to the agent on your own machines.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI assistants to inspect and operate a Jenkins instance — discovering jobs, views, nodes, and plugins; reviewing build chains, parameters, last-build status, console output, test reports, and artifacts; and triggering builds, stopping runs, or answering pipeline inputs. It connects over stdio, SSE, or streamable HTTP with optional credentials, read-only mode, and a credential-free health endpoint.311MIT
- 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 models to securely inspect and operate Jenkins through tools for jobs, builds, queue items, nodes, views, plugins, artifacts, pipeline inputs, and Groovy script execution. Supports stdio, SSE, and streamable-HTTP transports with configurable authentication and a read-only mode.-
- FlicenseNot gradedqualityAmaintenanceEnables AI language models to interact with Jenkins through the Model Context Protocol, supporting secure authentication and optional read-only mode. It exposes tools for inspecting and building jobs, nodes, queues, views, plugins, builds and artifacts, retrieving console output and test reports, and executing Groovy scripts.-