Open Source · Written in Go · MIT License

Jenkins from
Your Terminal

Control Jenkins from the command line. Manage jobs, builds, pipelines, nodes, credentials, views, plugins, and system administration — without leaving your terminal.

$ brew install PhilipKram/tap/jenkins-cli
0
Commands
Go
Written In
0
Command Groups
MIT
License

Everything Jenkins, one command away

A powerful CLI that brings the full Jenkins workflow to your terminal with an intuitive, consistent interface.

Jobs

List, trigger, enable, disable, and delete jobs. Supports parameterized builds and folder navigation.

jenkins-cli jobs build my-pipeline -p BRANCH=main

Builds

Stream logs in real-time, watch builds with desktop notifications, download artifacts, and force kill stuck builds.

jenkins-cli builds watch my-pipeline last

Nodes

Manage build agents — list nodes, view details, take agents offline for maintenance, and bring them back online.

jenkins-cli nodes offline my-agent -m "Maintenance"

Plugins

List installed plugins, check for available updates, and keep your Jenkins instance up to date.

jenkins-cli plugins list -u

System Admin

View server info, check your identity, perform safe restarts, and manage quiet mode from the terminal.

jenkins-cli system restart --safe

Multi-Auth

Basic auth with API tokens, OAuth2 browser login with PKCE, or bearer tokens for SSO and CI/CD pipelines.

jenkins-cli auth login

Multi-Server

Named profiles to manage multiple Jenkins servers with separate credentials. Switch with a flag or set a default.

jenkins-cli -p images jobs list

Pipelines

Replay pipeline builds with modified Jenkinsfiles, view stage status, and fetch per-stage logs.

jenkins-cli pipeline stages my-pipeline

Credentials

List, inspect, create, and delete credentials. Supports username-password, secret text, SSH keys, and certificates.

jenkins-cli credentials list

Views

Create and manage views to organize your Jenkins dashboard. Add or remove jobs from views.

jenkins-cli view create my-view

MCP Server

Built-in MCP server lets AI assistants manage Jenkins directly. Zero-install via npx with auto-configuration.

npx @philipkram/jenkins-cli-mcp

Get started in seconds

Multiple installation methods to fit your workflow. Pick whichever suits you best.

Homebrew (macOS & Linux)

terminal
brew install PhilipKram/tap/jenkins-cli

Go Install

terminal
# Requires Go 1.22+
go install github.com/PhilipKram/jenkins-cli@latest

Binary Download

Download pre-built binaries for Linux, macOS, and Windows from the releases page.

Available for amd64 and arm64.

Build from Source

terminal
git clone https://github.com/PhilipKram/Jenkins-CLI.git
cd Jenkins-CLI
go build -o jenkins-cli .

Authentication

Three flexible auth methods. Basic auth is the default — run jenkins-cli configure to get started.

Basic Auth (Default)

Configure your Jenkins URL, username, and API token. Generate a token from Jenkins → Your Name → Configure → API Token.

  • Interactive setup wizard
  • API token authentication
  • Config stored with 0600 permissions
  • Override via environment variables
terminal
# Interactive setup (prompts for URL, user, token)
jenkins-cli configure

# OAuth2 login (opens browser with PKCE)
jenkins-cli auth login \
  --client-id YOUR_CLIENT_ID \
  --auth-url https://your-idp.com/authorize \
  --token-url https://your-idp.com/token

# Set a bearer token for SSO/CI
jenkins-cli auth token eyJhbGciOi...

# Check auth status
jenkins-cli auth status

Basic Auth

Username + API token. The simplest setup for most Jenkins servers. Run jenkins-cli configure.

OAuth2

Browser-based login with PKCE for Jenkins instances using GitHub, GitLab, or OpenID Connect OAuth2 plugins.

Bearer Token

For SSO providers, CI/CD pipelines, or manual token management. Set interactively or pass directly.

Every command at your fingertips

Comprehensive coverage of Jenkins features organized into intuitive command groups.

