mcp-jenkins
MCP Дженкинс
Model Context Protocol (MCP) — это реализация с открытым исходным кодом, которая связывает Jenkins с языковыми моделями ИИ в соответствии со спецификацией MCP от Anthropic. Этот проект обеспечивает безопасное, контекстное взаимодействие ИИ с инструментами Jenkins, сохраняя при этом конфиденциальность и безопасность данных.
Демонстрация курсора
Related MCP server: MCP Jenkins
Руководство по настройке
Установка
Выберите один из следующих способов установки:
# Using uv (recommended)
pip install uv
uvx mcp-jenkins
# Using pip
pip install mcp-jenkins
# Using Smithery
npx -y @smithery/cli@latest install @lanbaoshen/mcp-jenkins --client claudeКонфигурация и использование
Курсор
Открыть настройки курсора
Перейти к MCP
Нажмите + Добавить новый глобальный сервер MCP
Это создаст или отредактирует файл ~/.cursor/mcp.json с конфигурацией вашего сервера MCP.
{
"mcpServers": {
"mcp-jenkins": {
"command": "uvx",
"args": [
"mcp-jenkins",
"--jenkins-url=xxx",
"--jenkins-username=xxx",
"--jenkins-password=xxx"
]
}
}
}аргументы строки
# Stdio Mode
uvx mcp-jenkins --jenkins-url xxx --jenkins-username xxx --jenkins-password xxx
# SSE Mode
uvx mcp-jenkins --jenkins-url xxx --jenkins-username xxx --jenkins-password xxx --transport sse --port 9887АвтоГен
Установить автоген:
pip install "autogen-ext[azure,ollama,openai,mcp]" autogen-chatЗапуск скриптов Python:
import asyncio
from autogen_ext.tools.mcp import StdioMcpToolAdapter, StdioServerParams
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console
from autogen_core import CancellationToken
async def main() -> None:
# Create server params for the remote MCP service
server_params = StdioServerParams(
command='uvx',
args=[
'mcp-jenkins',
'--jenkins-username',
'xxx',
'--jenkins-password',
'xxx',
'--jenkins-url',
'xxx'
],
)
# Get the translation tool from the server
adapter = await StdioMcpToolAdapter.from_server_params(server_params, 'get_all_jobs')
# Create an agent that can use the translation tool
agent = AssistantAgent(
name='jenkins_assistant',
model_client=[Replace_with_your_model_client],
tools=[adapter],
)
# Let the agent translate some text
await Console(
agent.run_stream(task='Get all jobs', cancellation_token=CancellationToken())
)
if __name__ == "__main__":
asyncio.run(main())Доступные инструменты
Инструмент | Описание |
получить_все_работы | Получить все вакансии |
получить_задание_конфигурации | Получить конфигурацию задания |
поиск_вакансий | Поиск работы по определенной области |
get_running_builds | Запускайте сборки |
получить_информацию_о_сборке | Получить информацию о сборке |
получить_информацию_о_работе | Получить информацию о работе |
build_job | Построить задание с параметрами |
получить_логи_сборки | Получить журналы сборки |
получить_все_узлы | Получить узлы |
получить_узел_конфигурацию | Получить конфигурацию узла |
получить_все_элементы_очереди | Получить все элементы очереди |
получить_элемент_очереди | Получить информацию об элементе очереди |
отменить_пункт_очереди | Отменить элемент очереди |
Разработка и отладка
# Using MCP Inspector
# For installed package
npx @modelcontextprotocol/inspector uvx mcp-jenkins --jenkins-url xxx --jenkins-username xxx --jenkins-password xxx
# For local development version
npx @modelcontextprotocol/inspector uv --directory /path/to/your/mcp-jenkins run mcp-jenkins --jenkins-url xxx --jenkins-username xxx --jenkins-password xxxПредварительная фиксация хука
# Install Dependency
uv sync --all-extras --dev
pre-commit install
# Manually execute
pre-commit run --all-filesЮТ
# Install Dependency
uv sync --all-extras --dev
# Execute UT
uv run pytest --cov=mcp_jenkinsЛицензия
Лицензия MIT - см. файл LICENSE . Это не официальный продукт Jenkins.
Available Tools
36 toolsbuild_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
Scored across 36 tools
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.
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.
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.
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
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables 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.-
- FlicenseNot gradedqualityAmaintenanceEnables 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.-
- FlicenseNot gradedqualityAmaintenanceEnables 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.-
- FlicenseNot gradedqualityAmaintenanceEnables 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.-