Folio Rancher Jenkins MCP How-To

Folio Rancher Jenkins MCP How-To

Overview

Jenkins MCP is a Model Context Protocol server that connects your AI assistant (GitHub Copilot, Claude, etc.) directly to Jenkins CI. It allows you to trigger pipelines, read console logs, check build statuses, and more — all from within your IDE chat, using your own Jenkins identity.


Prerequisites

  • A Jenkins account at jenkins.ci.folio.org

  • A Jenkins API token (see below)

  • VS Code with GitHub Copilot or another MCP-compatible AI client


Step 1: Generate Your Jenkins API Token

  1. Log in to https://jenkins.ci.folio.org

  2. Click your username in the top-right corner

  3. Go to Configure

  4. Under API Token, click Add new Token

  5. Give it a name (e.g. mcp-token) and click Generate

  6. Copy the token — it will not be shown again


Step 2: Generate Your Base64 Credential

Run the following command in your terminal, replacing your_username and your_api_token with your actual values:

echo -n "your_username:your_api_token" | base64

Copy the output string — you will use it in the next step.


Step 3: Configure VS Code

Open VS Code settings (Cmd+Shift+POpen User Settings JSON) and add the following block:

{ "mcp": { "servers": { "jenkins-mcp": { "type": "sse", "url": "https://jenkins-mcp.ci.folio.org/sse", "headers": { "Authorization": "Basic <your_base64_string>" } } } } }

Replace <your_base64_string> with the value generated in Step 2.


Step 4: Start Using It

Once configured, open GitHub Copilot Chat (or your MCP client) and start interacting with Jenkins naturally.


Available Tools

Tool

What it does

Example prompt

Tool

What it does

Example prompt

list_jobs

List all Jenkins jobs, optionally inside a folder

"List all jobs in the folioRancher folder"

search_jobs

Search jobs by name

"Find jobs containing ui-orders"

get_job_info

Get full details of a job including last build

"Show me info for the rancher-create-env job"

get_job_parameters

List all parameters a job accepts

"What parameters does rancher-create-env take?"

trigger_build

Trigger a build with optional parameters

"Trigger rancher-create-env with BRANCH=master"

list_builds

List recent builds for a job

"Show the last 5 builds of rancher-create-env"

get_build_status

Get the result of a specific build

"What is the status of build 42 of rancher-create-env?"

get_console_log

Read the console log of a build

"Show me the console log of the latest rancher-create-env build"

stop_build

Stop a running build

"Stop build 55 of rancher-create-env"

get_queue_item

Check if a triggered build has started

"Is my queued build running yet?"


Authentication Notes

  • Every request is made under your own Jenkins identity — builds you trigger appear as triggered by you in Jenkins audit logs.

  • Your credentials are passed per-request in the Authorization header and are never stored on the server.

  • The server does not hold any shared credentials.


Troubleshooting

Problem

Solution

Problem

Solution

401 Unauthorized

Check that your base64 string is correct. Regenerate it with echo -n "user:token" \| base64

403 Forbidden from Jenkins

Your Jenkins account does not have permission to perform that action

Tool returns an error about a job not found

Verify the exact job name — use list_jobs or search_jobs first

Console log is cut off

Use the start offset returned in the response to fetch the next chunk