Jenkins Server MCP
README.md
# Jenkins Server MCP
A Model Context Protocol (MCP) server that provides tools for interacting with Jenkins CI/CD servers (including CloudBees CI). This server enables AI assistants to check build statuses, trigger builds, stop builds, and retrieve build logs through a standardized interface.
## Features
- ✅ **Get Build Status** - Retrieve detailed build information including build number, status, timing, and results
- ✅ **Trigger Builds** - Start builds with or without parameters (automatically detects build type)
- ✅ **Stop Builds** - Stop currently running builds
- ✅ **List Builds** - Get a list of recent builds for any job
- ✅ **Get Build Logs** - Retrieve console output from builds
- ✅ **CloudBees CI Support** - Works with both standard Jenkins and CloudBees CI
## Installation
1. **Clone this repository:**
```bash
git clone https://github.com/grysonbaltazar/jenkins-server-mcp.git
cd jenkins-server-mcp
```
2. **Install dependencies:**
```bash
npm install
```
3. **Build the project:**
```bash
npm run build
```
The built server will be available at `build/index.js`.
## Configuration
The server requires the following environment variables:
- `JENKINS_URL`: The URL of your Jenkins server (e.g., `https://jenkins.example.com`)
- `JENKINS_USER`: Jenkins username for authentication
- `JENKINS_TOKEN`: Jenkins API token for authentication
### Getting Your Jenkins API Token
1. Log in to your Jenkins server
2. Click your username in the top-right corner
3. Click "Configure" (or go to User → Configure)
4. Scroll down to the "API Token" section
5. Click "Add new token" or "Generate"
6. Give it a name (e.g., "mcp-server")
7. Click "Generate" and **copy the token immediately** (it won't be shown again)
### For Cursor IDE
Edit `~/.cursor/mcp_config.json` (create it if it doesn't exist):
```json
{
"mcpServers": {
"jenkins-server": {
"command": "node",
"args": ["/path/to/jenkins-server-mcp/build/index.js"],
"env": {
"JENKINS_URL": "https://your-jenkins-server.com",
"JENKINS_USER": "your-username",
"JENKINS_TOKEN": "your-api-token"
}
}
}
}
```
**After saving the config file, restart Cursor for changes to take effect.**
### For Claude Desktop
**MacOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows:** `%APPDATA%/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"jenkins-server": {
"command": "node",
"args": ["/path/to/jenkins-server-mcp/build/index.js"],
"env": {
"JENKINS_URL": "https://your-jenkins-server.com",
"JENKINS_USER": "your-username",
"JENKINS_TOKEN": "your-api-token"
}
}
}
}
```
**After saving the config file, restart Claude Desktop for changes to take effect.**
## Tools and Usage
Once configured, you can use the Jenkins tools in your AI assistant:
### 1. Get Build Status
Get detailed status information about a Jenkins build, including build number, status, result, timing, and more.
### 2. Trigger Build
Trigger a new Jenkins build. Supports both parameterized and non-parameterized builds.
### 3. Stop Build
Stop a currently running Jenkins build.
### 4. List Builds
List recent builds for a Jenkins job.
### 5. Get Build Log
Retrieve the console output of a Jenkins build.
## Development
### Building
```bash
npm run build
```
### Development with auto-rebuild
```bash
npm run watch
```
### Debugging
Since MCP servers communicate over stdio, you can use the MCP Inspector for debugging:
```bash
npm run inspector
```
This will provide a URL to access debugging tools in your browser.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
TDQS
A3.5/5.0
Scored across 5 tools
Disambiguation5/5
Each tool has a clearly distinct purpose: status retrieval, triggering, stopping, listing, and log retrieval. There is little risk of confusing one action for another.
Naming Consistency5/5
All tools follow a consistent snake_case verb_noun pattern: get_build_status, trigger_build, stop_build, list_builds, get_build_log. The convention is predictable throughout.
Tool Count5/5
Five tools are well-scoped for a Jenkins build-operation server. Each tool earns its place and covers a distinct part of the build lifecycle without bloat.
Completeness4/5
The core build lifecycle is covered: list builds, trigger, stop, check status, and retrieve logs. Minor gaps remain around job discovery and job-level metadata, but agents can work around them if job names are known.
Maintenance
ActivityInactive
ResponsivenessNo recent community issues