管道mcp
  
pipeline-mcp 是用于CI/CD诊断和补救工作流程的Go MCP服务器。GitHub Actions仍然是默认提供程序,工具输入现在接受可选 provider 用于提供者感知路由的字段。
MVP功能
pipeline.get_run:从以下位置规范化运行元数据run_url,run_id + repository,或repository在最近一次失败的跑步中,他独自一人。pipeline.diagnose_failure:根据以下证据对故障类别进行分类,并返回排名修复建议run_url,run_id + repository,或repository在最近一次失败的跑步中,他独自一人。pipeline.analyze_flaky_tests:根据频率、新近度和置信度识别顶级片状测试。pipeline.rerun:触发受控的重新运行,并带有明确的原因和审计日志。pipeline.compare_performance:将当前窗口度量与前一个基线窗口进行比较。- 所有工具都接受可选
provider输入;省略它将保留GitHub Actions作为默认值。
开源默认值
- 麻省理工学院获得了重用和贡献许可。
- 受保护的
main分支具有所需的拉取请求和状态检查。 - GitHub仅拥有Actions,以及依赖性审查和CodeQL扫描。
- Dependabot更新Go模块和GitHub操作。
- 贡献者工作流文档 贡献.md, 安全.md,以及 代码_OF_CONDUCT.md.
- 代码所有者、问题模板和拉取请求模板,用于一致的接收和审查。
AI协助
该项目使用人工智能辅助开发。
人工智能辅助提交必须包括一个 AI-assisted-by 每使用一个工具的拖车, 包括用于工作的模型。参见 贡献.md 了解完整的政策和示例。
建筑
cmd/pipeline-mcp:服务器入口点。internal/githubapi:GitHub Actions适配器(运行元数据、作业、日志、重新运行、重试/回退)。internal/analysis:编辑、诊断启发式、零散分析、性能聚合。internal/service:编排、验证、工具错误映射。internal/audit:用于变异工具的持久JSONL审计事件。internal/telemetry:内存延迟/错误/置信度跟踪,可选导出。tools:MCP工具合同和处理程序。
先决条件
- GitHub代币
actions:read用于阅读工具 - 可选写入令牌
actions:write为了pipeline.rerun - 走
1.26+只有当你从源代码构建时
配置
环境变量:
SERVER_NAME(默认值:pipeline-mcp)VERSION(默认:官方二进制文件的release标签,或dev对于本地源代码构建)LOG_LEVEL(debug|info|warn|error,默认值:info)GITHUB_API_BASE_URL(默认值:https://api.github.com)GITHUB_READ_TOKEN(推荐)GITHUB_WRITE_TOKEN(需要时DISABLE_MUTATIONS=false;无共享回退)GITHUB_TOKEN或GH_TOKEN可以用作回退GITHUB_READ_TOKENDISABLE_MUTATIONS(默认值:true)AUDIT_LOG_PATH(默认值:var/audit-events.jsonl)AUDIT_SIGNING_KEY(用于防篡改审计签名的可选HMAC密钥)METRICS_EXPORT_PATH(可选JSON快照路径)MAX_LOG_BYTES(默认值:20971520)DEFAULT_LOOKBACK_DAYS(默认值:14)MAX_HISTORICAL_RUNS(默认值:100)HTTP_TIMEOUT_SECONDS(默认值:25)USER_AGENT(默认值:pipeline-mcp/)ACTOR(默认值:pipeline-mcp)
当 AUDIT_SIGNING_KEY 未设置,审核条目省略 signature 而不是发布一个误导性的未经编辑的摘要。
有关最低权限令牌设置和释放操作,请参阅 docs/operator-guide.md.
安装
官方发布档案已发布 darwin 和 linux 上 amd64 和 arm64. 带有预发布标识符的标签,例如 -rc.1 或 -beta.1 自动发布为GitHub预发布。
当前预发布示例:
VERSION=v0.1.0-rc.1
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
case "$ARCH" in
x86_64) ARCH=amd64 ;;
arm64|aarch64) ARCH=arm64 ;;
*)
echo "unsupported architecture: $ARCH" >&2
exit 1
;;
esac
ARCHIVE="pipeline-mcp_${VERSION}_${OS}_${ARCH}.tar.gz"
BASE_URL="https://github.com/keithdoyle9/pipeline-mcp/releases/download/${VERSION}"
curl --fail -LO "${BASE_URL}/${ARCHIVE}"
curl --fail -LO "${BASE_URL}/checksums.txt"
if command -v sha256sum >/dev/null 2>&1; then
grep " ${ARCHIVE}\$" checksums.txt | sha256sum -c -
else
grep " ${ARCHIVE}\$" checksums.txt | shasum -a 256 -c -
fi
tar -xzf "${ARCHIVE}"
install -m 0755 pipeline-mcp /usr/local/bin/pipeline-mcp安装之前,上述校验和验证命令必须成功。
默认情况下,服务器在stdio传输上运行。
对于Claude Code,在注册MCP服务器时附加令牌:
claude mcp add --scope local -e GITHUB_READ_TOKEN=your_token_here -- pipeline-mcp "$(command -v pipeline-mcp)"如果您更喜欢使用Go从源代码安装:
go install github.com/keithdoyle9/pipeline-mcp/cmd/pipeline-mcp@latest从源代码构建
go build -o bin/pipeline-mcp ./cmd/pipeline-mcp
./bin/pipeline-mcp仅存储库快捷方式示例:
Use pipeline.get_run with repository="owner/repo" to inspect the latest failed run.
Use pipeline.diagnose_failure with repository="owner/repo" to diagnose the latest failed run.
Add provider="github_actions" explicitly only when you need to override default routing behavior.GitHub存储库保护
此存储库的GitHub推荐姿态:
- 需要拉取请求
main. - 要求
verify和dependency-review合并前检查是否通过。 - 不允许强制推送和删除分支
main. - 将GitHub操作限制为GitHub拥有的操作。
- 启用CodeQL、Dependabot安全更新、秘密扫描和私有漏洞报告。
- 将工作流令牌权限保留在
read默认情况下。
测试
go test ./...运行基准线束:
./scripts/run-benchmarks.sh在本地验证发布配置:
./scripts/verify-release.sh发布验证脚本运行 go vet、测试、基准夹具, govulncheck,单二进制编译,以及固定的GoReleaser检查。它回落到固定状态 go run 调用如果 govulncheck 或 goreleaser 尚未安装。
基准夹具已安装 testdata/benchmarks/historical_failures.json.
刀具误差包络
所有工具在适用时都会返回一个结构化错误对象:
codemessageremediationretryabledetails
MVP支持的代码:
UNAUTHORIZEDLOG_UNAVAILABLERATE_LIMITEDINVALID_INPUTPROVIDER_UNAVAILABLEINTERNAL
诊断示例
山宁泰示例输出 pipeline.get_run 和 pipeline.diagnose_failure:
# Pipeline Failure Diagnosis
**Workflow**: Release Validation
**Run ID**:
**Run URL**: https://github.com///actions/runs/
**Commit**: ``
**Diagnosed At**:
**Confidence**: 94%
## Root Cause
**Failure Category**: `config_error`
**Impacted Job**: `ios-release-candidate`
Branch `main` is blocked by environment protection rules for ``. Allowed deployment branches currently match: `release/*`.
## Evidence
1. `"Branch 'main' is not allowed to deploy to due to environment protection rules."`
2. `"The deployment was rejected or didn't satisfy other protection rules."`
## Fix Recommendations
1. Allow branch `main` to deploy to ``, or broaden the environment branch policy.
2. Run the workflow from a branch that matches `release/*`.
3. Route `main` dispatches to a less restricted environment instead of ``.安全说明
- 在诊断输出之前应用日志编辑。
- 默认情况下,突变工具处于禁用状态(
DISABLE_MUTATIONS=true). - 每次重新运行都会发出一个可审计的事件,其中包含参与者、原因、范围和时间戳。
治理
- 贡献指南: 贡献.md
- 安全策略: 安全.md
- 行为准则: 代码_OF_CONDUCT.md
- 许可证: 许可证
