MCP Hub
Back to servers

@code-sugar/mcp-server-routine-bot

Validated

A toolset for automating routine DevOps and web operations, providing integration for Jenkins job management, GitLab merge request workflows, and advanced web scraping capabilities.

Stars
1
Tools
8
Updated
Nov 11, 2025
Validated
Jan 9, 2026
Validation Details

Duration: 7.5s

Server: mcp-server-routine-bot v1.2.0

Quick Install

npx -y @code-sugar/mcp-server-routine-bot

MCP Server Routine Bot

Version License Downloads Status

一个基于模型上下文协议(MCP)的服务器,旨在通过智能任务自动化来简化日常操作并提高工作效率。

⚠️ 注意:此项目正在积极开发中。功能可能会发生变化,某些功能可能不完整或不稳定。

概述

MCP-Server-Routine-Bot 基于模型上下文协议(MCP)框架构建,是我个人用于学习 MCP 的项目,内置的工具旨在为我处理日常工作中重复的操作,例如代码合并、版本发布等。

主要特性

  • 任务自动化:自动处理重复的日常操作
  • 工具集成:原生支持 Jenkins、GitLab 和网页抓取功能
  • 智能工作流:为各种场景提供可定制的自动化流程
  • 网络代理支持:内置企业级代理配置功能
  • 实时监控:跟踪和管理自动化进程
  • 热重载:支持 HRM 的开发友好架构

可用工具

Jenkins 工具

工具名称描述参数
jenkins_job_list获取 Jenkins 中的所有作业列表
jenkins_job_build触发指定 Jenkins 作业的构建jobName (必需)

GitLab 工具

工具名称描述参数
gitlab_create_merge_request在 GitLab 中创建合并请求projectId, projectName, sourceBranch, targetBranch
gitlab_merge_merge_request在 GitLab 中合并指定的合并请求projectId (必需), mergeRequestIid (必需)

网页抓取工具

工具名称描述参数
fetch_html获取网页原始 HTML 内容url (必需), headers, max_length, start_index
fetch_json抓取并解析 JSON 文件url (必需), headers, max_length, start_index
fetch_txt获取纯文本内容(移除HTML标签)url (必需), headers, max_length, start_index
fetch_markdown将网页内容转换为 Markdown 格式url (必需), headers, max_length, start_index

使用示例

Jenkins 操作

# 获取作业列表
jenkins_job_list

# 构建指定作业
jenkins_job_build({"jobName": "my-project"})

GitLab 操作

# 创建合并请求
gitlab_create_merge_request({
  "projectName": "my-project",
  "sourceBranch": "feature-branch",
  "targetBranch": "main"
})

# 合并指定的合并请求(使用创建时返回的 IID)
gitlab_merge_merge_request({
  "projectId": 123,
  "mergeRequestIid": 456
})

网页抓取操作

# 获取网页 HTML 内容
fetch_html({
  "url": "https://example.com",
  "max_length": 5000
})

# 抓取 JSON 文件
fetch_json({
  "url": "https://api.example.com/data.json",
  "headers": {
    "Authorization": "Bearer token"
  }
})

# 获取纯文本内容
fetch_txt({
  "url": "https://example.com/article.html",
  "start_index": 100,
  "max_length": 2000
})

# 转换为 Markdown
fetch_markdown({
  "url": "https://example.com/documentation.html",
  "max_length": 10000
})

快速开始

配置

使用您的平台凭证配置服务器:

{
  "mcpServers": {
    "mcp-server-routine-bot": {
      "command": "npx",
      "args": ["-y", "@code-sugar/mcp-server-routine-bot@latest"],
      "env": {
        "JENKINS_BASE_URL": "jenkins_base_url",
        "JENKINS_USERNAME": "jenkins_username",
        "JENKINS_ACCESS_TOKEN": "jenkins_access_token",
        "GITLAB_BASE_URL": "gitlab_base_url",
        "GITLAB_ACCESS_TOKEN": "gitlab_access_token",
        "HTTP_PROXY": "http://proxy.example.com:8080",
        "HTTPS_PROXY": "https://proxy.example.com:8080"
      }
    }
  }
}

环境变量

