Skip to main content
Glama
mcp-jenkins
by lanbaoshen

MCP Jenkins

PyPI Version PyPI Downloads test codecov License

The Model Context Protocol (MCP) is an open-source implementation that bridges Jenkins with AI language models following Anthropic's MCP specification. This project enables secure, contextual AI interactions with Jenkins tools while maintaining data privacy and security.

Installation

Choose one of these installation methods:

# Using uv (recommended)
pip install uv
uvx mcp-jenkins

# Using pip
pip install mcp-jenkins
mcp-jenkins

# Docker
docker pull ghcr.io/lanbaoshen/mcp-jenkins:latest
docker run -p 9887:9887 --rm ghcr.io/lanbaoshen/mcp-jenkins:latest --transport streamable-http

Related MCP server: MCP Jenkins

Line Arguments

When using command line arguments, you can specify the Jenkins server details as follows:

# Simple streamable-http example
uvx mcp-jenkins --transport streamable-http

Argument

Description

Required

--env-file

Path to a .env file to load configuration from. See Environment Variables / .env file below.

No

--jenkins-url

The URL of the Jenkins server. (Http app can set it via headers x-jenkins-url)

No

--jenkins-username

The username for Jenkins authentication. (Http app can set it via headers x-jenkins-username) Set it together with the password, or leave both unset to access Jenkins anonymously.

No

--jenkins-password

The password or API token for Jenkins authentication. (Http app can set it via headers x-jenkins-password) Set it together with the username, or leave both unset to access Jenkins anonymously: what the server can then do is decided by the anonymous user's permissions in Jenkins.

No

--jenkins-timeout

Timeout for Jenkins API requests in seconds. Default is 5 seconds.

No

--jenkins-verify-ssl/--no-jenkins-verify-ssl

Whether to verify SSL certificates when connecting to Jenkins. Default is to verify.

No

--jenkins-session-singleton/--no-jenkins-session-singleton

Whether to use a singleton Jenkins client for all requests in the same session. Default is True.

No

--read-only

Whether to enable read-only mode. Default is False

No

--transport

Transport method to use for communication. Options are stdio, sse or streamable-http. Default is stdio.

No

--host

Host address for streamable-http transport. Default is 0.0.0.0

No

--port

Port number for streamable-http transport. Default is 9887.

No

Environment Variables / .env file

Instead of passing credentials on the command line, you can set them as environment variables, or put them in a .env file:

JENKINS_URL=https://jenkins.example.com
JENKINS_USERNAME=alice
JENKINS_PASSWORD=xxxx
JENKINS_TIMEOUT=5
JENKINS_VERIFY_SSL=true

If a .env file is present in the current directory (or a parent directory), it is loaded automatically — no flag needed:

uvx mcp-jenkins --transport streamable-http

To load a .env file from a specific location, use --env-file:

uvx mcp-jenkins --env-file /path/to/.env --transport streamable-http

Values already set in the real environment take precedence over the .env file, and any --jenkins-* CLI flag takes precedence over both.

Configuration and Usage

Jetbrains Github Copilot

  1. Open Jetbrains Settings

  2. Navigate to Github Copilot > MCP > Configure

  3. Add the following configuration:

{
  "servers": {
    "my-mcp-server": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-jenkins",
        "--jenkins-url=xxx",
        "--jenkins-username=xxx",
        "--jenkins-password=xxx"
      ]
    }
  }
}

VSCode Copilot Chat

  1. Create .vscode folder with mcp.json file in you workspace for local setup or edit settings.json trough settings menu.

  2. Insert the following configuration:

  • SSE mode

{
    "servers": {
        "jenkins": {
            "url": "http://localhost:9887/sse",
            "type": "sse"
        }
    }
}
  • Streamable-Http mode

{
    "servers": {
        "mcp-jenkins-mcp": {
            "autoApprove": [],
            "disabled": false,
            "timeout": 60,
            "type": "streamableHttp",
            "url": "http://localhost:9887/mcp"
        }
    }
}

Run the Jenkins MCP server with the following command:

uvx mcp-jenkins \
  --jenkins-url xxx \
  --jenkins-username xxx  \
  --jenkins-password xxx \
  --transport sse

Health Check Endpoint

When running with --transport streamable-http or --transport sse, the server exposes a plain HTTP liveness endpoint:

GET /healthz  ->  200 OK

It always returns 200 and bypasses the x-jenkins-* auth headers, so it is safe to use directly as a Kubernetes liveness/readiness probe without any Jenkins credentials. Example probe:

livenessProbe:
  httpGet:
    path: /healthz
    port: 9887
  initialDelaySeconds: 5
  periodSeconds: 10

