home / mcp / jenkins mcp server

Jenkins MCP Server

Provides tools to check Jenkins build status, trigger builds, and fetch build logs via MCP

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hekmon8-jenkins-server-mcp": {
      "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"
      }
    }
  }
}

You can interact with a Jenkins CI/CD server through a dedicated MCP (Model Context Protocol) server. This MCP exposes tools to check build statuses, trigger builds, and retrieve build logs in a standardized way, making it easy to integrate Jenkins automation into AI assistants and workflow automations.

How to use

Use an MCP client to connect to the Jenkins MCP server and call its built-in tools. You can check the current status of a Jenkins job, trigger new builds with parameters, and retrieve the console output for debugging. Each action is exposed as a tool you can invoke through the MCP interface, using the job path and optional build identifiers or parameters to tailor the operation.

How to install

# Prerequisites
- Ensure you have Node.js and npm installed. You can verify with:
  node -v
  npm -v

# 1. Clone the repository
git clone https://github.com/hekmon8/jenkins-server-mcp.git
cd jenkins-server-mcp

# 2. Install dependencies
npm install

# 3. Build the project
npm run build

Configuration

Configure the Jenkins MCP server by setting environment variables for Jenkins access. The MCP server expects the Jenkins URL, username, and API token so it can perform actions on your Jenkins instance.

{
  "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"
      }
    }
  }
}

Security and access

Protect your Jenkins credentials. Use a dedicated Jenkins account with scoped permissions and store the API token securely. Limit the MCP server’s access to only the necessary Jenkins projects and jobs.

Troubleshooting and notes

If you encounter connectivity or authentication issues, verify that the Jenkins URL is reachable from the MCP host and that the provided credentials have the required permissions. Check that the MCP server process has access to the build script at the specified path and that the build tool can reach your Jenkins instance.

Development

npm run watch
```

```bash
npm run inspector
`

Available tools

get_build_status

Retrieves the status of a specific Jenkins build given a job path and optional build number or lastBuild placeholder.

trigger_build

Triggers a new Jenkins build for a given job path with optional build parameters (e.g., BRANCH, BUILD_TYPE).

get_build_log

Fetches the console output for a specified Jenkins build, with support for lastBuild or a specific build number.