Jenkins MCP
MCP server for managing multiple Jenkins instances via REST API, supporting job/build queries, triggering builds, and logs with optional read-only mode.
README
Jenkins MCP
一个基于 Jenkins REST API 的 MCP Server,目标是兼容 Jenkins 2.332.2、2.356 以及后续版本。
它不安装 Jenkins 插件,因此不会受到官方 mcp-server 插件最低 Jenkins 核心版本的限制。一个 MCP Server 可以在配置中同时管理多个 Jenkins 实例,并通过 jenkins_name 选择目标实例。
已实现能力
- 查询 Jenkins 版本和兼容能力
- 查询当前认证用户
- 查询根目录或 Folder 下的 Job
- 查询 Job 和 Build
- 获取构建日志,并限制返回行数
- 查询 Queue、Queue Item 和节点
- 触发构建、停止构建、取消排队构建
- 用户名 + API Token 认证
- 自动获取和重试 Jenkins CSRF Crumb
- 默认只读,写操作需要显式设置
read_only: false
安装
建议使用 Python 3.10 或更高版本:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
多 Jenkins 配置
创建 jenkins-mcp.json:
{
"instances": [
{
"name": "jenkins-233",
"base_url": "https://jenkins-233.example.com",
"username": "mcp-user",
"api_token": "replace-me",
"read_only": true,
"verify_ssl": true,
"timeout_seconds": 30,
"max_log_lines": 2000
},
{
"name": "jenkins-356",
"base_url": "https://jenkins-356.example.com/jenkins",
"username": "mcp-user",
"api_token": "replace-me",
"read_only": false
}
],
"server": {
"transport": "stdio",
"log_level": "INFO"
}
}
启动:
jenkins-mcp --config jenkins-mcp.json
生产环境建议通过环境变量或密钥管理系统注入配置,不要把 API Token 提交到 Git。
单 Jenkins 环境变量配置
也可以使用以下变量:
export JENKINS_URL='https://jenkins.example.com'
export JENKINS_USERNAME='mcp-user'
export JENKINS_API_TOKEN='replace-me'
export JENKINS_READ_ONLY='true'
jenkins-mcp
多实例可以把 JSON 数组放入 JENKINS_INSTANCES_JSON,或者使用 JENKINS_CONFIG_FILE 指向 JSON 配置文件。
MCP 客户端配置
stdio 示例:
{
"mcpServers": {
"jenkins": {
"command": "/absolute/path/to/.venv/bin/jenkins-mcp",
"args": ["--config", "/absolute/path/to/jenkins-mcp.json"]
}
}
}
工具调用时使用 jenkins_name,例如:
list_jobs(jenkins_name="jenkins-233")
get_build_log(jenkins_name="jenkins-356", job_name="team/app", build_number=123)
版本兼容策略
服务通过 Jenkins 的 X-Jenkins 响应头检测版本。2.332.2 是当前最低兼容基线,2.356 使用相同的基础 REST API 能力。版本相关差异放在 versioning.py 的能力模型中,MCP 工具层不直接写版本判断。
基础 REST API 比 Jenkins 插件 API 更适合跨版本使用,但插件特有功能、Pipeline 高级信息和凭据管理不作为当前跨版本保证的一部分。
开发
pytest
ruff check .
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.