mcp-jenkins-client

v0.1.2
mcp-jenkins-client Checked 14 hours ago Published 1 day ago

MCP server for Jenkins CI/CD integration via python-jenkins

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_server_info

Get Jenkins server information including mode, description, and job counts.

get_whoami

Get information about the currently authenticated Jenkins user.

get_version

Get the Jenkins server version string.

quiet_down

Put Jenkins into quiet mode, preventing new builds from starting. Used to prepare for shutdown.

run_groovy_script

Execute a Groovy script on the Jenkins server or a specific node. Returns the script output.

ParameterTypeDescription
script *string
node

check_jenkinsfile_syntax

Validate a Jenkinsfile pipeline script for syntax errors.

ParameterTypeDescription
jenkinsfile *string

list_jobs

List Jenkins jobs with server-side pagination. Note: recursive=True fetches all jobs across all folders before paginating, which can be slow on large instances. Prefer using folder_path to browse specific folders, or the default non-recursive mode which is paginated server-side. Args: offset: Starting index for pagination (default 0) limit: Maximum number of jobs to return (default 50) folder_path: Optional folder path to list jobs from a specific folder recursive: Fetches all jobs across all folders. Can be slow on large instances — prefer folder_pa…

ParameterTypeDescription
folder_path
limitinteger
offsetinteger
recursiveboolean

get_job_info

Get full details for a Jenkins job including status, health, and build history.

ParameterTypeDescription
job_name *string

get_job_config

Get the XML configuration of a Jenkins job.

ParameterTypeDescription
job_name *string

create_job

Create a new Jenkins job from an XML configuration string.

ParameterTypeDescription
config_xml *string
job_name *string

reconfig_job

Update the XML configuration of an existing Jenkins job.

ParameterTypeDescription
config_xml *string
job_name *string

copy_job

Copy a Jenkins job to a new name.

ParameterTypeDescription
from_name *string
to_name *string

rename_job

Rename an existing Jenkins job.

ParameterTypeDescription
from_name *string
to_name *string

delete_job

Permanently delete a Jenkins job.

ParameterTypeDescription
job_name *string

enable_job

Enable a disabled Jenkins job.

ParameterTypeDescription
job_name *string

disable_job

Disable a Jenkins job, preventing builds from running.

ParameterTypeDescription
job_name *string

job_exists

Check whether a Jenkins job exists.

ParameterTypeDescription
job_name *string

create_folder

Create a new folder in Jenkins for organizing jobs.

ParameterTypeDescription
folder_name *string

set_next_build_number

Set the next build number for a Jenkins job.

ParameterTypeDescription
job_name *string
number *integer

search_jobs

Search for Jenkins jobs by regex pattern on job name. Searches all folders at all depths. Returns matching jobs with pagination. The pattern is matched against job names using Python regex (re.search). Examples: 'deploy' matches any job containing 'deploy', '^build-' matches jobs starting with 'build-', 'release.*prod' matches 'release-to-prod' etc.

ParameterTypeDescription
pattern *string
limitinteger
offsetinteger

list_builds

List builds for a Jenkins job with pagination. Start with a small limit (10-20) and paginate as needed — long-lived jobs may have thousands of builds. include_parameters=True also returns each build's result and its build parameters as {name: value} — use it to find a known-good build's settings.

ParameterTypeDescription
job_name *string
include_parametersboolean
limitinteger
offsetinteger

build_job

Trigger a build for a Jenkins job. Returns the queue item ID for tracking. Pass the queue_id to wait_for_queue_item to get the resulting build number. Parameterized jobs are routed to buildWithParameters automatically, including when no parameters are supplied (Jenkins rejects /build with 400 for those). On a multibranch project (or organization folder) this starts a branch scan instead and returns scan_triggered=true with no queue_id: branch jobs whose head changed are then built. To build one branch, pass the branch job, e.g. "<project>/<branch>".

ParameterTypeDescription
job_name *string
parameters

get_build_status

Get just the status of a build — result, building, duration, timestamp. Cheap alternative to get_build_info when all you need is whether the build finished and how it ended. Use this for polling.

ParameterTypeDescription
build_number *
job_name *string

wait_for_build

Block until a build finishes, then return its final status. Waits at most timeout_seconds (default 300, max 3600). If the build is still running when the timeout expires, returns the current status with timed_out=true — call again to keep waiting. build_number also accepts lastBuild, lastSuccessfulBuild, lastFailedBuild and lastCompletedBuild. Right after build_job, lastBuild is still the *previous* build — wait on the build_number returned by wait_for_queue_item instead.

ParameterTypeDescription
build_number *
job_name *string
poll_interval_secondsinteger
timeout_secondsinteger

get_build_info

Get full details for a specific build including result, duration, and parameters. For just the status, prefer get_build_status.

ParameterTypeDescription
build_number *
job_name *string

get_build_console_output

Read a byte range of a build's console log. Build logs reach hundreds of megabytes. To find something specific, use search_build_console instead of scanning with offsets — and when a pipeline stage failed, get_failed_stage_log is narrower still. offset and next_offset are byte positions in the returned text: a search match's byte_offset reads back exactly at its line. limit is capped at 100000 bytes; paginate with next_offset. A page never splits a character. total_size is the text length known so far; has_more stays true while the build runs. Reading at off…

ParameterTypeDescription
build_number *
job_name *string
limitinteger
offsetinteger

