Jenkins MCP Server
Enables interaction with Jenkins to manage jobs, trigger builds with parameters, and monitor build queues. It provides comprehensive access to build histories, console logs, and organizational folder structures via the Jenkins REST API.
README
Jenkins MCP Server
A Model Context Protocol (MCP) server that enables Claude to interact with Jenkins through various automation tools. This server provides comprehensive Jenkins management capabilities including job monitoring, build control, and queue management.
Features
- Job Management: List jobs, get job configurations, and monitor job status
- Build Control: Trigger builds with parameters, stop running builds, and check build status
- Build History: Retrieve build history and detailed build information
- Console Logs: Access build console output for debugging
- Queue Management: Monitor Jenkins build queue and stuck builds
- Folder Support: Navigate Jenkins folders and organizational structures
Installation
- Clone the repository:
git clone https://github.com/ddang-jung/jenkins-mcp-server.git
cd jenkins-mcp-server
- Install dependencies:
npm install
- Build the project:
npm run build
Configuration
Environment Variables
Set the following environment variables for Jenkins authentication:
JENKINS_URL: Your Jenkins server URL (e.g.,http://localhost:8080)JENKINS_USER: Your Jenkins usernameJENKINS_TOKEN: Your Jenkins API token (recommended) or password
Getting Jenkins API Token
- Log into Jenkins
- Go to Manage Jenkins → Manage Users → Click your username
- Click Configure → API Token → Add new Token
- Copy the generated token
Git Configuration
The project includes a comprehensive .gitignore file that excludes:
- Build artifacts (
build/,dist/) - Dependencies (
node_modules/) - Environment variables (
.env*) - Jenkins credentials and configuration files
- IDE files (
.vscode/,.idea/) - System files (
.DS_Store,Thumbs.db)
Important: Never commit Jenkins credentials or API tokens to version control.
Claude Desktop Configuration
Add this configuration to your claude_desktop_config.json:
{
"mcpServers": {
"jenkins": {
"command": "node",
"args": ["/path/to/jenkins-mcp-server/build/index.js"],
"env": {
"JENKINS_URL": "http://your-jenkins-server:8080",
"JENKINS_USER": "your-username",
"JENKINS_TOKEN": "your-api-token"
}
}
}
}
Usage
Starting the Server
npm start
The server runs on stdio and communicates with Claude through the MCP protocol.
Development Mode
For development with auto-rebuild:
npm run watch
For debugging with MCP Inspector:
npm run inspector
Available Tools
1. get_build_status
Get the status of a specific Jenkins build.
Parameters:
jobPath(required): Path to the Jenkins job (e.g., "job/MyProject/job/main")buildNumber(optional): Build number or "lastBuild" for most recent
Example:
{
"jobPath": "job/MyProject",
"buildNumber": "lastBuild"
}
2. trigger_build
Trigger a new Jenkins build with optional parameters.
Parameters:
jobPath(required): Path to the Jenkins jobparameters(optional): Build parameters as key-value pairs
Example:
{
"jobPath": "job/MyProject",
"parameters": {
"BRANCH": "main",
"DEPLOY_ENV": "staging"
}
}
3. get_build_log
Retrieve the console output of a specific build.
Parameters:
jobPath(required): Path to the Jenkins jobbuildNumber(required): Build number or "lastBuild"
4. list_jobs
List all Jenkins jobs in a folder or at root level.
Parameters:
folderPath(optional): Path to folder (e.g., "job/MyFolder") or empty for root
5. get_build_history
Get build history for a specific Jenkins job.
Parameters:
jobPath(required): Path to the Jenkins joblimit(optional): Number of recent builds to retrieve (default: 10)
6. stop_build
Stop a running Jenkins build.
Parameters:
jobPath(required): Path to the Jenkins jobbuildNumber(required): Build number or "lastBuild"
7. get_queue
Get the current Jenkins build queue status.
Parameters: None
8. get_job_config
Get the configuration details of a Jenkins job.
Parameters:
jobPath(required): Path to the Jenkins job
Job Path Format
Jenkins job paths follow this format:
- Root level job:
job/JobName - Folder job:
job/FolderName/job/JobName - Multi-level:
job/Folder1/job/Folder2/job/JobName
Error Handling
The server provides comprehensive error handling:
- Authentication errors: Check your Jenkins credentials
- Job not found: Verify the job path format
- Permission errors: Ensure your Jenkins user has appropriate permissions
- Network errors: Check Jenkins server connectivity
Development
Project Structure
jenkins-mcp-server/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript output
├── package.json # Project configuration
├── tsconfig.json # TypeScript configuration
├── .gitignore # Git ignore rules
└── README.md # This file
Scripts
npm run build: Compile TypeScript to JavaScriptnpm run watch: Watch for changes and rebuildnpm run inspector: Start MCP Inspector for debuggingnpm run prepare: Prepare build (runs automatically)npm run clean: Clean build artifacts and dependencies (macOS/Linux)npm run clean:win: Clean build artifacts and dependencies (Windows)
Cleaning Project
To reset the project to its initial state (remove build artifacts and dependencies):
macOS/Linux:
npm run clean
# or manually:
rm -rf node_modules build package-lock.json
Windows:
npm run clean:win
# or manually:
rmdir /s /q node_modules & rmdir /s /q build & del package-lock.json
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
License
This project is licensed under the MIT License.
Troubleshooting
Common Issues
- "Jenkins API error": Check your Jenkins URL and credentials
- "Job not found": Verify the job path format (use
job/prefix) - "Permission denied": Ensure your Jenkins user has required permissions
- "Connection refused": Check if Jenkins server is running and accessible
Debug Mode
Enable debug logging by setting:
export DEBUG=jenkins-mcp-server
For more information, visit the Jenkins REST API documentation.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。