Jenkins MCP Server
# Jenkins MCP Server
š AI-powered Jenkins management via Model Context Protocol. Trigger builds, manage jobs, and monitor CI/CD pipelines through your favorite AI assistant.
## ļæ½ Installation
### Option 1: Global Installation (Recommended)
```bash
npm install -g jenkins-mcp-server
```
### Option 2: Local Installation
```bash
npm install jenkins-mcp-server
```
### Option 3: Use with npx (No Installation)
```bash
npx jenkins-mcp-server
```
## āļø Configuration
Set required environment variables:
```bash
export JENKINS_URL="http://your-jenkins-instance:8080"
export JENKINS_USERNAME="your-username"
export JENKINS_API_TOKEN="your-api-token"
```
### Getting Jenkins API Token
1. Login to Jenkins ā Click your username ā Configure
2. Under "API Token" ā Add new Token ā Generate
3. Copy the token and use it as `JENKINS_API_TOKEN`
## š¤ MCP Client Setup
### GitHub Copilot (VS Code)
Add to `mcp.json`:
```json
{
"servers": {
"jenkins": {
"command": "npx",
"args": ["jenkins-mcp-server"],
"env": {
"JENKINS_URL": "http://your-jenkins-instance:8080",
"JENKINS_USERNAME": "your-username",
"JENKINS_API_TOKEN": "your-api-token"
// "ALLOW_ABSOLUTE_FILE_PARAMS": 1 // for file parameters with absolute paths
}
}
}
}
```
### Claude Desktop
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"jenkins": {
"command": "npx",
"args": ["jenkins-mcp-server"],
"env": {
"JENKINS_URL": "http://your-jenkins-instance:8080",
"JENKINS_USERNAME": "your-username",
"JENKINS_API_TOKEN": "your-api-token",
// "ALLOW_ABSOLUTE_FILE_PARAMS": 1 // for file parameters with absolute paths
}
}
}
}
```
## š ļø Available Tools
Each tool returns a JSON result with `success` plus additional fields. Provide arguments as an object when invoking via an MCP client.
### Build Management
**triggerBuild** ā Start a job build (supports file + regular parameters)
Inputs:
- `jobFullName` (string, required)
- `parameters` (object, optional) ā Key/value map. Any value that is a valid local file path is uploaded as a file parameter.
**File Parameter Security**: By default, only relative file paths are allowed. To enable absolute file paths, set `ALLOW_ABSOLUTE_FILE_PARAMS=1` in your environment variables.
Returns: `{ success, queueId, queueUrl, statusCode, message }`
**stopBuild** ā Stop (or force kill) the running build
Inputs:
- `jobFullName` (string, required)
- `buildNumber` (integer, optional)
Returns: `{ success, action: "stop"|"kill", buildNumber, buildUrl, message }`
**scheduleBuild** ā Schedule a build in the future
Inputs:
- `jobFullName` (string, required)
- `scheduleTime` (string, required) ā e.g. `22:15`, `10:30 PM`, or `2025-12-24 14:30`
- `parameters` (object, optional)
**File Parameter Security**: By default, only relative file paths are allowed. To enable absolute file paths, set `ALLOW_ABSOLUTE_FILE_PARAMS=1` in your environment variables.
Returns: `{ status, queueUrl }`
**updateBuild** ā Update build description (display name not supported via REST)
Inputs:
- `jobFullName` (string, required)
- `buildNumber` (integer, optional)
- `description` (string, optional)
- `displayName` (string, optional, ignored)
Returns: `{ success, buildNumber, updates: [ { field, success, ... } ] }`
### Job Information
**getJob** ā Job metadata
Inputs: `jobFullName` (string, required)
**getBuild** ā Build details (specific or last)
Inputs:
- `jobFullName` (string, required)
- `buildNumber` (integer, optional)
**getJobs** ā Paginated job list
Inputs:
- `parentFullName` (string, optional)
- `skip` (integer, optional, default 0)
- `limit` (integer, optional, default 10, max 10)
### System Monitoring
**whoAmI** ā Current authenticated user
Inputs: none
**getStatus** ā Jenkins instance status / health
Inputs: none
### Artifact Management
**listBuildArtifacts** ā List artifacts for build
Inputs:
- `jobFullName` (string, required)
- `buildNumber` (integer, optional)
**readBuildArtifact** ā Read artifact content (text or base64)
Inputs:
- `jobFullName` (string, required)
- `artifactPath` (string, required)
- `buildNumber` (integer, optional)
- `format` (string, optional: `text` | `base64`)
### Queue Operations
**cancelQueuedBuild** ā Cancel queued item(s)
Inputs:
- `jobFullName` (string, required)
- `queueId` (integer, optional)
**getQueueInfo** ā List queued builds (optionally filtered)
Inputs:
- `jobFullName` (string, optional)
Tip: Ask your AI assistant: "Trigger a build for job X with BRANCH=main" or "List artifacts for latest job X build".
## ā” Usage
After configuration, ask your AI assistant:
- "Check my Jenkins server status"
- "Trigger a build for my-app"
- "Show me the latest build information"
- "List all Jenkins jobs"
## š License
MIT License - see [LICENSE](LICENSE) file for details.
---
TDQS
Scored across 14 tools
Most tools have distinct purposes targeting specific Jenkins resources like builds, jobs, queue, artifacts, and system status. However, getBuild and getJob could potentially be confused if an agent isn't clear about the difference between a build (execution instance) and a job (configuration template), though their descriptions help clarify this distinction.
Tool names follow a highly consistent verb_noun pattern throughout, using clear action verbs like get, list, cancel, trigger, update, read, and schedule paired with specific nouns. All names use camelCase consistently without any mixing of conventions, making them predictable and readable.
With 14 tools, this server is well-scoped for Jenkins automation, covering core operations like job management, build control, queue monitoring, artifact handling, and system status. Each tool earns its place by addressing a specific aspect of Jenkins interaction without being overly bloated or too sparse.
The toolset provides comprehensive coverage for Jenkins operations, including job listing/inspection, build triggering/stopping/canceling/updating, queue management, artifact access, and system/user info. A minor gap exists in job lifecycle management (e.g., create/update/delete job operations), but agents can still accomplish most workflows with the available tools.