Skip to main content
Glama
Alex0AI

RepoImmune MCP Server

by Alex0AI

RepoImmune 将仓库中已解决的 bug 转化为代码原生、有证据支撑的检查项,供人类和编码代理查询。

输入

处理

输出

一个 GitHub 仓库或 PR 差异

检索历史 issue → 修复 → 测试 → AST 证据

精确的回归位置、源码链接、受保护的测试,以及历史修复方案

RepoImmune 实时演示:补丁证据与胶囊回放

60 秒快速上手

git clone https://github.com/Alex0AI/RepoImmune.git
cd RepoImmune
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
python -m pip install -e .
repoimmune init .
repoimmune check --diff examples/reintroduce-astropy-12907.diff --memory examples/memory
repoimmune replay astropy-12907 --memory examples/memory
repoimmune report --format html

该演示离线运行、无需密钥、运行时零依赖。检查项有意以退出码 2 结束,因为它发现了一个来自 Astropy PR #12907 的真实历史回归。

Related MCP server: cms mcp

什么是可执行记忆?

行为卡(Behavior Card)不是聊天摘要。它将一个不变式绑定到修复前/后的代码、AST 形式、精确符号、回归测试、提交、源码 URL、许可证、证据类别,以及一个可选的回放胶囊。当证据链不完整时,RepoImmune 拒绝提升挖掘出的候选结果。

flowchart LR
  I[Issue / report] --> B[Buggy commit]
  B --> F[Failing behavior]
  F --> P[Fix PR / commit]
  P --> T[Regression test]
  T --> S[AST + symbol change]
  S --> V[Repository invariant]
  V --> C[Patch immunity check]

内置的垂直切片能检测到这一精确的还原:

- cright[-right.shape[0]:, -right.shape[1]:] = right
+ cright[-right.shape[0]:, -right.shape[1]:] = 1

它会报告精确的行号,解释为什么全 1 代码块在历史上是错误的,链接到 issue/PR/合并提交,并指出随修复一起添加的 pytest 用例。

CLI

repoimmune init .
repoimmune mine --repo owner/project
repoimmune check --diff HEAD~1
repoimmune recall "pagination returns duplicate rows"
repoimmune explain <behavior-card-id>
repoimmune replay <capsule-id>
repoimmune report --format html
repoimmune validate <card.json>

check 输出 Markdown、JSON 或 SARIF 格式。mine 仅保存保守的候选结果;它从不调用 LLM,也不会仅凭标题就声称生成了行为卡。

代理与 CI 集成

  • 复合 GitHub Action 以只读方式分析拉取请求差异,并上传 SARIF/Markdown 证据。

  • stdio MCP 服务器暴露六个结构化的只读工具:search_past_failuresexplain_code_historycheck_patch_against_memorylist_invariants_for_fileget_regression_testreplay_behavior_case

  • 开放的 Agent Skill 要求代理在风险编辑之前回忆历史,并在声称完成之前再次回忆。它不授予任何提交、推送、合并或绕过测试的权限。

  • 静态演示无需登录或 API 密钥即可运行。

证据类别

每个结果都明确属于以下类别之一:

  • verified:已直接回放或通过主要代码/测试证据进行机械佐证。

  • externally_reported:受信任的上游或基准执行记录,未在此复现。

  • heuristic:有用的候选或相似性信号,并非证明。

  • inconclusive:证据冲突或不完整。

相似度分数永远不会被当作证明。发现结果始终显示匹配的代码和来源证据。

为什么与众不同

  • 代理/聊天记忆: 记住对话或仓库事实;RepoImmune 挖掘代码历史并创建超越任何代理会话存续期的机械检查。

  • SWE-bench: 评估代理能否修复 issue;RepoImmune 将已解决的 issue 转化为持久的预防资产。

  • 静态分析: 从通用规则出发;RepoImmune 从该仓库的真实失败中学习仓库特定的不变式。

  • 测试生成: 可能创建测试;RepoImmune 保留报告、缺陷/修复代码、测试和不变式之间的因果链。

  • git blame: 说明谁改的、何时改的;RepoImmune 解释为什么行为必须存续,并能对其进行检查。

参见 research-landscape.md 获取有证据支撑的对比。

安全模型

Issue 文本、PR 评论、代码、补丁和仓库元数据均为不可信数据。RepoImmune 从不将它们作为指令来执行。挖掘使用有界 HTTPS 响应;引用和仓库名称经过验证;胶囊运行使用固定 argv 且不经过 shell,拒绝绝对路径和符号链接,并设有超时。默认情况下,从不运行未知仓库的安装脚本或测试。参见 SECURITY.mddocs/threat-model.md

当前范围与诚实的局限

alpha 版本深度支持 Python AST 和 pytest 证据。TypeScript/TSX 有一个可选的固定版本 tree-sitter 适配器,用于规范化结构和调用提取;JavaScript 使用确定性 token 结构,Jest/Vitest 可被记录为测试证据。全程序过程间可达性分析、自动上游环境重建以及广泛的语言支持属于路线图项目。数据集规模的卡片在回放之前均为 externally_reported;捆绑的 Astropy 垂直切片是 v0.1.0 中唯一在本地验证的行为胶囊。

可复现性

python scripts/build_research_snapshot.py --limit 500 --cards 120
python scripts/run_experiments.py
pytest
coverage run -m pytest && coverage report
ruff check . && mypy src/repoimmune

所有已发布的数据都会重新生成到 research/results.json 中;分类和局限会被保留,包括失败或不确定的案例。数据来源记录在 DATA_SOURCES.mdTHIRD_PARTY.mdresearch/data-card.md 中。

已提交的 v0.1 快照包含 500 个候选、120 张行为卡、12 个仓库和 30 个轻量级结构胶囊。在确定性变异上,它检测到了 120/120 个精确的历史还原和 120/120 个受保护的断言删除;同符号固定形式的重构产生了 9/120 个误报(7.5%)。基于标题的检索达到了 Recall@5/MRR 1.0/1.0,但这明确是一个同源管道测试。独立的挖掘精度和受控的 Agent A/B 测试仍无定论。

贡献

在提出新的挖掘器或证据来源之前,请阅读 CONTRIBUTING.md路线图 和行为卡模式。采用 Apache-2.0 许可证。

中文说明:README.zh-CN.md

A
license - permissive license
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Exposes codebase memory as native tools for AI agents, enabling queries, feature tracing, impact analysis, and alignment verification.
    3
    AGPL 3.0
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI coding agents to retrieve QA cases from a curated knowledge base grounded in real bugs, supporting symptom search and feature-wide coverage for test planning.
    6
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    Enables autonomous infrastructure diagnostics, log root-cause analysis, and safe code patching via tools for querying logs, inspecting Python AST, and applying git-safe patches.
    3
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.

  • Git-backed platform for skills, tools, and context for AI agents

  • Browser-backed QA with evidence and fix-ready reports for coding agents.

View all MCP Connectors

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/Alex0AI/RepoImmune'

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