Note: this is a liveness check only — it does not verify connectivity to the upstream Jenkins server.

Available Tools

Tool

Description

get_item

Get a specific item by name.

get_item_config

Get the configuration of a specific item.

get_item_parameters

Get the parameters of a specific item.

get_all_items

Get all items in Jenkins.

query_items

Query items based on pattern.

build_item

Build a item.

get_all_nodes

Get all nodes in Jenkins.

get_node

Get a specific node by name.

get_node_config

Get the configuration of a specific node.

get_all_queue_items

Get all queue items in Jenkins.

get_queue_item

Get a specific queue item by ID.

cancel_queue_item

Cancel a specific queue item by ID.

get_build

Get a specific build by job name and build number.

get_build_scripts

Get scripts associated with a specific build.

get_build_console_output

Get the console output of a specific build.

get_build_parameters

Get the parameters of a specific build.

get_build_test_report

Get the test report of a specific build.

get_build_test_failures

Get the failing tests of a specific build.

get_running_builds

Get all currently running builds in Jenkins.

stop_build

Stop a specific build by job name and build number.

get_pending_inputs

Get the pending input steps of a build paused for input.

submit_input

Proceed with or abort a pipeline input step of a build.

get_all_build_artifacts

List the artifacts of a specific build.

get_build_artifact

Download an artifact from a specific build.

get_build_artifact_url

Get the direct URL of an artifact from a specific build.

get_view

Get a specific view by name.

get_all_views

Get the configuration of a specific view.

get_all_plugins

Get all installed plugins.

get_plugin

Get a specific plugin by short name.

get_plugins_with_problems

Get plugins with problems (missing dependencies, version mismatch, etc.).

get_plugins_with_backup

Get plugins that can be downgraded.

get_plugins_with_updates

Get plugins that have available updates.

get_plugin_dependency_graph

Get dependency graph for a plugin in Graphviz format.

run_groovy_script

Execute an arbitrary Groovy script on Jenkins.

Note: get_pending_inputs reads the wfapi endpoint served by the pipeline-rest-api plugin (bundled with pipeline-stage-view). submit_input only needs that plugin when input_id is omitted — pass input_id explicitly and it works on any Jenkins with the pipeline-input-step plugin.

Contributing

CONTRIBUTING.md

License

Licensed under MIT - see LICENSE file. This is not an official Jenkins product.

Star History

Star History Chart

Available Tools

36 tools
build_itemA

Build an item in Jenkins

Args: fullname: The fullname of the item data: The parameters to trigger the build with. Required if build_type is 'buildWithParameters'. build_type: If your item is configured with parameters, you must use 'buildWithParameters' as build_type.

Returns: The queue item number of the item.

Inputs: fullname (required), build_type (required), data. Returns: result

cancel_queue_itemC

Cancel a specific item in Jenkins queue by id

Args: id: The id of the queue item

Inputs: id (required).

get_all_build_artifactsA

List the artifacts of a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: A list of artifact metadata dicts with fileName, relativePath, and displayPath

Inputs: fullname (required), number. Returns: result

get_all_itemsB

Get all items from Jenkins

Returns: A list of items

Inputs: no named parameters. Returns: result

get_all_nodesA

Get all nodes from Jenkins

Returns: A list of all nodes

Inputs: no named parameters. Returns: result

get_all_pluginsA

Get all installed plugins from Jenkins

Args: depth: The depth of the information to retrieve. Default is 2 (includes dependencies).

Returns: A list of all installed plugins

Inputs: depth. Returns: result

get_all_queue_itemsB

Get all items in Jenkins queue

Returns: A list of all items in the Jenkins queue

Inputs: no named parameters. Returns: result

get_all_viewsA

Get all top-level views from Jenkins.

Returns: A list of views with their name and URL.

Inputs: no named parameters. Returns: result

get_buildA

Get specific build info from Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: The build info

Inputs: fullname (required), number. Returns: object

get_build_artifactA

Download an artifact from a specific build in Jenkins

Binary files are returned as base64-encoded content; text files are returned as plain text.

Args: fullname: The fullname of the job relative_path: The relative path of the artifact (e.g. playwright-report/index.html) number: The number of the build, if None, get the last build

Returns: A dict with 'content' (str) and 'encoding' ('utf-8' or 'base64')

Inputs: fullname (required), relative_path (required), number. Returns: object

get_build_artifact_urlB

Get the direct URL of an artifact from a specific build in Jenkins

Args: fullname: The fullname of the job relative_path: The relative path of the artifact (e.g. playwright-report/index.html) number: The number of the build, if None, get the last build

Returns: The direct Jenkins URL of the artifact

Inputs: fullname (required), relative_path (required), number. Returns: result

get_build_console_outputA

Get the console output of a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build pattern: Optional regex pattern to filter lines (only matching lines are returned) offset: Number of lines to skip from the beginning after filtering, default 0 limit: Maximum number of lines to return after filtering and offset

Returns: The console output of the build

Inputs: fullname (required), limit, number, offset, +1 more. Returns: result

get_build_parametersA

Get the parameters of a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: A dictionary of build parameter names and their values

Inputs: fullname (required), number. Returns: object

get_build_scriptsA

Get the scripts used in a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: A list of scripts used in the build

Inputs: fullname (required), number. Returns: result

get_build_test_failuresB

Get the failing tests of a specific build in Jenkins, with their error details

For a matrix build, the failures of all configurations are returned, each with the URL of its configuration build.

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build limit: Maximum number of failures to return, None for all of them max_stack_trace_length: Stack traces longer than this are cut to this many characters

Returns: The test counts of the build, its failures and whether the failures were truncated to the limit

Inputs: fullname (required), limit, number, max_stack_trace_length. Returns: object

get_build_test_reportA

Get the test report of a specific build in Jenkins

The report lists every test case, passing ones included, so it can be very large; use get_build_test_failures to see what failed.

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: The test report of the build

Inputs: fullname (required), number. Returns: object

get_itemC

Get specific item from Jenkins

Args: fullname: The fullname of the item

Returns: The item

Inputs: fullname (required). Returns: object

get_item_configA

Get specific item config from Jenkins

Args: fullname: The fullname of the item

Returns: The config of the item

Inputs: fullname (required). Returns: result

get_item_parametersA

Get the parameter definitions of a Jenkins job

Args: fullname: The fullname of the item

Returns: A list of parameter definitions, each containing name, type, defaultValue, and description

Inputs: fullname (required). Returns: result

get_nodeB

Get a specific node from Jenkins

Contains executor about the node.

Args: name: The name of the node

Returns: The node

Inputs: name (required). Returns: object

get_node_configB

Get node config from Jenkins

Args: name: The name of the node

Returns: The config of the node

Inputs: name (required). Returns: result

get_pending_inputsA

Get the pending input steps of a specific build in Jenkins

A pipeline showing "Paused for Input" is waiting on an input step. Call this before submit_input to discover the input id and the parameter definitions the pipeline is waiting for.

Only the given build is inspected. With number=None that is the job's last build, so a paused build that is no longer the most recent one is not found that way — locate it with get_running_builds and pass its number explicitly.

Args: fullname: The fullname of the job number: The number of the build, if None, check the last build

Returns: A list of pending inputs with id, message, proceedText and inputs (parameter definitions)

Inputs: fullname (required), number. Returns: result

get_pluginA

Get a specific plugin from Jenkins

Contains detailed information about the plugin, including dependencies when depth >= 2.

Args: short_name: The short name of the plugin depth: The depth of the information to retrieve. Default is 2 (includes dependencies).

Returns: The plugin details, or None if not found

Inputs: short_name (required), depth. Returns: result

get_plugin_dependency_graphA

Get dependency graph for a specific plugin in Graphviz format

Recursively analyzes dependencies down to leaf nodes. Returns nodes and edges that can be used to generate a dependency graph.

Args: short_name: The short name of the plugin to analyze

Returns: A dictionary with 'nodes' and 'edges' for Graphviz rendering

Inputs: short_name (required). Returns: object

get_plugins_with_backupA

Get plugins that can be downgraded

Returns plugins that have a backupVersion and can be rolled back.

Args: depth: The depth of the information to retrieve. Default is 0.

Returns: A list of plugins that can be downgraded

Inputs: depth. Returns: result

get_plugins_with_problemsA

Get all plugins with problems from Jenkins

These are plugins that have issues such as missing dependencies, incompatible versions, core version mismatch, or other configuration problems.

Returns: A list of plugins with problems

Inputs: no named parameters. Returns: result

get_plugins_with_updatesB

Get plugins that have available updates

Args: depth: The depth of the information to retrieve. Default is 0.

Returns: A list of plugins with available updates

Inputs: depth. Returns: result

get_queue_itemA

Get a specific item in Jenkins queue by id

Args: id: The id of the queue item

Returns: The queue item

Inputs: id (required). Returns: object

get_running_buildsA

Get all running builds from Jenkins

Returns: A list of all running builds

Inputs: no named parameters. Returns: result

get_viewA

Get a Jenkins view by path, returning its jobs and/or nested sub-views.

Views can be nested up to multiple levels deep. Use "/" to separate levels in the path. If the view contains sub-views instead of jobs, the response will include their names so you can drill down further.