Jobs
jenkins-cli jobs listList all jobs
jenkins-cli jobs list <folder>List jobs in a folder
jenkins-cli jobs info <name>Show job details
jenkins-cli jobs build <name>Trigger a build
jenkins-cli jobs build -p K=VParameterized build
jenkins-cli jobs enable <name>Enable a job
jenkins-cli jobs disable <name>Disable a job
jenkins-cli jobs delete <name>Delete a job
Authentication
jenkins-cli configureInteractive setup wizard
jenkins-cli auth loginOAuth2 login (opens browser)
jenkins-cli auth tokenSet a bearer token
jenkins-cli auth statusView auth status
jenkins-cli auth refreshRefresh OAuth token
jenkins-cli auth logoutClear all credentials
Profiles
jenkins-cli configure --profile <name>Create/update a profile
jenkins-cli profile listList all profiles
jenkins-cli profile use <name>Set active profile
jenkins-cli profile show <name>Show profile details
jenkins-cli profile delete <name>Delete a profile
jenkins-cli -p <name> jobs listUse profile for one command
Builds
jenkins-cli builds list <job>List recent builds
jenkins-cli builds list -n 20List with custom count
jenkins-cli builds info <job> <id>Show build details
jenkins-cli builds last <job>Show last build
jenkins-cli builds log <job> <id>View console output
jenkins-cli builds log <job> <id> -fStream logs in real time
jenkins-cli builds stop <job> <id>Stop a running build
jenkins-cli builds kill <job> <id>Force kill a build
jenkins-cli builds watch <job> <id>Watch until completion
jenkins-cli builds artifacts <job> <id>List build artifacts
jenkins-cli builds artifacts --downloadDownload artifacts
Nodes
jenkins-cli nodes listList all nodes/agents
jenkins-cli nodes info <name>Show node details
jenkins-cli nodes offline <name>Take node offline
jenkins-cli nodes online <name>Bring node online
Build Queue
jenkins-cli queue listList queued builds
jenkins-cli queue cancel <id>Cancel a queued item
Pipeline
jenkins-cli pipeline replay <job> <id>Replay a pipeline build
jenkins-cli pipeline replay -s FILEReplay with modified Jenkinsfile
jenkins-cli pipeline replay -fReplay and stream logs
jenkins-cli pipeline stages <job>Show pipeline stages
jenkins-cli pipeline stages --logs STAGEGet logs for a stage
Credentials
jenkins-cli credentials listList all credentials
jenkins-cli credentials list <domain>List by domain
jenkins-cli credentials info <id>Show credential details
jenkins-cli credentials create --typeCreate a credential
jenkins-cli credentials delete <id>Delete a credential
Views
jenkins-cli view listList all views
jenkins-cli view info <name>Show view details
jenkins-cli view create <name>Create a view
jenkins-cli view delete <name>Delete a view
jenkins-cli view add-job <view> <job>Add job to view
jenkins-cli view remove-job <view> <job>Remove job from view
System
jenkins-cli system infoShow server info & version
jenkins-cli system whoamiShow current user
jenkins-cli system restart --safeSafe restart
jenkins-cli system quiet-downEnter quiet mode
jenkins-cli system quiet-down --cancelCancel quiet mode
Plugins
jenkins-cli plugins listList installed plugins
jenkins-cli plugins list -uShow plugins with updates
Utilities
jenkins-cli openOpen Jenkins dashboard
jenkins-cli open <job>Open a specific job
jenkins-cli configure testTest connection & auth
jenkins-cli upgradeSelf-upgrade to latest version
jenkins-cli completion bashGenerate shell completions

Global Flags: -p, --profile Configuration profile  ·  --json JSON output  ·  --timeout Request timeout (default: 30s)  ·  --retries Max retries (default: 3)

Real-world workflows

Common patterns for day-to-day Jenkins usage, straight from the terminal.

Complete Job Workflow

Trigger builds, monitor progress, and view logs — all without opening the Jenkins web UI.

  • Trigger parameterized builds
  • Wait for completion with notifications
  • Stream console output in real time
  • JSON output for scripting
terminal
# List all jobs
jenkins-cli jobs list

# Trigger a parameterized build
jenkins-cli jobs build my-pipeline \
  -p BRANCH=main -p ENV=staging

# Trigger and wait for completion (with desktop notification)
jenkins-cli jobs build my-pipeline --wait --follow

# Watch a build until completion
jenkins-cli builds watch my-pipeline last

# Stream console output in real time
jenkins-cli builds log my-pipeline 42 -f

# Get build data as JSON
jenkins-cli builds list my-pipeline --json | jq '.[0]'

Build Monitoring

Monitor builds across jobs, check the queue, and manage running builds without the web UI.

  • Watch builds with notifications
  • Download build artifacts
  • Force kill stuck builds
  • View pipeline stages
terminal
# Watch a build until completion (with desktop notification)
jenkins-cli builds watch my-pipeline last --timeout 30m

# View pipeline stages
jenkins-cli pipeline stages my-pipeline last

# Get logs for a specific stage
jenkins-cli pipeline stages my-pipeline 42 --logs "Build"

