Skip to main content
Glama

MCP 詹金斯

PyPI 版本PyPI - 下载 PyPI 下载 铁匠徽章 测试执照

模型上下文协议 (MCP) 是一个开源实现,它遵循 Anthropic 的 MCP 规范,将 Jenkins 与 AI 语言模型连接起来。该项目支持与 Jenkins 工具进行安全的、上下文相关的 AI 交互,同时确保数据隐私和安全。

光标演示

光标演示

Related MCP server: Upstash MCP Server

设置指南

安装

选择以下安装方法之一:

# 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

配置和使用

光标

  1. 打开游标设置

  2. 导航至 MCP

  3. 点击“+添加新的全局 MCP 服务器”

这将使用您的 MCP 服务器配置创建或编辑 ~/.cursor/mcp.json 文件。

{
  "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())

可用工具

工具

描述

获取所有作业

获取所有职位

获取作业配置

获取作业配置

搜索职位

按特定领域搜索职位

获取运行构建

开始运行构建

获取构建信息

获取构建信息

获取工作信息

获取工作信息

构建作业

使用参数构建作业

获取构建日志

获取构建日志

获取所有节点

获取节点

获取节点配置

获取节点的配置

获取所有队列项目

获取所有队列项

获取队列项

获取队列项目信息

取消队列项目

取消队列项目

开发与调试

# 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 官方产品。

Latest Blog Posts

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/lanbaoshen/mcp-jenkins'

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