变量名必需默认值说明
JENKINS_BASE_URL-Jenkins 服务器基础地址
JENKINS_USERNAME-Jenkins 用户名
JENKINS_ACCESS_TOKEN-Jenkins API 访问令牌
GITLAB_BASE_URL-GitLab API 基础地址
GITLAB_ACCESS_TOKEN-GitLab API 访问令牌
HTTP_PROXY-HTTP 代理服务器地址
HTTPS_PROXY-HTTPS 代理服务器地址

代理配置说明

网页抓取工具支持通过环境变量配置代理,适用于企业网络环境:

# 基本代理配置
export HTTP_PROXY=http://proxy.company.com:8080
export HTTPS_PROXY=https://proxy.company.com:8080

# 带认证的代理配置
export HTTP_PROXY=http://username:password@proxy.company.com:8080
export HTTPS_PROXY=https://username:password@proxy.company.com:8080

代理优先级HTTPS_PROXY > https_proxy > HTTP_PROXY > http_proxy

开发指南

环境要求

  • Node.js >= 18
  • npm 或 yarn

安装设置

  1. 克隆仓库:

    git clone https://github.com/PassionZale/mcp-server-routine-bot.git
    cd mcp-server-routine-bot
    
  2. 安装依赖:

    npm install
    
  3. 创建环境配置:

    cp .env.example .env
    # 编辑 .env 文件填入凭证信息
    

开发模式

方式 1:MCP Inspector(无热重载)

用于调试和检查:

  1. 启动开发服务器:

    npm run inspector
    
  2. 配置 MCP 客户端:

    {
      "mcpServers": {
        "local-mcp-server-routine-bot": {
          "command": "node",
          "args": ["/path/to/your/mcp-server-routine-bot/dist/index.js"],
          "env": {
            "JENKINS_BASE_URL": "jenkins_base_url",
            "JENKINS_USERNAME": "jenkins_username",
            "JENKINS_ACCESS_TOKEN": "jenkins_access_token",
            "GITLAB_BASE_URL": "gitlab_base_url",
            "GITLAB_ACCESS_TOKEN": "gitlab_access_token",
            "HTTP_PROXY": "http://proxy.example.com:8080",
            "HTTPS_PROXY": "https://proxy.example.com:8080"
          }
        }
      }
    }
    

注意

  • inspector 命令会自动从 .env 文件读取环境变量
  • 修改 src/index.tssrc/server.ts 需要手动重启服务器
  • 修改其他文件需要重新运行 inspector 命令

方式 2:Reloaderoo(支持热重载)

用于支持热重载的开发:

  1. 全局安装 reloaderoo:

    npm install -g reloaderoo
    
  2. 启动开发服务器:

    npm run build:watch
    
  3. 配置 MCP 客户端:

    {
      "mcpServers": {
        "dev-mcp-server-routine-bot": {
          "command": "reloaderoo",
          "args": [
            "proxy",
            "log-level",
            "debug",
            "--",
            "node",
            "/path/to/your/mcp-server-routine-bot/dist/index.js"
          ],
          "env": {
            "JENKINS_BASE_URL": "jenkins_base_url",
            "JENKINS_USERNAME": "jenkins_username",
            "JENKINS_ACCESS_TOKEN": "jenkins_access_token",
            "GITLAB_BASE_URL": "gitlab_base_url",
            "GITLAB_ACCESS_TOKEN": "gitlab_access_token",
            "HTTP_PROXY": "http://proxy.example.com:8080",
            "HTTPS_PROXY": "https://proxy.example.com:8080"
          }
        }
      }
    }
    

生产构建

npm run build

编译后的文件将在 dist/ 目录中。

故障排除

常见问题

  1. 服务器无响应:确保所有必需的环境变量都已设置
  2. 认证错误:验证访问令牌是否有效且具有适当权限
  3. 连接超时:检查到配置服务的网络连接
  4. 代理连接失败:验证代理 URL 格式正确且代理服务可访问
  5. 网页抓取失败:检查目标 URL 是否可访问,网络连接是否正常

调试

通过设置日志级别启用调试日志:

# 使用 reloaderoo 时
reloaderoo proxy log-level debug -- node dist/index.js

贡献

  1. Fork 仓库
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 打开 Pull Request

许可证

本项目基于 MIT 许可证 - 查看 LICENSE 文件了解详情。

作者

Lei Zhang - @PassionZale

项目链接:https://github.com/PassionZale/mcp-server-routine-bot

Reviews

No reviews yet

Sign in to write a review