Skip to main content

Jenkins CLI + MCP server — manage nodes, users, and jobs from the terminal or from AI agents

Project description

jenkins-mcp

CI

A Jenkins CLI + MCP server — manage nodes, users, and jobs from the terminal or from AI agents.

Features

  • Node Management: Add, remove, and list worker nodes/agents.
  • Account Management: Create and configure Jenkins user accounts.
  • Job Overview: List jobs and their status.
  • CSRF Token / Crumb Handling: Automatically acquires and attaches Jenkins-Crumb for Jenkins 2.x instances with security enabled.
  • Dual Mode: Works as a standalone terminal CLI (jenkins-mcp) or as an MCP server for AI agents (jenkins-mcp serve).

Install

pip install jenkins-mcp-cli

or with uv:

uv tool install jenkins-mcp-cli

(installs the jenkins-mcp command)

Quickstart

export JENKINS_URL="https://jenkins.example.com"
export JENKINS_USER="admin"
export JENKINS_PASSWORD="your-api-token"

jenkins-mcp status

CLI Usage

# Check status of all nodes
jenkins-mcp status

# Add a worker node
jenkins-mcp node add worker-01 --ip 192.0.2.10 --labels "linux worker"

# Remove a worker node
jenkins-mcp node remove worker-01

# Create a new user account
jenkins-mcp user create someuser 'a-strong-password' --email someuser@example.com

# List all jobs
jenkins-mcp jobs

# Run the MCP stdio server
jenkins-mcp serve

Credentials can also be passed explicitly, overriding env vars / config file:

jenkins-mcp --url https://jenkins.example.com --user admin --password '...' status

Configuration

jenkins-mcp never ships with credentials. It resolves connection settings in this order, first match wins:

  1. Explicit CLI flags: --url, --user, --password
  2. Environment variables: JENKINS_URL, JENKINS_USER, JENKINS_PASSWORD
  3. A JSON config file at ~/.config/jenkins-mcp/config.json

If no username/password is found by any of the above, the command exits with a clear error instead of connecting anonymously.

Environment variables

export JENKINS_URL="https://jenkins.example.com"
export JENKINS_USER="your-jenkins-username"
export JENKINS_PASSWORD="your-jenkins-api-token"

Config file

Create ~/.config/jenkins-mcp/config.json:

{
  "url": "https://jenkins.example.com",
  "username": "your-jenkins-username",
  "password": "your-jenkins-api-token"
}

Running as an MCP Server for AI Agents

jenkins-mcp ships a serve subcommand that runs the MCP stdio server:

jenkins-mcp serve

Register it with Claude Code:

claude mcp add jenkins -- jenkins-mcp serve

Exposed MCP Tools:

  • jenkins_get_status()
  • jenkins_add_node(name, ip, labels, remote_fs)
  • jenkins_remove_node(name)
  • jenkins_create_user(username, password, email)
  • jenkins_list_jobs()

Security

Requests use HTTP Basic Auth, which sends username:password base64-encoded on every request — base64 is trivially reversible, not encryption. Use an https:// Jenkins URL, or make sure the connection stays on a trusted network, before sending real credentials.

Prefer a Jenkins API token over your account password: generate one under your Jenkins user profile ("Configure" → "API Token") and set it as JENKINS_PASSWORD. jenkins-mcp accepts an API token anywhere it accepts a password, and tokens can be revoked independently of your login credentials.

Development

git clone https://github.com/ml-lubich/jenkins-mcp.git
cd jenkins-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Running Tests

pytest -q

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jenkins_mcp_cli-0.1.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jenkins_mcp_cli-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file jenkins_mcp_cli-0.1.0.tar.gz.

File metadata

  • Download URL: jenkins_mcp_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for jenkins_mcp_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b115a394c9e0193d2f27892dc9e2cfe5e625b44993dd3483687c56facff31a9a
MD5 9c6790629e1aed9cdb933ce9ed66dcab
BLAKE2b-256 7585e61c551437f9cb071988981f0b61b80f44f9ce4b3ea101ff249eeddaa30b

See more details on using hashes here.

File details

Details for the file jenkins_mcp_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jenkins_mcp_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15994c93b5bae4b91bb90b74dd63642b5a2604bba24a84cdfd1bcab6504fc178
MD5 fa46be25d991aeb65b18ac41773b2201
BLAKE2b-256 8d0099f3752c70bbae71d936ee22afdd9ffb2adc29ae5d9dfe45c6997d2a3047

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page