# Force kill a stuck build
jenkins-cli builds kill my-pipeline 42 -y

# Download build artifacts
jenkins-cli builds artifacts my-pipeline last --download

# Download only JAR files
jenkins-cli builds artifacts my-pipeline 42 --download --filter "*.jar"

System Administration

Manage nodes, check system health, perform safe restarts, and handle plugin updates.

  • Node management
  • Credential management
  • Safe restart with quiet mode
  • Self-upgrade
terminal
# Check server info
jenkins-cli system info
jenkins-cli system whoami

# Manage credentials
jenkins-cli credentials list
jenkins-cli credentials create --type username-password

# Take a node offline for maintenance
jenkins-cli nodes offline build-agent-01 -m "Disk cleanup"

# Enter quiet mode, then safe restart
jenkins-cli system quiet-down
jenkins-cli system restart --safe

# Self-upgrade to latest version
jenkins-cli upgrade

Fully customizable

Configuration stored in ~/.jenkins-cli/config.json with 0600 permissions.

Environment Variables

VariableDescription
JENKINS_URLJenkins server URL
JENKINS_USERUsername for basic auth
JENKINS_TOKENAPI token for basic auth
JENKINS_BEARER_TOKENBearer token (overrides auth type to bearer)
JENKINS_INSECURESkip TLS certificate verification
JENKINS_PROFILESelect a named configuration profile

Auth Methods

MethodSetup
basicjenkins-cli configure
oauth2jenkins-cli auth login
bearerjenkins-cli auth token

Shell Completion

ShellCommand
bashjenkins-cli completion bash
zshjenkins-cli completion zsh
fishjenkins-cli completion fish
setup
# Quick setup with basic auth
jenkins-cli configure

# Manage multiple Jenkins servers with profiles
jenkins-cli configure --profile images --url https://jenkins.example.com/images
jenkins-cli configure --profile helm --url https://jenkins.example.com/helm
jenkins-cli profile use images
jenkins-cli -p helm jobs list

# Or use environment variables (basic auth)
export JENKINS_URL="https://jenkins.example.com"
export JENKINS_USER="your-username"
export JENKINS_TOKEN="your-api-token"
export JENKINS_PROFILE="images"

# Generate shell completions
jenkins-cli completion zsh > "${fpath[1]}/_jenkins-cli"

MCP Server for AI Assistants

Built-in Model Context Protocol server lets AI assistants like Claude manage your Jenkins servers directly. Zero-install via npx.

Quick Start (npx)
// Add to your MCP client configuration (Claude Code, Claude Desktop, etc.)
{
  "mcpServers": {
    "jenkins-cli": {
      "command": "npx",
      "args": ["-y", "@philipkram/jenkins-cli-mcp"]
    }
  }
}
Multiple Jenkins Servers
{
  "mcpServers": {
    "jenkins-images": {
      "command": "npx",
      "args": ["-y", "@philipkram/jenkins-cli-mcp"],
      "env": { "JENKINS_PROFILE": "images" }
    },
    "jenkins-helm": {
      "command": "npx",
      "args": ["-y", "@philipkram/jenkins-cli-mcp"],
      "env": { "JENKINS_PROFILE": "helm" }
    }
  }
}

Available MCP Tools

CategoryTools
Jobsjob_list, job_view, job_build, job_enable, job_disable
Buildsbuild_list, build_view, build_log, build_last, build_stop, build_artifacts
Pipelinepipeline_validate, pipeline_stages, pipeline_stage_log
Nodesnode_list, node_view
Queuequeue_list, queue_cancel
Credentialscredential_list, credential_view
Viewsview_list
Systemsystem_info
Multibranchmultibranch_branches, multibranch_scan, multibranch_scan_log
Configconfig_status, config_set, profile_list, profile_switch, profile_delete

MCP Resources

ResourceURI Pattern
Build Logjenkins:///{job}/{number}/log
Job Configjenkins:///{job}/config.xml
System Logjenkins:///system/log

MCP Prompts

PromptDescription
diagnose_build_failureAnalyze build logs for failure causes
review_job_configReview config against best practices
summarize_build_historyAnalyze build trends and health
validate_jenkinsfileValidate syntax and best practices
Install from Binary
# Register with Claude Code
jenkins-cli mcp install

# Register with Claude Desktop
jenkins-cli mcp install --client claude-desktop

# Register per profile
jenkins-cli mcp install --profile images --name jenkins-images
jenkins-cli mcp install --profile helm --name jenkins-helm