Repository navigation
Add a zero-auth MCP server (Context7) to the PR-review action agent runtime #816
Description
Story
As a platform owner,
I want a zero-auth MCP server (Context7, for technical/library docs) wired into the PR-review action agent runtime,
so that the review agent gains a real MCP-enriched capability that does not depend on a plan-gated GitHub feature.
Background
Follow-up to the Phase-2 pilot (#681), which closed not-planned on its recommended starter. Findings:
- MCP plumbing is proven end-to-end — pilot(mcp): thread REVIEW_MCP_ALLOWED_TOOLS into the review job env #809's env-mapping fix is merged;
REVIEW_MCP_ALLOWED_TOOLSreaches the live job env and the GitHub MCP server connects and tools are reachable. - The recommended starter, GitHub MCP
run_secret_scanning, is a content-scan API gated on the repo'sadvanced_securityflag (full GitHub Advanced Security) — a different flag than Secret Protection / push protection, and not available on this private repo's plan. Confirmed identically from two independent tokens. - Interim secret coverage is intact via the existing
Secret scan (gitleaks)CI check. - The pilot doc and [Phase 2] Pilot MCP-enriched review on one downstream repo and measure quality + latency #681 (AC test issue from agent #1) both name Context7 as the zero-auth fallback.
scripts/engine.shalready usesmcp__context7__*as its worked example. This issue executes that path.
Current wiring (verified, for the implementer)
- Config file:
scripts/engine.shauto-loadsREVIEW_MCP_CONFIGfrom the conventional path.github/review-mcp.jsonwhen present (no thin-caller workflow edit needed). That file today configures only the plan-blockedgithub/secret_protectionserver. - Allowlist knob:
.github/workflows/pr-review.ymlsetsREVIEW_MCP_ALLOWED_TOOLS: ${{ vars.REVIEW_MCP_ALLOWED_TOOLS || '' }}— i.e. it's driven by the repo variableREVIEW_MCP_ALLOWED_TOOLS(currentlymcp__github__*). The engine merges it into the deep + rubber-duck tiers'--allowed-tools(triage stays restricted). - Graceful degradation (
_emit_mcp_failure_warning, tested intests/dev-lead/unit/test_engine_mcp.bats) already covers a server being unavailable — confirm Context7-down still completes the review.
Concrete change
1. .github/review-mcp.json — replace the plan-blocked github/secret-scanning server with Context7's zero-auth HTTP endpoint (matches the existing "type": "http" style; no npx install needed in the runner):
{
"mcpServers": {
- "github": {
- "type": "http",
- "url": "https://api.githubcopilot.com/mcp/",
- "headers": {
- "Authorization": "Bearer ${GH_TOKEN}",
- "X-MCP-Toolsets": "secret_protection",
- "X-MCP-Tools": "run_secret_scanning"
- }
- }
+ "context7": {
+ "type": "http",
+ "url": "https://mcp.context7.com/mcp"
+ }
}
}Decision: replace rather than add — the github entry's only tool (
run_secret_scanning) is plan-blocked, so keeping it just emits an "unavailable" degradation warning on every review. Restore it later if/whenadvanced_securityis licensed. (Alt config form if a runner-local stdio server is ever preferred:{"command":"npx","args":["-y","@upstash/context7-mcp"]}— but the remote HTTP endpoint above is zero-install and zero-auth.)
2. Repo variable REVIEW_MCP_ALLOWED_TOOLS — change from mcp__github__* to:
mcp__context7__*
That permits Context7's tools (mcp__context7__resolve-library-id, mcp__context7__get-library-docs). Optional: Context7 accepts a CONTEXT7_API_KEY header for higher rate limits, but zero-auth works and is the point of this pilot — do not add a secret.
3. Docs — update docs/initiatives/mcp-powered-review.md §5 (and the §2 starter note) to record that the GitHub-MCP secret-scanning starter is plan-gated here (advanced_security unavailable) and Context7 is the actual pilot starter, per #681's outcome.
Acceptance Criteria
.github/review-mcp.jsonconfigures the zero-auth Context7 server; the repo variableREVIEW_MCP_ALLOWED_TOOLSis set tomcp__context7__*.- A
dry_run=trueforce-review run on a sample PR shows Context7 connected and its tools permitted (no "not permitted"), mirroring the pilot(mcp): thread REVIEW_MCP_ALLOWED_TOOLS into the review job env #809 verification. - A small sample of PRs is reviewed with Context7 on; qualitative findings captured (e.g. version-aware/library-doc findings the agent surfaced that it couldn't before).
- Latency delta vs. server-off recorded using existing tooling (
scripts/pr_review_health.sh/ daily health workflow) — no new harness. mcp-powered-review.mdupdated; a short note records findings + a rollout recommendation. Broader rollout stays a separate, explicit human decision.
Tasks
- Edit
.github/review-mcp.jsonper the diff above. - Update the
REVIEW_MCP_ALLOWED_TOOLSrepo variable tomcp__context7__*. - Dry-run force-review a sample PR; confirm Context7 connects + tools permitted (AC Go-live improvements for PR review agent #2).
- Confirm graceful degradation: simulate Context7 unreachable, verify the review still completes with the warning annotation.
- Run a sample of reviews; capture qualitative findings (AC Add @claude delegation, auto-merge, and rebase handling #3).
- Record latency delta via existing review-health tooling (AC Optimize review: small-PR and incremental fast paths #4).
- Update
docs/initiatives/mcp-powered-review.md; write the note + rollout recommendation (AC feat: add Copilot engine support via REVIEW_ENGINE toggle #5). -
shellcheck scripts/*.sh+ runtests/dev-lead/unit/test_engine_mcp.batsif engine wiring is touched.
References
- [Phase 2] Pilot MCP-enriched review on one downstream repo and measure quality + latency #681 (Phase-2 pilot; closed not-planned on the secret-scanning starter) · pilot(mcp): thread REVIEW_MCP_ALLOWED_TOOLS into the review job env #809 (env-mapping fix) · discussion MCP-Powered CI Review Enhancement — Standard #650 (Context7 as zero-auth fallback) · epic MCP-powered review enrichment for the self-hosted Claude review engine (engine.sh) #676
scripts/engine.sh(REVIEW_MCP_CONFIG/REVIEW_MCP_ALLOWED_TOOLSthreading;mcp__context7__*worked example).github/review-mcp.json,.github/workflows/pr-review.yml,docs/initiatives/mcp-powered-review.mdtests/dev-lead/unit/test_engine_mcp.bats
Activity
github-actions commentedon Jun 20, 2026
Thanks for the detailed write-up and for linking the full pilot history — the background on the advanced-security gate and the Context7 fallback makes the path forward very clear. Before diving into the wiring work, could you confirm the Context7 MCP server's launch method and endpoint (e.g.
npx @upstash/context7-mcpor a hosted URL), since that's the prerequisite for everything else in the task list and will determine how the runtime config needs to look?don-petry commentedon Jun 20, 2026
Dev-Lead Implementation Plan
Issue: #816 — Add a zero-auth MCP server (Context7) to the PR-review action agent runtime
Scope
Replace the plan-blocked GitHub secret-scanning MCP server in
.github/review-mcp.jsonwith the zero-auth Context7 HTTP endpoint, flip theREVIEW_MCP_ALLOWED_TOOLSrepo variable tomcp__context7__*, and update the initiative doc to record that the GitHub-MCP secret-scanning starter is plan-gated here while Context7 is the actual pilot starter.Implementation Checklist
.github/review-mcp.json— replace thegithub/secret_protectionserver with thecontext7zero-authhttpendpoint (https://mcp.context7.com/mcp), matching the committed.github/review-mcp.json.sample.REVIEW_MCP_ALLOWED_TOOLS— changemcp__github__*→mcp__context7__*viagh variable set.docs/initiatives/mcp-powered-review.md— update §5 (revised starter) and the §2 starter note: GitHub-MCP secret scanning is plan-gated here (advanced_securityunavailable on this plan); Context7 is the actual pilot starter per [Phase 2] Pilot MCP-enriched review on one downstream repo and measure quality + latency #681's outcome. Record findings + rollout recommendation.Tests to Write
tests/dev-lead/unit/test_engine_mcp.bats— new test asserting the committedreview-mcp.jsonconfigures the zero-authcontext7server (server present,urlis the Context7 endpoint, noAuthorization/auth headers, and the plan-blockedgithubserver is gone). Engine wiring itself is unchanged.Test Command
bats tests/dev-lead/unit/test_engine_mcp.bats(full MCP unit suite) +bash .dev-lead/scripts/dev-lead-lint.shNotes on Acceptance Criteria
dry_run=trueforce-review, sample reviews, latency delta viascripts/pr_review_health.sh) require live GitHub Actions runs and cannot be executed from the implementation sandbox; they will be exercised by the CI/health workflows after merge. Graceful degradation (Context7-down) is already regression-tested in this bats suite.don-petry commentedon Jun 20, 2026
Dev-Lead: Implementation Complete
Plan Execution
.github/review-mcp.json— replaced the plan-blockedgithub/secret_protectionserver with the zero-authcontext7httpendpoint (https://mcp.context7.com/mcp). Matches the committed.github/review-mcp.json.sampleexactly.REVIEW_MCP_ALLOWED_TOOLS— setmcp__github__*→mcp__context7__*viagh variable set(verified withgh variable get). This permitsmcp__context7__resolve-library-id/mcp__context7__get-library-docs; no secret added (zero-auth is the point of the pilot).docs/initiatives/mcp-powered-review.md— added a §2 plan caveat (GitHub-MCP secret scanning gated onadvanced_security, unavailable on this plan), rewrote §5 to record the [Phase 2] Pilot MCP-enriched review on one downstream repo and measure quality + latency #681 outcome (plan-gated starter → Context7 as the actual pilot starter), and added §5.1 with findings framing + a rollout recommendation (broader rollout stays a separate human decision).tests/dev-lead/unit/test_engine_mcp.batspinning the active config to the zero-auth Context7 shape (server present + correct URL, no auth headers, plan-blockedgithubserver gone). Engine wiring (engine.sh) was not touched — the threading was already proven by [Phase 1] Thread an optional MCP config into the Claude agentic review tiers (engine.sh) #677/pilot(mcp): thread REVIEW_MCP_ALLOWED_TOOLS into the review job env #809.Test Results
Files Changed
.github/review-mcp.json: github/secret-scanning server → zero-auth Context7 HTTP endpoint.tests/dev-lead/unit/test_engine_mcp.bats: +3 tests pinning the active Context7 config shape.docs/initiatives/mcp-powered-review.md: §2 plan caveat, §5 rewrite, new §5.1 findings + rollout note.REVIEW_MCP_ALLOWED_TOOLS(not a file):mcp__context7__*.Notes
dry_run=trueforce-review, the sample-PR qualitative findings, and the latency delta require live GitHub Actions / health-workflow runs and cannot be executed from the implementation sandbox. They will be exercised by the PR-review + daily review-health workflows after merge; §5.1 is written with explicit placeholders for those results to be recorded as they accrue._emit_mcp_failure_warningand regression-tested in this bats suite (a server-failure marker yields a::warning::[mcp]naming the server while the verdict still flows through) — no fatal exit, confirming Context7-down still completes the review.prompts/deep-review.md,prompts/single-review.md) referencemcp__github__run_secret_scanningonly conditionally ("when available; exposed only when … enabled for this repo"), so they degrade cleanly with the github server removed and were intentionally left unchanged (out of issue scope).advanced_securityis licensed on this repo's plan.fix(review-mcp): revert Context7 transport to type:http (was broken sse)
feat: add zero-auth Context7 MCP server to PR-review runtime (#826)
docs(mcp-review): Context7 A/B eval findings + tool-name fix (#847)