JM

jenkinsci/mcp-server-plugin

开发工具官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

119 stars 72 forks 质量 80 趋势 36MIT

jenkinsci/mcp-server-plugin 是从 https://github.com/jenkinsci/mcp-server-plugin. 导入的 MCP 服务器候选

概览

jenkinsci/mcp-server-plugin 是从 https://github.com/jenkinsci/mcp-server-plugin. 导入的 MCP 服务器候选

概述(AI 翻译)

Jenkins 的 MCP(模型上下文协议)服务器插件实现了模型上下文协议的服务器端组件。该插件使 Jenkins 能够作为 MCP 服务器,为 MCP 客户端(如基于 LLM 的应用程序或集成开发环境)提供上下文、工具和功能。

特色

  • MCP 服务器实现:实现模型上下文协议的服务器端。
  • Jenkins 集成:将 Jenkins 功能作为 MCP 工具和资源展示。
  • 可扩展架构:允许通过McpServerExtension接口轻松扩展MCP能力。

关键组成部分

  1. 端点:MCP通信的主要入口点,处理MCP传输连接和消息路由。
  2. DefaultMcpServer:实现 McpServerExtension],提供与 Jenkins 作业和构建交互的默认工具。
  3. McpToolWrapper:将 Java 方法包装为 MCP 工具,处理参数解析和结果格式化。
  4. McpServerExtension:用于扩展MCP服务器功能的接口。

MCP SDK 版本

该 MCP 服务器基于 MCP Java SDK 0.17.2 版本,实现了 MCP 规范版本 2025-06-18。

开始

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Server Plugin for Jenkins

The MCP (Model Context Protocol) Server Plugin for Jenkins implements the server-side component of the Model Context Protocol. This plugin enables Jenkins to act as an MCP server, providing context, tools, and capabilities to MCP clients, such as LLM-powered applications or IDEs.

Features

  • MCP Server Implementation: Implements the server-side of the Model Context Protocol.
  • Jenkins Integration: Exposes Jenkins functionalities as MCP tools and resources.
  • Extensible Architecture: Allows easy extension of MCP capabilities through the McpServerExtension interface.

Key Components

  1. Endpoint: The main entry point for MCP communication, handling MCP transport connections and message routing.
  2. DefaultMcpServer: Implements McpServerExtension, providing default tools for interacting with Jenkins jobs and builds.
  3. McpToolWrapper: Wraps Java methods as MCP tools, handling parameter parsing and result formatting.
  4. McpServerExtension: Interface for extending MCP server capabilities.

MCP SDK Version

This MCP Server is based on the MCP Java SDK version 0.17.2, which implements the MCP specification version 2025-06-18.

Getting Started

Configuration

The MCP Server plugin automatically sets up necessary endpoints and tools upon installation, requiring no additional configuration.

System properties

The following system properties can be used to configure the MCP Server plugin:

  • hard limit on max number of log lines to return with io.jenkins.plugins.mcp.server.extensions.BuildLogsExtension.limit.max=10000 (default 10000)
  • disable stateless endpoint with io.jenkins.plugins.mcp.server.Endpoint.disableMcpStateless=true (default false)
  • disable SSE endpoint with io.jenkins.plugins.mcp.server.Endpoint.disableMcpSse=true (default false)
  • disable streamable HTTP endpoint with io.jenkins.plugins.mcp.server.Endpoint.disableMcpStreamable=true (default false)
  • allow anonymous MCP clients to skip the CSRF crumb with io.jenkins.plugins.mcp.server.Endpoint.allowUnauthenticatedMcp=true (default false)
  • reclaim idle Streamable HTTP sessions with io.jenkins.plugins.mcp.server.Endpoint.sessionSweepInterval=1800 (seconds, default 1800, 0 disables)

[!WARNING] io.jenkins.plugins.mcp.server.Endpoint.allowUnauthenticatedMcp=true weakens CSRF protection. MCP POSTs that send an Authorization header are exempt from the crumb, because a page on another site cannot add that header. Anonymous and session-cookie clients are not exempt unless this property is set. With it on, those POSTs rely on the Origin check, which allows a missing Origin and does nothing when the Jenkins root URL is unset. Leave the property false on any controller that browsers or anonymous users can reach. mvn hpi:run sets it so a local development controller accepts an MCP client without a crumb.

Origin header validation

在 GitHub 查看完整 README

安装

npx mcp-remote http://jenkins-host/mcp-server/mcp --header Authorization: Bearer ${AUTH_TOKEN}
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "jenkins": { "autoApprove": [ ], "disabled": false, "timeout": 60, "type": "streamableHttp", "url": "https://jenkins-host/mcp-server/mcp", "headers": { "Authorization": "Basic <user:token base64>" } } } }