npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

auto-deploy-mcp-server

v1.0.1

Published

自动化部署MCP服务器,支持GitLab标签创建、CI编译和工单提交

Readme

自动化部署 MCP 服务器

这是一个使用 MCP(Model Context Protocol)实现的自动化部署服务器,可以用于简化 GitLab 项目的标签创建、CI 编译和工单提交流程。

🚀 功能特性

  • 完整自动化流程: 一键执行 GitLab 标签创建 → CI 编译 → 工单提交
  • GitLab 集成: 自动创建时间戳标签(格式:YYMMDD_HHMM)
  • CI/CD 支持: 自动触发 OMS 系统的 CI 编译流程
  • 工单管理: 自动创建发布工单并分配用户
  • 发布列表: 获取和展示发布历史记录
  • 时间推算: 智能计算发布时间范围
  • MCP 协议: 支持 Claude Desktop 等 AI 工具集成
  • 通过项目名称搜索 GitLab 项目
  • 创建 GitLab 标签
  • 执行 CI 编译
  • 提交工单
  • 查看发布记录

📦 安装

通过 npm 安装(推荐)

# 全局安装
npm install -g auto-deploy-mcp-server

# 或者本地安装
npm install auto-deploy-mcp-server

从源码安装

# 克隆项目
git clone <repository-url>
cd auto-deploy-mcp-server

# 安装依赖
npm install

# 链接为全局命令
npm link

🛠️ MCP 配置

1. 启动 MCP 服务器

# 如果全局安装
auto-deploy-mcp

# 如果本地安装
npx auto-deploy-mcp

# 或者直接运行
node mcp-server-new.js

2. 配置 Claude Desktop

将以下配置添加到 Claude Desktop 的 MCP 设置中:

{
  "mcpServers": {
    "auto-deploy-mcp-server": {
      "command": "npx",
      "args": ["auto-deploy-mcp"],
      "cwd": "/path/to/your/project",
      "description": "自动化部署流程MCP服务器"
    }
  }
}

🔧 可用工具

1. auto_deploy_flow

执行完整的自动化部署流程

功能: 创建GitLab标签 → CI编译 → 提交工单 参数:

  • projectName: 项目名称
  • message: tag信息
  • ref: tag分支(默认:master) 返回: 完整的执行报告和详情页链接

2. create_gitlab_tag

创建 GitLab 标签

功能: 基于当前时间自动生成标签 参数: 无 返回: 标签详细信息

3. execute_ci_build

执行 CI 编译

功能: 触发 OMS 系统的 CI 编译流程 参数: 无 返回: 编译状态

4. create_work_order

创建工单

功能: 创建发布工单并自动分配用户 参数:

  • publishTag (可选): 发布标签,默认使用最新标签 返回: 工单详细信息

5. get_publish_list

获取发布列表

功能: 查询发布历史记录 参数:

  • page (可选): 页码,默认1
  • page_size (可选): 每页数量,默认15
  • keyword (可选): 关键词搜索
  • status (可选): 状态过滤
  • search_type (可选): 搜索类型,默认'myself'
  • publish_type (可选): 发布类型,默认'PUBLISH'

6. show_recent_publishes

显示最近发布记录

功能: 以表格形式展示最近的发布记录 参数:

  • count (可选): 显示数量,默认5
  • keyword (可选): 关键词搜索
  • status (可选): 状态过滤 返回: 格式化的表格和详情页链接

7. get_time_range

计算时间范围

功能: 根据小时数计算未来时间范围 参数:

  • hours (必需): 往后推的小时数 返回: 开始时间、结束时间和时间范围数组

⚙️ 配置说明

环境变量

可通过环境变量覆盖默认配置:

# GitLab 配置
GITLAB_HOST=https://code.qschou.com
GITLAB_TOKEN=your-gitlab-token
PROJECT_ID=3442
REF=master
MESSAGE=上线tag

默认配置

const GITLAB_CONFIG = {
  HOST: "https://code.qschou.com",
  TOKEN: "glpat-yruxzDESzqxSFQ1MoMgH",
  PROJECT_ID: 3442,
  REF: "master",
  MESSAGE: "上线tag",
};

const OMS_CONFIG = {
  BASE_URL: "https://oms.qingsongchou.net/new/api",
  BUSINESS_ID: 1217,
  APP_ID: "med-survey-web",
  USERS: {
    DEVELOPER: "王文朝",
    CHECKER: "罗宇",
  },
};

📋 使用示例

在 Claude 中使用

  1. 执行完整部署流程:

    请使用 auto_deploy_flow 工具执行完整的自动化部署流程
  2. 查看最近发布记录:

    请使用 show_recent_publishes 工具显示最近5条发布记录
  3. 计算时间范围:

    请使用 get_time_range 工具计算3小时后的时间范围

独立运行

# 运行原始脚本
npm start

# 查看使用示例
npm run example

# 启动 MCP 服务器
npm run mcp-server

🏗️ 项目结构

newMCP/
├── config/            # 配置文件
│   ├── gitlab.js      # GitLab 配置
│   └── oms.js         # OMS 系统配置
├── lib/               # 功能库
│   ├── gitlab.js      # GitLab 相关功能
│   ├── oms.js         # OMS 系统相关功能
│   └── utils.js       # 通用工具函数
├── services/          # 服务层
│   ├── flow.js        # 自动化部署流程
│   ├── handlers.js    # 工具调用处理程序
│   └── tools.js       # 工具定义
├── mcp-server-new.js  # 主入口文件
└── package.json       # 项目配置

🔄 工作流程

  1. 创建标签: 基于当前时间生成唯一标签(YYMMDD_HHMM)
  2. CI 编译: 自动触发 OMS 系统编译流程
  3. 创建工单: 生成发布工单,自动分配开发者和审核者
  4. 获取详情: 返回最新发布记录的详情页链接

⚠️ 注意事项

  • 确保 GitLab 访问令牌有足够权限
  • 确保 OMS 系统的认证信息有效
  • 所有时间计算使用 Asia/Shanghai 时区
  • 网络请求失败会抛出详细错误信息
  • MCP 服务器需要持续运行以响应工具调用

🆘 故障排查

常见问题

  1. GitLab 标签创建失败

    • 检查 GITLAB_TOKEN 权限
    • 确认 PROJECT_ID 正确
    • 验证网络连接
  2. CI 编译失败

    • 检查 OMS 系统认证
    • 确认项目配置正确
    • 查看错误详情
  3. 工单创建失败

    • 检查用户映射配置
    • 确认业务权限
    • 验证时间格式

调试模式

修改 mcp-server.js 中的错误处理以获取更详细的调试信息:

} catch (error) {
  console.error('详细错误信息:', error);
  throw new McpError(ErrorCode.InternalError, `工具执行失败: ${error.message}\n调试信息: ${error.stack}`);
}

📈 性能优化

  • 所有网络请求都有错误处理
  • 删除了不必要的延时,提升执行速度
  • 统一的错误处理和日志输出
  • 支持并发执行多个工具

🤝 贡献

欢迎提交 Issue 和 Pull Request!

�� 许可证

MIT License