Args: view_path: View path using "/" to separate levels. Examples: "All", "frontend", "frontend/nightly". Spaces and special characters in view names are handled automatically. depth: Depth of detail to retrieve for each job. Default is 0.

Returns: A dict with the view's name, jobs list, and/or nested views.

Inputs: view_path (required), depth. Returns: object

query_itemsC

Query items from Jenkins

Args: class_pattern: The pattern of the _class fullname_pattern: The pattern of the fullname color_pattern: The pattern of the color folder_depth: The maximum depth of folders to traverse. If None, traverses all levels.

Returns: A list of items

Inputs: folder_depth, class_pattern, color_pattern, fullname_pattern. Returns: result

run_groovy_scriptA

Execute an arbitrary Groovy script on Jenkins.

This tool provides access to Jenkins internal features that are not available via REST API.

Args: script: The Groovy script code to execute.

Returns: The result of the script execution.

Examples: # Basic usage: run_groovy_script(script='println Jenkins.instance.version')

# Access Jenkins information:
run_groovy_script(
    script='''
        def version = Jenkins.instance.version
        def mode = Jenkins.instance.mode
        return "Version: ${version}, Mode: ${mode}"
    '''
)

Inputs: script (required). Returns: result

set_item_configC

Set specific item config in Jenkins

Args: fullname: The fullname of the item config_xml: The config XML of the item

Inputs: fullname (required), config_xml (required).

set_node_configC

Set specific node config in Jenkins

Args: name: The name of the node config_xml: The config XML of the node

Inputs: name (required), config_xml (required).

stop_buildC

Stop a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build to stop

Inputs: number (required), fullname (required).

submit_inputA

Respond to a pipeline input step of a build that is paused for input in Jenkins

Warnings: Omitting a declared parameter settles it with null — Jenkins does not fall back to the declared defaults, so every declared parameter must be submitted. That is enforced whenever the pending input can be discovered; when the pending inputs cannot be fetched (wfapi endpoint missing or erroring) an explicit input_id is submitted as-is, so check the declared parameters yourself in that case. If this call times out the input may or may not have been settled: re-check with get_pending_inputs rather than retrying, because a settled input rejects a second submission.

Args: fullname: The fullname of the job number: The number of the paused build, use get_pending_inputs to confirm its pending input (and get_running_builds to locate a paused build that is not the job's last one) input_id: The id of the pending input, if None, resolved automatically when exactly one is pending parameters: A mapping of parameter name to value, e.g. {'APPROVE': True, 'TARGET': 'prod'} action: 'proceed' to continue the pipeline, 'abort' to reject the input and abort the build

Returns: A dict with the fullname, number, inputId and the Jenkins action that was submitted: 'proceed' with values, 'proceedEmpty' with none, or 'abort'

Inputs: number (required), fullname (required), action, input_id, +1 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 36 tools

    Disambiguation4/5

    Most tools target distinct resources and actions, and descriptions actively disambiguate near-neighbors (e.g. get_build_test_report warns to use get_build_test_failures instead, get_pending_inputs/submit_input explain their relationship). Minor overlap remains between get_all_items/query_items and among the many get_build_* variants, but the naming and args keep them separable.

    Naming Consistency4/5

    Strong dominant verb_noun pattern (get_build, set_item_config, build_item, stop_build, cancel_queue_item, run_groovy_script). Slight inconsistencies appear in the get_all_X vs query_items vs get_item phrasing and get_build_artifact vs get_all_build_artifacts, but overall the convention is predictable.

    Tool Count3/5

    36 tools is on the heavy side and exceeds the typical comfortable range. Jenkins genuinely spans many sub-domains (builds, items, nodes, plugins, queue, views, groovy), so most tools earn their place, but the surface is large enough to feel bloated and harder to navigate.

    Completeness4/5

    Coverage is broad: build lifecycle (get/stop/console/tests/params/artifacts), item config and triggering, node config, plugin inspection with dependency graphs, queue management, views, and an escape-hatch groovy script. Missing item/node create-delete operations are minor gaps an agent can work around via groovy or config setters.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI language models to securely interact with Jenkins through the Model Context Protocol, exposing tools to query and manage items, nodes, queues, builds, artifacts, views, plugins, and execute Groovy scripts while maintaining data privacy and security.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI language models to securely interact with Jenkins through the Model Context Protocol, exposing tools for querying and managing jobs, builds, nodes, queues, views, plugins, artifacts, and Groovy scripts.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI language models to interact securely with Jenkins through the Model Context Protocol, supporting job, build, queue, node, view, plugin, artifact, and Groovy script operations while maintaining data privacy and security.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI language models to securely interact with Jenkins through the Model Context Protocol, exposing tools for jobs, builds, nodes, queues, views, plugins, artifacts, and Groovy scripts.
      -