Skip to content

feat(flow-next): Add MCP review backend option#65

Open
Ranudar wants to merge 6 commits intogmickel:mainfrom
Ranudar:main
Open

feat(flow-next): Add MCP review backend option#65
Ranudar wants to merge 6 commits intogmickel:mainfrom
Ranudar:main

Conversation

@Ranudar
Copy link
Copy Markdown

@Ranudar Ranudar commented Jan 21, 2026

Summary

Add mcp as a new review backend for flow-next, enabling RepoPrompt integration via MCP server instead of rp-cli subprocess calls.

Benefits:

  • No rp-cli dependency - works anywhere RepoPrompt MCP is connected
  • Cross-platform (Linux containers, Windows, macOS)
  • Direct integration without subprocess overhead
  • Better error handling via MCP tool responses

Changes

  • Add mcp to valid backends in flowctl.py
  • Add MCP backend rules to plan-review and impl-review SKILL.md
  • Add MCP Backend Workflow sections to workflow.md files
  • Add MCP tool mapping documentation
  • Update ralph.md with MCP backend documentation and troubleshooting

MCP Tool Mapping

flowctl rp command MCP Tool
rp setup-review mcp__RepoPrompt__manage_workspaces (list_tabs, select_tab)
rp select-add mcp__RepoPrompt__manage_selection (op: "add")
rp chat-send mcp__RepoPrompt__chat_send
rp prompt-get mcp__RepoPrompt__prompt (op: "get")

Testing

Tested MCP backend workflow manually - all operations work:

  • MCP connection verification ✓
  • Tab listing and selection ✓
  • File selection ✓
  • Chat send with verdict response ✓

🤖 Generated with Claude Code

Add `mcp` as a new review backend for flow-next, enabling RepoPrompt
integration via MCP server instead of `rp-cli` subprocess calls.

Benefits:
- No rp-cli dependency - works anywhere RepoPrompt MCP is connected
- Cross-platform (Linux containers, Windows, macOS)
- Direct integration without subprocess overhead
- Better error handling via MCP tool responses

Changes:
- Add `mcp` to valid backends in flowctl.py
- Add MCP backend rules to plan-review and impl-review SKILL.md
- Add MCP Backend Workflow sections to workflow.md files
- Add MCP tool mapping documentation
- Update ralph.md with MCP backend documentation and troubleshooting

MCP Tool Mapping:
- rp setup-review → manage_workspaces (list_tabs, select_tab)
- rp select-add → manage_selection (op: "add")
- rp chat-send → chat_send
- rp prompt-get → prompt (op: "get")

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 21, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

I'm not sure rp-cli is not necessary any more. I don't think it is, but i've removed this part from ralph.md
Copy link
Copy Markdown
Owner

@gmickel gmickel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: MCP Review Backend

Thanks for the contribution! The concept is solid - MCP backend provides an alternative path to RepoPrompt that doesn't require rp-cli installation (useful for MCP proxying from sandboxes/containers). Found some issues that need addressing before merge.


🔴 Critical: Ralph Mode Broken

plugins/flow-next/skills/flow-next-ralph-init/templates/ralph.sh lines 919, 931

Receipt verification only checks rp and codex:

if [[ "$status" == "plan" && ( "$PLAN_REVIEW" == "rp" || "$PLAN_REVIEW" == "codex" ) ]]; then

Impact: MCP reviews skip receipt verification entirely in Ralph mode - tasks marked complete without proof. Silent failure.

Fix: Add || "$PLAN_REVIEW" == "mcp" to both conditions (lines 919 and 931).


🔴 Critical: UI Functions Missing MCP

ralph.sh lines 241-264 - ui_plan_review() and ui_impl_review() don't handle mcp:

ui_plan_review() {
  if [[ "$mode" == "rp" ]]; then
    ...
  elif [[ "$mode" == "codex" ]]; then
    ...
  fi
  # mcp falls through silently
}

Fix: Add elif [[ "$mode" == "mcp" ]] branch with appropriate UI message.


🟡 Medium: No Guard Hook Support

ralph-guard.py enforces workflow rules for rp/codex (blocks --json, validates receipts, etc). MCP calls go directly to MCP tools, bypassing all guards.

Options:

  1. Add flowctl mcp * wrappers (consistent with rp/codex pattern) - significant work
  2. Document that MCP backend is manual-mode only (not supported in Ralph) - quick fix
  3. Accept the gap for now and track as follow-up issue

I'd suggest option 2 for this PR, option 1 as follow-up.


🟡 Medium: Workflow Doc Inconsistency

flow-next-plan-review/workflow.md MCP tool mapping includes:

| `rp builder` | `mcp__RepoPrompt__context_builder` |

But flow-next-impl-review/workflow.md doesn't have this entry. Should be consistent - either both have it or neither.


🟢 Minor: No Tests

Consider adding a basic smoke test or note in the PR that testing was manual-only.


Summary

The core documentation additions are good. Main gaps:

  1. ralph.sh needs MCP handling (receipt checks + UI) - this is the blocker
  2. Document Ralph limitation or add guard support
  3. Fix workflow.md inconsistency

Happy to help if you have questions on any of these!

Ranudar and others added 4 commits January 21, 2026 20:28
- ralph-guard.py: Add MCP tool handlers (pre/post), state tracking,
  receipt validation, and tool filtering for mcp__RepoPrompt__* tools
- prompt_plan.md: Add MCP mode rules and dynamic receipt mode
- prompt_work.md: Add MCP explanation and dynamic receipt mode
- ralph.sh: Add MCP display name in ui_config()
- config.env: Update comments to include mcp option
- workflow.md: Remove outdated "manual mode only" warnings

MCP backend now works in Ralph autonomous mode with full hook enforcement.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The ralph-guard.py already had code to track MCP review tools, but
hooks.json only registered the hook for Bash tool. This caused MCP
reviews to not be tracked, blocking receipt writes after SHIP verdicts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ralph-guard.py: Only set chat_send_succeeded when verdict tag found
  (previously set for any non-error response, allowing premature receipts)
- impl-review/workflow.md: Combine two MCP calls into single call with
  verdict requirement included in the review prompt
- plan-review/workflow.md: Same single-call pattern with verdict requirement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Defense-in-depth: NEEDS_WORK and MAJOR_RETHINK verdicts now block
receipt writes until code is fixed and re-reviewed to get SHIP.

Updated both MCP and Codex handlers for consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@tiagoefreitas
Copy link
Copy Markdown
Contributor

I currently run flow-next in a linux sandbox and rp-cli over ssh which works well enough, but I don't keep track of rp-cli failures where the model has to retry due to json issues and wastes time/tokens (have seen it in the logs often), would mcp help with that? I guess it helps in the sense of keeping the rp prompts up to date but I though flow-next used a controlled subset of rp-cli commands to avoid errors?

@gmickel whats your veredict would you use this over rp-cli even for controlled flows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants