ralph-loop-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ralph-loop-mcp start Phase 1 workflow for authentication module"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ralph Loop MCP (Node + TypeScript)
This MCP server turns the repo's .ralph/ folder into a 3-phase workflow:
Phase 1: Create or refine plan documents under
.github/plans/. Phase 1 produces plan files only.Phase 2: Generate/refine specs under
.ralph/specs/**and tasks in.ralph/fix_plan.md.Phase 3: Iterate one task at a time with strict verification (npm run ci + npm run test:e2e).
See docs/DESIGN.md for architecture and positioning.
Phase 1 generator script
ralph.generate_phase1 bootstraps .ralph/phase1.sh and seeds .github/plans/project-plan.md when missing.
The generated Phase 1 session is intentionally constrained to planning output only:
It writes plan documents only under
.github/plans/It does not create
.ralph/specs/**It does not create
.ralph/fix_plan.mdtask itemsRun directly:
bash ./.ralph/phase1.shRun via MCP tool:
ralph.generate_phase1
Related MCP server: Spec MCP Server
Phase 2 generator script
ralph.generate_phase2 scaffolds .ralph/phase2.sh and creates the baseline Phase 2 artifacts:
.ralph/specs/*.md.ralph/fix_plan.md.ralph/config.json.ralph/logs/progress.txt.ralph/logs/learnings.mdRun directly:
bash ./.ralph/phase2.shRun via MCP tool:
ralph.generate_phase2
ralph.generate_phase2 performs a lightweight schema validation of .ralph/config.json.
If the file exists and is invalid, the tool reports validation errors without executing the script.
Phase 3 generator script
ralph.generate_phase3 scaffolds .ralph/phase3.sh and creates the Phase 3 prompt files.
It fails with a clear error if .ralph/fix_plan.md does not yet exist.
When the fix plan has fewer than five unchecked active tasks, it seeds Phase 2 planning items as checkboxes automatically.
Artifacts created:
.ralph/phase3.sh.ralph/phase3-plan-prompt.md.ralph/phase3-dev-prompt.md.ralph/phase3-dev-signoff-prompt.md.ralph/phase3-qa-prompt.md.ralph/phase3-qa-close-prompt.md.ralph/logs/phase3-feedback.mdRun directly:
bash ./.ralph/phase3.shRun via MCP tool:
ralph.generate_phase3
Prerequisites
Node.js 20 or later
npm
Build the package before running or testing (see Build section below)
Install
Standalone (this repo cloned directly as the package root):
npm installNested (package embedded under a parent monorepo, e.g. at ./mcp/ralph_loop_mcp):
npm install --prefix ./mcp/ralph_loop_mcpBuild
Standalone:
npm run buildNested:
npm run --prefix ./mcp/ralph_loop_mcp buildRun (stdio)
Standalone:
node dist/index.jsNested:
node ./mcp/ralph_loop_mcp/dist/index.jsVS Code MCP registration
Set cwd to the target project -- the repo whose .ralph/ folder the server will manage. This is typically the project you are actively developing, not the directory where this MCP package lives.
Example configuration for a standalone clone (open the target project folder in VS Code so ${workspaceFolder} resolves to it):
{
"mcpServers": {
"ralph-loop": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "${workspaceFolder}"
}
}
}Example for a nested layout where the package lives at ./mcp/ralph_loop_mcp inside the target project:
{
"mcpServers": {
"ralph-loop": {
"command": "node",
"args": ["./mcp/ralph_loop_mcp/dist/index.js"],
"cwd": "${workspaceFolder}"
}
}
}If VS Code reports ${workspaceFolder} cannot be resolved, open the repository with File -> Open Folder..., or set cwd to an absolute path pointing at the target project root.
Verification prereqs
ralph.run_verification runs npm run ci followed by npm run test:e2e on the target repo (the project under cwd). Both scripts must be defined in that repo's package.json, or the tool will reject them by design.
To extend the allowlist for additional scripts, add an allowedNpmScripts array to .ralph/config.json in the target repo:
{
"allowedNpmScripts": ["lint", "type-check"]
}Conventions
.ralph/fix_plan.mdis the task source of truth.Blocked tasks live under a dedicated heading:
## Blocked(or## Blocked Tasks).Phase 1 planning documents live under
.github/plans/.Phase 2 generator script lives at
.ralph/phase2.shand is auto-created byralph.generate_phase2when absent.Phase 3 generator script lives at
.ralph/phase3.shand is auto-created byralph.generate_phase3when absent.
Dev tests
Standalone:
npm testNested:
npm run --prefix ./mcp/ralph_loop_mcp testNote: Run
npm run buildbefore running tests for the first time sodist/index.jsexists for integration tests.
Available Tools
18 toolsralph.append_learningB
Append a new section to .ralph/logs/learnings.md.
Inputs: body (required), title (required).
ralph.append_progressA
Append a timestamped entry to .ralph/logs/progress.txt.
Inputs: entry (required).
ralph.block_taskC
Move an active task into the dedicated Blocked section with a short reason.
Inputs: text (required), reason (required), taskId.
ralph.generate_phase1A
Set up Phase 1: creates .ralph/phase1.sh and .ralph/phase1-prd-prompt.md, seeds a draft .github/plans/project-plan.md if missing. Run bash .ralph/phase1.sh to normalize the source plan into the canonical PRD at .ralph/prd.md via ralph.write_prd. Configure phase1.sourcePlan in .ralph/config.json (default .github/plans/project-plan.md). When the PRD is ready, run ralph.generate_phase2.
Inputs: sourcePlan.
ralph.generate_phase2A
Set up Phase 2: .ralph/phase2.sh (planning persona + worker loop), config.json with defaults, phase2-planner-prompt.md, phase2-worker-prompt.md, specs/, logs/. Phase 2 reads paths.projectPlan (default .ralph/prd.md). Ensure .ralph/prd.md exists first. Run bash .ralph/phase2.sh after setup.
Inputs: planFile.
ralph.generate_phase3A
Set up Phase 3: .ralph/phase3.sh — Plan, Dev, QA personas, Dev/QA consensus sign-off, then QA close marks tasks done. Prompt files: phase3-plan-prompt.md, phase3-dev-prompt.md, phase3-qa-prompt.md, sign-off prompts. Requires .ralph/fix_plan.md. Run bash .ralph/phase3.sh.
Inputs: no named parameters.
ralph.list_filesA
List files and directories one level deep under a repo-relative path. Use this during Phase 2 exploration to discover source files, then read them with ralph.read_file.
Inputs: directory.
ralph.next_taskA
Return the next unchecked active task from .ralph/fix_plan.md (ignores blocked tasks).
Inputs: no named parameters.
ralph.read_fileA
Read any text file inside the repo by its repo-relative path. Use this during Phase 2 to explore source code and inform spec and fix-plan authoring.
Inputs: relativePath (required).
ralph.read_stateA
Read .ralph state: config, parsed tasks, spec index, PRD tail, and log tails. Call at the start of Phase 2/3 iterations.
Inputs: no named parameters.
ralph.replace_fix_planA
Replace .ralph/fix_plan.md, optionally preserving completed items from the previous file. Phase 2/3: use preserveCompleted:true when refining. You may add <!-- ralph-defer: blocked-by: task-id — note --> on the line after a checkbox to defer work.
Inputs: content (required), preserveCompleted.
ralph.run_verificationA
Run strict verification gate: npm run ci, then npm run test:e2e (stop on first failure).
Inputs: timeoutSeconds.
ralph.set_task_statusA
Check/uncheck a task in .ralph/fix_plan.md by text or taskId. In Phase 3, only the QA-close persona should call this with checked:true after Dev agrees sign-off.
Inputs: text (required), checked (required), taskId.
ralph.unblock_taskB
Move a blocked task back into the active task list (unchecked by default).
Inputs: text (required), taskId.
ralph.upsert_specA
Write/update a spec file under .ralph/specs/**. Call this iteratively during Phase 2 as you explore source files and refine your understanding.
Inputs: content (required), relativePath (required).
ralph.write_epic_planB
Write/update the canonical .ralph/epic_plan.md file.
Inputs: content (required).
ralph.write_planA
Write or update a planning document under .github/plans/. Use for draft plans before Phase 1 PRD normalization, or auxiliary planning docs.
Inputs: content (required), relativePath (required).
ralph.write_prdA
Write or replace the canonical product requirements document at .ralph/prd.md. Used by the Phase 1 Copilot session only.
Inputs: content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools map to a distinct file, phase, or action; the write_ family is separated by documented destinations (plans, PRD, epic, specs, fix_plan). read_state vs read_file and the multiple generate_phase tools have slight conceptual overlap, but the descriptions clearly indicate when each should be used.
All tools share the ralph. prefix and use lowercase_snake_case with a mostly verb_noun pattern (write_plan, block_task, run_verif). Minor deviations such as next_task (lacking a verb) and write_prd (abbreviated object) keep it from being perfectly consistent.
At 18 tools, the set is slightly above the ideal 3-15 range, but the multi-phase workflow (setup, planning, spec writing, task tracking, logging, verification) justifies the breadth. Each tool serves a distinct step in the ralph loop, so the count feels reasonable rather than bloated.
The toolset covers the full ralph loop lifecycle: phase setup, PRD/plan/spec/fix-plan authoring, task state transitions, logging, and verification. Minor gaps exist—no dedicated raw fix_plan reader and no cleanup/rollback tool—but agents can work around these via read_state and overwrite capabilities.
Maintenance
Related MCP Connectors
AI-powered spec-to-task decomposition and execution orchestration for coding agents.
Adaptive plan/build/review cycles for AI coding assistants, persisted across sessions.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
Turns vague automation requests into tool stacks, prompts, QA checks, and human boundaries.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAdvanced task automation system that reads codebases, divides complex tasks into specific steps, and rigorously executes them with complete testing, documentation, validation and automatic correction.MIT
- AlicenseAqualityDmaintenanceStreamlines development workflows through AI-assisted codebase analysis, comprehensive planning, task breakdown with dependencies, and automated implementation verification. Enables systematic approach to complex development tasks like framework migrations and feature implementation.521 npmMIT
- AlicenseNot gradedqualityDmaintenanceImplements GitHub's Spec-Driven Development methodology, transforming natural language requirements into executable specifications, technical plans, and ordered task lists with contract-based validation and progress tracking.26 npm2MIT
- AlicenseAqualityCmaintenanceEnables AI coding tools to follow a structured spec-driven development workflow with three phases: requirements, design, and tasks, ensuring approval before advancing.10MIT