KJ

kjozsa/jenkins-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 11 forks 质量 61 趋势 18Apache-2.0

MCP server for managing Jenkins operations.

概览

MCP server for managing Jenkins operations. To install Jenkins MCP for Claude Desktop automatically via Smithery: Add the MCP server using the following JSON configuration snippet: Jenkins implements CSRF protection using "crumbs" - tokens that must be included with POST requests. This MCP server handles CSRF crumbs in two ways: 1. : Automatically fetches and includes CSRF crumbs with build requests - Uses session cookies to maintain the web session - Handles all the CSRF protection behind the scenes 2. : Uses Jenkins API tokens which are exempt from CSRF protection - Set JENKINS_USE_API_TOKEN=true - Set JENKINS_PASSWORD to your API token instead of password - Works with Jenkins 2.96+ which doesn't require crumbs for API token auth You can generate an API token in Jenkins at: User → Configure → API Token → Add new Token - List Jenkins jobs - Trigger builds with optional parameters - Check build status - CSRF crumb handling for secure API access

README

Jenkins MCP

MCP server for managing Jenkins operations.

Installation

Installing via Smithery

To install Jenkins MCP for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @kjozsa/jenkins-mcp --client claude

Installing Manually

uvx install jenkins-mcp

Configuration

Add the MCP server using the following JSON configuration snippet:

{
  "mcpServers": {
    "jenkins-mcp": {
      "command": "uvx",
      "args": ["jenkins-mcp"],
      "env": {
        "JENKINS_URL": "https://your-jenkins-server/",
        "JENKINS_USERNAME": "your-username",
        "JENKINS_PASSWORD": "your-password",
        "JENKINS_USE_API_TOKEN": "false"
      }
    }
  }
}

CSRF Crumb Handling

Jenkins implements CSRF protection using “crumbs” - tokens that must be included with POST requests. This MCP server handles CSRF crumbs in two ways:

  1. Default Mode: Automatically fetches and includes CSRF crumbs with build requests

    • Uses session cookies to maintain the web session
    • Handles all the CSRF protection behind the scenes
  2. API Token Mode: Uses Jenkins API tokens which are exempt from CSRF protection

    • Set JENKINS_USE_API_TOKEN=true
    • Set JENKINS_PASSWORD to your API token instead of password
    • Works with Jenkins 2.96+ which doesn’t require crumbs for API token auth

You can generate an API token in Jenkins at: User → Configure → API Token → Add new Token

Features

  • List Jenkins jobs
  • Trigger builds with optional parameters
  • Check build status
  • CSRF crumb handling for secure API access

Development

# Install dependencies
uv pip install -r requirements.txt

# Run in dev mode with Inspector
mcp dev jenkins_mcp/server.py
在 GitHub 查看完整 README

安装

uvx jenkins-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "jenkins-mcp": { "command": "uvx", "args": ["jenkins-mcp"], "env": { "JENKINS_URL": "https://your-jenkins-server/", "JENKINS_USERNAME": "your-username", "JENKINS_PASSWORD": "your-password", "JENKINS_USE_API_TOKEN": "false" } } } }