Skip to main content

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

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) No
--jenkins-password The password or API token for Jenkins authentication. (Http app can set it via headers x-jenkins-password) 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_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

Download files

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

Source Distribution

mcp_jenkins-3.5.0.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

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

mcp_jenkins-3.5.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_jenkins-3.5.0.tar.gz.

File metadata

  • Download URL: mcp_jenkins-3.5.0.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcp_jenkins-3.5.0.tar.gz
Algorithm Hash digest
SHA256 48bfa1c38eeeec99c20b247194b08b9c09fed25c075a49c272bda067a304ba4b
MD5 61f8e381c44c4a3457410fd49d89c0a0
BLAKE2b-256 6ce0ec2f4268472912b98e4a88db4117d9345046659283ce2a6273f15e83e306

See more details on using hashes here.

File details

Details for the file mcp_jenkins-3.5.0-py3-none-any.whl.

File metadata

  • Download URL: mcp_jenkins-3.5.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mcp_jenkins-3.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 494712b9e3902e0621bb81c60b6bcdeb591ce25def7beaf6452e409c822ac22d
MD5 4a94263c5b464e2356d07c3005a9f416
BLAKE2b-256 ae75b5093830bf0a2f379fc3add09f1c9a5433ea5d63edcffb0988de886cb026

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.5.0 This release

2 files

3.4.0

2 files

3.3.0

2 files

3.2.0

2 files

3.1.3

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.1

2 files

3.0.0

2 files

1.0.1

2 files

1.0.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.8

2 files

0.3.7

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page