search_build_console

Search a build's console log with a regex and return matching lines with context. Works on multi-hundred-MB logs that are impractical to page through with get_build_console_output. Each match reports its line number and byte_offset; get_build_console_output(offset=byte_offset) reads back exactly at that line. The log is downloaded once and kept locally, so repeated searches are fast. Stops after max_matches matches (and their context) unless count_all=true, so total_matches is a lower bound unless scanned_all is true. For the next batch, pass next_offset as from_o…

ParameterTypeDescription
build_number *
job_name *string
pattern *string
context_linesinteger
count_allboolean
from_offsetinteger
ignore_caseboolean
max_matchesinteger

get_build_env_vars

Get environment variables used in a specific build.

ParameterTypeDescription
build_number *
job_name *string

get_build_test_report

Get test results for a specific build including pass/fail/skip counts.

ParameterTypeDescription
build_number *
job_name *string

get_build_stages

Get pipeline stage information for a build (requires Pipeline job). Returns each stage's id, name, status and duration. Pass a stage id to get_stage_log to read only that stage's output. The wfapi _links blob is stripped by default because the stage id is all the log tools need.

ParameterTypeDescription
build_number *
job_name *string
include_linksboolean

get_stage_log

Read the log of a single pipeline stage, identified by its wfapi stage id. Get stage ids from get_build_stages. This is far narrower than the whole build log — prefer it when you already know which stage failed. limit is capped at 100000 characters.

ParameterTypeDescription
build_number *
job_name *string
stage_id *string
limitinteger
offsetinteger

get_failed_stage_log

Find the first failed pipeline stage of a build and return the tail of its log. One call replaces the usual get_build_stages → hunt-through-console-output loop. Returns the *end* of the stage log, where the failure almost always is. limit is capped at 100000 characters.

ParameterTypeDescription
build_number *
job_name *string
limitinteger

stop_build

Stop a running build, escalating through /stop, /term and /kill. Reports which endpoint succeeded. If all fail with 401/403 the cause is usually server-side (missing Job/Cancel permission, or a Jenkins instance that requires a session-bound CSRF crumb for POST) rather than a bad token.

ParameterTypeDescription
build_number *
job_name *string

delete_build

Permanently delete a build from the build history.

ParameterTypeDescription
build_number *integer
job_name *string

get_build_artifact

Download a build artifact by its relative path. Returns text content directly, or base64-encoded content for binary files.

ParameterTypeDescription
artifact_path *string
build_number *
job_name *string

get_running_builds

List currently running builds across all nodes. Note: fetches all running builds first, then paginates client-side. On large instances with many executors this may be slow. Use offset/limit to paginate through results.

ParameterTypeDescription
limitinteger
offsetinteger

list_nodes

List Jenkins agent nodes with server-side pagination. Start with a small limit (10-20) and paginate — large instances may have hundreds of nodes.

ParameterTypeDescription
limitinteger
offsetinteger

get_node_info

Get full details for a Jenkins agent node.

ParameterTypeDescription
node_name *string

get_node_config

Get the XML configuration of a Jenkins agent node.

ParameterTypeDescription
node_name *string

delete_node

Permanently delete a Jenkins agent node.

ParameterTypeDescription
node_name *string

enable_node

Enable a disabled Jenkins agent node.

ParameterTypeDescription
node_name *string

disable_node

Disable a Jenkins agent node with an optional reason message.

ParameterTypeDescription
node_name *string
messagestring

list_views

List Jenkins views with server-side pagination. Start with a small limit and paginate as needed.

ParameterTypeDescription
limitinteger
offsetinteger

get_view_config

Get the XML configuration of a Jenkins view.

ParameterTypeDescription
view_name *string

create_view

Create a new Jenkins view from an XML configuration string.

ParameterTypeDescription
config_xml *string
view_name *string

reconfig_view

Update the XML configuration of an existing Jenkins view.

ParameterTypeDescription
config_xml *string
view_name *string

delete_view

Permanently delete a Jenkins view.

ParameterTypeDescription
view_name *string

view_exists

Check whether a Jenkins view exists.

ParameterTypeDescription
view_name *string

get_queue_info

List queued items waiting to be built, with server-side pagination. Start with a small limit and paginate — busy instances may have many queued items.

ParameterTypeDescription
limitinteger
offsetinteger

get_queue_item

Get full details for a specific queued item by its queue ID.

ParameterTypeDescription
queue_id *integer

wait_for_queue_item

Wait for a queued item to start building and return its build number. build_job returns a queue_id, but every other build tool needs a build number — this bridges the two. Blocks until Jenkins assigns an executor (at most timeout_seconds, default 300, max 3600). Returns started=true with build_number/build_url once running, cancelled=true if the item was cancelled, or timed_out=true with the current "why" reason.

ParameterTypeDescription
queue_id *integer
poll_interval_secondsinteger
timeout_secondsinteger

cancel_queue_item

Cancel a queued build by its queue ID.

ParameterTypeDescription
queue_id *integer

list_plugins

List installed Jenkins plugins with server-side pagination. Start with a small limit and paginate — Jenkins instances often have 100+ plugins installed.

ParameterTypeDescription
limitinteger
offsetinteger

get_plugin_info

Get full details for a specific installed Jenkins plugin.

ParameterTypeDescription
plugin_name *string