
动作测试MCP
](https://www.npmjs.com/package/act-testing-mcp) ](https://www.npmjs.com/package/act-testing-mcp)  
用于本地测试GitHub Actions工作流的模型上下文协议(MCP)服务器 联系/行动.
目的
此MCP为人工智能助手(如Claude)提供了直接访问本地测试GitHub Actions工作流的权限,消除了使用CI/CD管道时的试错开发周期。
特性
- 🔍 列出工作流:在任何存储库中发现所有可用的GitHub Actions工作流
- ▶️ 运行工作流:使用act在本地执行工作流
- ✅ 验证语法:提交前检查工作流文件是否有错误
- 🎭 自定义事件:使用自定义事件数据测试工作流,以模拟不同的场景
- 🐛 调试支持:详细的日志记录和错误报告
- 📊 依赖性监控:轨道
act兼容性和检测破坏性更改 - 🔐 供应链安全:发布了可验证构建的npm出处证明
先决条件
- Docker桌面 (跑步)
- 联系/行动 已安装(安装指南)
- Node.js 20+
安装游泳设备
# macOS
brew install act
# Linux (with curl)
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
# Windows (with chocolatey)
choco install act-cli
# Or download from releases
# https://github.com/nektos/act/releases安装
npm install -g act-testing-mcp验证包完整性
此软件包随发布 以增强供应链安全。您可以验证包裹的证明:
npm audit signatures或者克隆并在本地运行:
git clone https://github.com/GarthDB/act-testing-mcp.git
cd act-testing-mcp
npm install配置
MCP设置
添加到您的MCP配置中(例如。, .cursor/mcp.json 对于游标IDE):
选项1:使用npx(推荐)
{
"mcpServers": {
"act-testing": {
"command": "npx",
"args": ["act-testing-mcp"]
}
}
}选项2:使用全局安装
{
"mcpServers": {
"act-testing": {
"command": "act-testing-mcp"
}
}
}选项3:使用自定义项目路径(如果需要)
{
"mcpServers": {
"act-testing": {
"command": "npx",
"args": ["act-testing-mcp"],
"env": {
"PROJECT_ROOT": "/path/to/your/project"
}
}
}
}方案4:地方发展
{
"mcpServers": {
"act-testing": {
"command": "node",
"args": ["./path/to/act-testing-mcp/index.js"],
"env": {
"PROJECT_ROOT": "/path/to/your/project",
"ACT_BINARY": "act"
}
}
}
}动作配置
创建一个 .actrc 项目根目录中的文件(从示例中复制):
# Copy example configuration and customize paths
cp mcp-config.example.json .cursor/mcp.json
# Edit .cursor/mcp.json to set your PROJECT_ROOT path
# Copy act configuration (optional)
cp .actrc /path/to/your/project/.actrc提供的工具
list_workflows
列出存储库中所有可用的GitHub Actions工作流。
参数: 无
例子:
📋 **CI** (ci.yml)
Job: test (test)
Events: push, pull_request
📋 **Release** (release.yml)
Job: release (release)
Events: workflow_dispatchrun_workflow
使用act在本地运行工作流。
参数:
workflow(必填):工作流文件名或作业IDevent(可选):事件类型(推送、拉取请求等)dryRun(可选):显示执行计划而不运行verbose(可选):启用详细输出env(可选):环境变量secrets(可选):要提供的秘密eventData(可选):用于测试的自定义事件数据
示例:
# Run CI workflow
run_workflow workflow="ci.yml" event="push"
# Dry run with custom event data
run_workflow workflow="ci.yml" event="pull_request" dryRun=true eventData='{"number": 123}'
# Run with environment variables
run_workflow workflow="release.yml" env='{"NODE_ENV": "production"}'validate_workflow
验证工作流语法和结构。
参数:
workflow(必需):要验证的工作流文件名
act_doctor
检查act配置和Docker设置。
参数: 无
使用示例
人工智能助理(Claude)
配置后,您可以要求您的AI助手直接测试工作流:
- _“测试我的CI工作流”_
- _“以模拟运行模式运行发布工作流”_
- _“检查我的新工作流文件是否有效”_
- _“使用自定义PR数据测试拉取请求工作流”_
直接使用
# Start the MCP server
npm start
# Run tests
npm test
# Run with coverage
npm run test:coverage
# Debug mode
npm run dev发展
运行测试
# Install dependencies
npm install
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run in watch mode
npm run test:watch测试覆盖
该工具包括全面的测试:
- 单元测试 使用AVA框架
- 集成测试 使用real act和Docker
- 代码覆盖率 c8(核心逻辑目标为70%+)
- ES模块 支持原生Node.js
兼容性监控
随时间推移跟踪行为兼容性:
# Create baseline
npm run compatibility:baseline
# Check for changes
npm run compatibility:check
# Generate detailed report
npm run compatibility:report项目结构
act-testing-mcp/
├── index.js # Main MCP server
├── package.json # Dependencies and scripts
├── README.md # This file
├── LICENSE # Apache 2.0 license
├── .actrc # Act configuration example
├── ava.config.js # Test configuration
├── mcp-config.example.json # MCP configuration example
├── utils/ # Utility modules
│ ├── act-helpers.js # Core act integration
│ └── act-monitor.js # Compatibility monitoring
├── scripts/ # Utility scripts
│ └── check-act-compatibility.js
├── test/ # Test suites
│ ├── index.test.js
│ ├── act-compatibility.test.js
│ ├── act-monitor.test.js
│ └── utils.test.js
└── docs/ # Additional documentation
├── SETUP.md
├── GUIDE.md
├── TESTING.md
└── DEPENDENCY_MONITORING.md故障排除
Docker问题
# Check Docker is running
docker ps
# Pull required images
docker pull catthehacker/ubuntu:act-latest法案问题
# Check act installation
act --version
# Test act with simple workflow
act --listMCP连接问题
- 验证MCP配置文件路径
- 检查Node.js路径是否正确
- 确保设置了PROJECT_ROOT环境变量
- 检查项目是否具有
.github/workflows/目录
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 添加新功能的测试
- 确保所有测试通过
- 提交拉取请求
许可证
此项目根据Apache许可证2.0获得许可-请参阅 许可证 文件以获取详细信息。
相关项目
支持
______________________________________________________________________
备注:此工具最初是为 Adobe Spectrum代币 该项目已被提取为一个独立的、可重用的MCP服务器。
