Repository navigation
Closed
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Description
Story
As a maintainer of the pr-review engine,
I want add an opt-in MCP config knob that engine.sh threads into the claude --print agentic and rubber-duck invocations,
so that reviews can draw on real-time MCP context while the default (knob unset) behavior stays byte-for-byte unchanged for every existing adopter.
Acceptance Criteria
- A new env knob (e.g. REVIEW_MCP_CONFIG, a path to an MCP-servers JSON config) is read at engine.sh init; when unset or empty, the claude invocations gain no new flags and behavior is unchanged.
- When REVIEW_MCP_CONFIG points to a readable file, the claude branch of run_agentic and run_duck append the MCP config flags (verified for the pinned CLI:
--mcp-config <file>and--strict-mcp-config) to theclaude --printcall. - MCP tool names are merged into the existing
--allowed-toolslist for those tiers via a second knob (e.g. REVIEW_MCP_ALLOWED_TOOLS, default empty), so configured MCP tools (e.g.mcp__context7__*) are actually permitted. - The triage tier (which restricts tools via --disallowed-tools) is NOT given MCP config and stays fast/restricted.
- The exact MCP flag spelling is verified against the pinned @anthropic-ai/claude-code CLI version before merge (claude --help / docs), not guessed, and recorded in a code comment.
- shellcheck scripts/engine.sh passes.
Tasks / Subtasks
- Add a config block reading REVIEW_MCP_CONFIG and REVIEW_MCP_ALLOWED_TOOLS near the other engine knobs (engine.sh ~lines 30-47). (AC: test issue from agent #1)
- Add a small helper that yields the MCP flag array (--mcp-config/--strict-mcp-config) plus the merged allowed-tools value, emitting nothing when the config file is absent/empty. (AC: test issue from agent #1, Go-live improvements for PR review agent #2, Add @claude delegation, auto-merge, and rebase handling #3)
- Wire the helper into the claude branch of run_agentic (engine.sh ~705-718) and run_duck (~807-823), appended after the existing --permission-mode/--allowed-tools args. (AC: Go-live improvements for PR review agent #2, Add @claude delegation, auto-merge, and rebase handling #3)
- Confirm the triage branch (engine.sh ~613-622) is untouched and still passes --disallowed-tools only. (AC: Optimize review: small-PR and incremental fast paths #4)
- Verify --mcp-config/--strict-mcp-config against the installed CLI version and document the verified flags in a comment. (AC: feat: add Copilot engine support via REVIEW_ENGINE toggle #5)
- Run shellcheck on engine.sh and add/extend a bats test asserting MCP flags appear only when the knob is set. (AC: feat: feature ideation framework — adversarial proposer/challenger/synthesizer #6)
Dev Notes
- This repo has NO
claude-code-reusable.ymland nomcp_serversinput — the idea's named surface does not exist. The real Claude review engine isscripts/engine.sh, invoked by.github/workflows/pr-review.yml->review-batch.sh/review-one-pr.sh. Target engine.sh, not a new reusable workflow. - Invocations to extend: the claude branch of run_agentic (engine.sh:705-718) and run_duck (engine.sh:807-823). Both call
_claude_chain_invoke ... --permission-mode acceptEdits --allowed-tools "Bash,Read,Grep,Glob". Append the MCP flags here, matching that bash arg-array style. _claude_chain_invoke(engine.sh:410) forwards itsextra_argsverbatim toclaude --print --model X "${extra_args[@]}"(engine.sh:453,462) — passing MCP flags as extra args needs no signature change.- Do NOT touch the triage tier (engine.sh:613-622): it intentionally restricts tools via --disallowed-tools for speed/cost. MCP belongs only on the deep (run_agentic) and duck (run_duck) agentic tiers.
- The dev-lead writer path (engine.sh ~965-977, --allowed-tools includes Write,Edit,WebFetch) is the issue/CI-fixing pipeline, not PR review — out of scope here.
- CLI is
@anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}(pr-review.yml:177, default 'latest'). MCP flags can differ across CLI versions; verify before merge — CLAUDE.md forbids guessing flags/SHAs. - Standards: scripts are
#!/usr/bin/env bashwithset -euo pipefail, must pass shellcheck (CLAUDE.md Commands), and carry no hardcoded secrets (AGENTS.md Scripts).
Project Structure Notes
Change is confined to scripts/engine.sh plus a bats test under tests/. No new files or workflows required for the plumbing itself.
References
- scripts/engine.sh:705 (run_agentic claude branch)
- scripts/engine.sh:807 (run_duck claude branch)
- scripts/engine.sh:410 (_claude_chain_invoke forwards extra_args)
- scripts/engine.sh:613 (triage tier, --disallowed-tools)
- .github/workflows/pr-review.yml:177 (CLAUDE_CODE_VERSION pin)
- AGENTS.md#scripts
- CLAUDE.md#commands
Likely target surface
scripts/engine.shtests/
Story prepared by the BMAD Scrum Master (Bob) for epic #676. Status: ready-for-dev.
Metadata
Metadata
Assignees
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Activity
don-petry commentedon Jun 14, 2026
Dev-Lead Implementation Plan
Issue: #677 — [Phase 1] Thread an optional MCP config into the Claude agentic review tiers (engine.sh)
Scope
Add two opt-in env knobs (
REVIEW_MCP_CONFIG,REVIEW_MCP_ALLOWED_TOOLS) thatengine.shthreads into theclaude --printcalls of the deep (run_agentic) and rubber-duck (run_duck) tiers, leaving default behavior byte-for-byte unchanged when the config knob is unset.Implementation Checklist
scripts/engine.sh: add config block readingREVIEW_MCP_CONFIG/REVIEW_MCP_ALLOWED_TOOLSnear the other engine knobs (~lines 30-47)scripts/engine.sh: add_mcp_review_flags <base_allowed_tools>helper that populates_MCP_FLAGS(--mcp-config <file> --strict-mcp-config) and_MCP_ALLOWED_TOOLS(base + merged MCP tools), emitting nothing when the config file is absent/unreadablescripts/engine.sh: wire the helper into the claude branch ofrun_agentic(~705-718), appending after--permission-mode/--allowed-toolsscripts/engine.sh: wire the helper into the claude branch ofrun_duck(~807-823)--disallowed-toolsonly)@anthropic-ai/claude-code2.1.138) in a code commentTests to Write
tests/dev-lead/unit/test_engine_mcp.bats— assert MCP flags absent when knob unset (default), present inrun_agentic/run_duckwhen knob set to a readable file, allowed-tools merged, no flags when file unreadable, and triage tier never gets MCP flagstests/dev-lead/fixtures/engines/stub-claudewith an opt-inSTUB_ENGINE_RECORD_ARGSarg-capture (additive, no behavior change when unset)Test Command
bats tests/dev-lead/unit/(plusbash .dev-lead/scripts/dev-lead-lint.shfor shellcheck)don-petry commentedon Jun 14, 2026
Dev-Lead: Implementation Complete
Plan Execution
REVIEW_MCP_CONFIG/REVIEW_MCP_ALLOWED_TOOLSconfig block near the other engine knobs (scripts/engine.sh)_mcp_review_flags <base_allowed_tools>helper — populates_MCP_FLAGS(--mcp-config <file> --strict-mcp-config) and_MCP_ALLOWED_TOOLS(base + merged MCP tools), no-op when config absent/unreadablerun_agentic(deep tier), appended after--permission-mode/--allowed-toolsrun_duck(rubber-duck tier), preserving--max-turns 25--disallowed-toolsonly) — verified by test--mcp-config/--strict-mcp-configagainst installed@anthropic-ai/claude-code2.1.138 (claude --help) and recorded the verified spelling in a code commenttests/dev-lead/unit/test_engine_mcp.batsAcceptance Criteria
REVIEW_MCP_CONFIG→--mcp-config <file> --strict-mcp-configappended to deep/duck claude callsREVIEW_MCP_ALLOWED_TOOLSmerged into--allowed-toolsfor those tiers--disallowed-toolsonly)Test Results
Files Changed
scripts/engine.sh: MCP config knobs,_mcp_review_flagshelper, wiring intorun_agentic+run_duckclaude branchestests/dev-lead/unit/test_engine_mcp.bats: new — 9 cases covering default-unchanged, flags-on-when-set, allowed-tools merge, unreadable-file no-op, and triage-never-MCPtests/dev-lead/fixtures/engines/stub-claude: additiveSTUB_ENGINE_RECORD_ARGSargv-capture hook (no behavior change when unset)Notes
tests/dev-lead/unit/whichtest-dev-lead.ymlauto-discovers viabats tests/dev-lead/unit/— no workflow bats-list edit required.REVIEW_MCP_CONFIGis treated as unset (no flags) and emits a one-line stderr notice; phrasing avoids rate-limit tokens so it cannot be misclassified by downstreamis_rate_limitedscans."${_MCP_FLAGS[@]}"follows the existingfmt_argspattern already in_claude_chain_invoke.feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …
feat: implement issue #677 — [Phase 1] Thread an optional MCP config …