Skip to main content
Glama

Jenkins MCP Server

mcp_jenkins

Jenkins MCP 服务器。模型上下文协议 (MCP) 允许 AI 工具(例如聊天机器人)与您的 Jenkins 设置进行通信并控制您的设置,例如检索信息和修改设置。

**注意:**这是 MCP Jenkins 服务器的最小实验版本,目前处于早期开发阶段。

描述

该项目提供了一个用于与 Jenkins 交互的模型上下文协议 (MCP) 服务器。它允许用户通过 MCP 界面触发 Jenkins 作业、获取构建状态以及执行其他与 Jenkins 相关的操作。

成分

  • server.py :核心 MCP Jenkins 服务器应用程序。
  • functions_schema.md :定义 MCP Jenkins 服务器公开的函数的模式。
  • client.py :一个示例客户端,演示如何与 MCP Jenkins 服务器交互(仅供参考)。
  • functional tests :包含 MCP Jenkins 服务器的功能测试。

安装

要安装该软件包,请运行:

pip install .

用法

常见工作流程

运行服务器

要运行 MCP 服务器:

./docker/run.server
运行示例客户端

运行示例客户端:

./docker/run.client

例如,要列出使用特定模型的名为“备份”的作业的构建,您可以运行:

./docker/run.client --model gemini-2.0-flash-001 "list builds backups"

注意:如果通过pip install .那么mcp_jenkins_client控制台脚本也可用。

这可能会产生类似以下内容的输出:

Query: list builds backups Result: Recent builds for backups: - Build #1086: FAILURE (http://myjenkins:8080/job/backups/1086/)
使用 Docker 进行构建和测试

开发和测试的常见工作流程是首先构建 Docker 镜像,然后执行测试:

  1. **构建Docker镜像:**此步骤准备测试所需的环境。
    ./docker/build
  2. **运行测试:**构建完成后,执行测试。
    ./docker/run.tests

此序列确保在一致的 Dockerized 环境中针对最新版本执行测试。

部署测试环境

部署本地 Jenkins 测试实例(无需身份验证,仅用于功能测试):

./docker/deploy.test.environment

连接到现有的 Jenkins 实例

要将 MCP Jenkins 服务器与现有的 Jenkins 实例一起使用,您需要配置以下环境变量:

  • JENKINS_URL :你的 Jenkins 实例的完整 URL(例如http://your-jenkins-host:8080 )。此参数为必填项
  • JENKINS_USER :(可选)如果需要身份验证,请输入您的 Jenkins 用户名。
  • JENKINS_API_TOKEN :(可选)您的 Jenkins API 令牌。如果使用身份验证,则必须将此令牌与JENKINS_USER一起提供。您可以在 Jenkins 用户的配置页面 ( <Jenkins URL>/me/configure ) 中生成 API 令牌。
  • MCP_API_KEY :用于保护此 MCP 服务器的 API 密钥。发送至 MCP 服务器的请求需要在X-API-Key标头中包含此密钥。除非DEBUG_MODE设置为true ,否则此项为必需
  • DEBUG_MODE :设置为true即可在调试模式下运行 MCP 服务器,从而绕过MCP_API_KEY要求并提供更详细的日志记录。请勿在生产环境中使用。

示例配置(Bash):

export JENKINS_URL="http://your-jenkins-host:8080" export JENKINS_USER="your_jenkins_username" export JENKINS_API_TOKEN="your_jenkins_api_token" export MCP_API_KEY="your_mcp_secret_key" # export DEBUG_MODE="true" # Uncomment for development/testing without MCP_API_KEY

设置这些环境变量后,您可以使用 Docker 脚本运行 MCP 服务器:

./docker/run.server

然后,MCP 服务器将尝试连接到您指定的 Jenkins 实例。

OpenWebUI 集成

文件open-webui/open_webui_interface.py提供了如何将此 MCP Jenkins 服务器与 OpenWebUI 实例集成的示例。

使用方法:

  1. 在您的 OpenWebUI 界面中,导航到添加或配置工具的部分。
  2. 创建新工具。
  3. open-webui/open_webui_interface.py文件的全部内容复制并粘贴到 OpenWebUI 中的工具配置中。
  4. 重要提示:您需要调整粘贴的代码中的连接参数,具体来说:
    • MCP_JENKINS_SERVER_URL :在您的 OpenWebUI 环境中将此环境变量设置为正在运行的 MCP Jenkins 服务器的 URL(例如http://localhost:5000 )。如果未设置此变量,则脚本默认使用http://localhost:5000
    • MCP_API_KEY :如果您的 MCP Jenkins 服务器配置为需要 API 密钥,请确保在 OpenWebUI 环境中设置此环境变量。如果未找到密钥,脚本会打印警告,但仍会尝试发出请求。

配置完成后, open_webui_interface.py中定义的工具(例如list_jobstrigger_buildget_build_status )就可以在您的 OpenWebUI 聊天界面中使用了。

执照

该项目已获得 MIT 许可。

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

模型上下文协议 (MCP) 服务器使聊天机器人等 AI 工具能够与 Jenkins 交互并控制它,允许用户通过自然语言触发作业、检查构建状态以及执行其他 Jenkins 操作。

  1. 描述
    1. 成分
      1. 安装
        1. 用法
          1. 常见工作流程
          2. 连接到现有的 Jenkins 实例
        2. OpenWebUI 集成
          1. 执照

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A Model Context Protocol server that enables AI assistants to interact with Jenkins CI/CD servers, providing tools to check build statuses, trigger builds, and retrieve build logs.
              Last updated -
              3
              8
              JavaScript
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              A server that uses the Model Context Protocol (MCP) to allow AI agents to safely execute shell commands on a host system.
              Last updated -
              1
              76
              2
              TypeScript
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol (MCP) server that enables real-time, interactive AI chat with Selector AI through a streaming-capable server and Docker-based client communicating via stdin/stdout.
              Last updated -
              1
              Python
              Apache 2.0
            • -
              security
              A
              license
              -
              quality
              The Model Context Protocol (MCP) Jenkins integration 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.
              Last updated -
              25
              Python
              MIT License
              • Linux
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/andreimatveyeu/mcp_jenkins'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server