MCPInstall
jenkins-mcp-server logo

jenkins-mcp-server

by LokiMCPUniverse 4 stars LokiMCPUniverse/jenkins-mcp-server

MCP server for Jenkins CI/CD - Intelligent automation server integration for GenAI

READMEmain

Jenkins MCP Server

A Model Context Protocol (MCP) server that exposes a Jenkins controller's REST API to MCP-compatible clients such as Claude Desktop. Built on the MCP Python SDK (1.27+, protocol 2025-11-25) using FastMCP with httpx for async HTTP and pydantic-settings for configuration.

Features

  • HTTP basic authentication using a Jenkins username + API token
  • Automatic CSRF crumb fetch and cache for POST requests
  • Works with nested folder job paths (team/app/main)
  • Tools for jobs, builds, console logs, queue, nodes and plugins

Installation

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Configuration

All configuration is read from environment variables prefixed with JENKINS_.

VariableDefaultDescription
JENKINS_BASE_URLhttp://localhost:8080Base URL of the Jenkins controller
JENKINS_USERNAME(empty)Jenkins user for HTTP basic auth
JENKINS_API_TOKEN(empty)Jenkins API token (create in user settings)
JENKINS_VERIFY_SSLtrueVerify TLS certificates
JENKINS_TIMEOUT30HTTP timeout in seconds

A .env file in the working directory is also picked up automatically.

Running

jenkins-mcp

Claude Desktop configuration

Add an entry to claude_desktop_config.json:

{
  "mcpServers": {
    "jenkins": {
      "command": "jenkins-mcp",
      "env": {
        "JENKINS_BASE_URL": "https://jenkins.example.com",
        "JENKINS_USERNAME": "your-username",
        "JENKINS_API_TOKEN": "your-api-token"
      }
    }
  }
}

Tools

ToolDescription
list_jobsList jobs (optionally scoped to a folder)
get_jobReturn full job metadata
trigger_buildTrigger a build, optionally with parameters
get_buildReturn metadata for a specific build
get_build_logFetch the console text for a build
stop_buildStop a running build
list_buildsList recent builds (limit defaults to 20)
list_queueList queued build items
cancel_queue_itemCancel a queue item by id
list_nodesList Jenkins nodes / agents
get_plugin_listList installed Jenkins plugins

Development

Run tests with:

pytest -x --tb=short

Lint with:

ruff check src tests