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 the claude --print call.
- MCP tool names are merged into the existing
--allowed-tools list 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
Dev Notes
- This repo has NO
claude-code-reusable.yml and no mcp_servers input — the idea's named surface does not exist. The real Claude review engine is scripts/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 its extra_args verbatim to claude --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 bash with set -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
Story prepared by the BMAD Scrum Master (Bob) for epic #676. Status: ready-for-dev.
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
--mcp-config <file>and--strict-mcp-config) to theclaude --printcall.--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.Tasks / Subtasks
Dev Notes
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._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.@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.#!/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
Likely target surface
scripts/engine.shtests/Story prepared by the BMAD Scrum Master (Bob) for epic #676. Status: ready-for-dev.