Skip to content

[Phase 1] Add optional MCP-config passthrough to the Claude review engine #660

Closed as not planned

Description

@github-actions

Story

As a maintainer of the review engine,
I want have engine.sh optionally pass an MCP server config to the Claude CLI and grant those servers' tools on the agentic review tiers,
so that agentic reviews can draw on real-time external context when configured, with zero change when it is not.

Acceptance Criteria

  1. When the MCP_CONFIG env var is unset or empty, the claude --print invocation in _claude_chain_invoke is byte-identical to today: no --mcp-config/--strict-mcp-config flags and --allowed-tools remains exactly "Bash,Read,Grep,Glob".
  2. When MCP_CONFIG is set to a readable MCP config (file path or inline JSON), the agentic claude tiers (deep/audit/action/single) add --mcp-config <value> and append the configured servers' tool grants (mcp__<server>__*) to --allowed-tools so those tools are usable.
  3. When MCP_CONFIG is set but unreadable or invalid JSON, the engine emits a ::warning:: annotation naming the problem and proceeds with the review WITHOUT MCP -- it never aborts, never silently drops the setting, and never fabricates an all-clear.
  4. --strict-mcp-config is passed whenever MCP_CONFIG is supplied, so only the explicit config loads and no ambient/user MCP servers leak into CI.
  5. The fast non-agentic triage tier is left untouched (MCP applies only to the agentic tiers), and shellcheck --severity=warning -x scripts/engine.sh passes.

Tasks / Subtasks

Dev Notes

  • Single point of truth for the CLI call: _claude_chain_invoke (scripts/engine.sh ~L410) is the ONLY place claude --print --model X runs; the agentic tiers pass their flags from run_agentic's claude) branch (scripts/engine.sh ~L710-717: --permission-mode acceptEdits --allowed-tools "Bash,Read,Grep,Glob"). Add MCP args there as extra_args, do not fork the invocation.
  • Claude Code CLI contract: MCP servers are supplied via --mcp-config <path-or-json> and isolated with --strict-mcp-config; each server's tools are exposed as mcp__<server>__<tool> and are unusable unless listed in --allowed-tools. So MCP requires editing BOTH the config flag and the allowed-tools list.
  • Keep the triage tier (scripts/engine.sh ~L612-619, _claude_chain_invoke for the fast classify) MCP-free: it is a non-agentic classification pass, not a context-gathering review.
  • Fail-Loud-Never-Fake: reuse the established ::warning:: degradation idiom (e.g. scripts/engine.sh:494 throttle warning; scripts/validate-engines.sh emits self-contained ::warning:: lines and always exits 0). Degraded MCP must never abort the review nor produce a fake clean verdict.
  • Scripts standard (AGENTS.md#scripts): #!/usr/bin/env bash with set -euo pipefail; no hardcoded tokens -- any auth-bearing MCP server takes its token from env, never from a committed config literal.

Project Structure Notes

All changes confined to scripts/engine.sh, the existing review engine. No new files. Aligns with the repo's shell-orchestration-for-Actions structure.

References

  • scripts/engine.sh#_claude_chain_invoke
  • scripts/engine.sh (run_agentic claude branch, --allowed-tools)
  • scripts/validate-engines.sh (warning/degradation pattern)
  • AGENTS.md#scripts

Likely target surface

  • scripts/engine.sh

Story prepared by the BMAD Scrum Master (Bob) for epic #659. Status: ready-for-dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    initiativeEpic / initiative tracking issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions