ralph-wiggum-mcp
Integrates with ESLint as an external tool preset to provide automated linting and code quality checks during development iterations.
Provides templates and support for iteratively building and refining web applications using the Express framework.
Offers comprehensive git integration including automatic commits, diff summaries, and the ability to retrieve context from previous Ralph-initiated commits.
Supports iterative JavaScript development with built-in presets for running test suites and linters.
Enables systematic development and testing of Node.js applications through iteration loops and dedicated project templates.
Utilizes npm to execute test commands and manage toolchains within JavaScript and Node.js development cycles.
Integrates with pytest to automatically run and analyze test suites for Python projects during the iteration process.
Facilitates iterative Python development by integrating test runners like pytest and linters like ruff into the AI workflow.
Provides integration with the ruff linter to quickly identify and fix Python code issues within development loops.
Supports Rust development through integration with cargo test and clippy for automated testing and linting.
Allows for iterative development of TypeScript projects, including progress tracking for .ts files and test execution.
Ralph Wiggum MCP Server v2.0
A production-ready Model Context Protocol (MCP) server implementing the Ralph Wiggum technique—iterative AI development loops with history tracking, git integration, and comprehensive analytics.
Overview
Ralph Wiggum MCP Server enables AI agents to continuously improve work through systematic loops. Named after Ralph Wiggum from The Simpsons, it embodies persistent iteration despite setbacks.
New in v2.0:
Iteration history tracking with progress metrics
Git integration for automatic change tracking
External tool integration (test runners, linters, formatters)
Pre-built loop templates
Stagnation detection and warnings
Performance analytics
Features
Core
Manual iteration control with
ralph_iterateCompletion promises for automatic loop termination
Max iteration safety limits
Persistent state across server restarts
Progress Tracking
Track files modified, commands run, and errors per iteration
Duration tracking and performance analysis
Stagnation detection and repeated error warnings
History reports with convergence metrics
Git Integration
Automatic commits after each iteration (optional)
Diff summaries and change tracking
Context from previous Ralph commits
External Tools
Run test suites (JavaScript, Python, Rust, Go)
Execute linters and formatters
Automatic error extraction and analysis
Templates
REST API, TDD, Refactoring, Bug Fixing, Documentation, Performance Optimization, Security Hardening, Database Migration
Installation
Prerequisites:
Node.js ≥18.0.0
npx (comes with npm ≥5.2.0)
Git (optional, for git integration)
Quick Start (Recommended)
No installation required! Simply use npx:
MCP Client Configuration:
Add to your MCP client config (e.g., claude_desktop_config.json):
{
"mcpServers": {
"ralph-wiggum": {
"command": "npx",
"args": ["ralph-wiggum-mcp"]
}
}
}That's it! The package will be automatically downloaded and run on first use.
Local Development Setup
If you want to develop or contribute:
git clone https://github.com/cbuntingde/ralph-wiggum-mcp.git
cd ralph-wiggum-mcp
npm install
npm run buildThen configure your MCP client to use the local build:
{
"mcpServers": {
"ralph-wiggum": {
"command": "node",
"args": ["C:/path/to/ralph-wiggum-mcp/dist/index.js"]
}
}
}Configuration
Variable | Default | Description |
|
| Default maximum iterations |
|
| Enable auto-commit by default |
|
| Maximum history entries |
|
| Iterations before stagnation warning |
Tools Reference
Core Tools
ralph_loop
Start an iterative development loop.
Parameters:
prompt(string, optional*) – Task prompttemplate_id(string, optional) – Pre-built template IDmax_iterations(number, optional) – Max iterations (0 = unlimited)completion_promise(string, optional) – Promise phrase signaling completiongit_enabled(boolean, optional) – Enable git integration (default:true)auto_commit(boolean, optional) – Auto-commit after each iteration (default:false)
*Either prompt or template_id required.
ralph_iterate
Process the next iteration with tracking.
Parameters:
last_output(string, required) – Your last output/responsefiles_modified(array, optional) – Files modifiedcommands_run(array, optional) – Commands executederrors(array, optional) – Errors encounteredrun_tools(array, optional) – External tool presets (e.g.,['javascript-test'])
ralph_cancel
Cancel the active Ralph loop.
ralph_status
Get current status with progress insights.
Returns: iteration number, history summary, stagnation detection, estimated iterations remaining.
History & Reporting
ralph_history
Get detailed iteration history report.
Returns: timestamps, durations, files modified, commands run, errors, git commits, tool results.
Templates
ralph_list_templates
List available templates.
Parameter: category (optional) – Filter by category: api, testing, refactoring, debugging, documentation, performance, security, database
ralph_get_template
Get template details.
Parameter: template_id (required) – Template ID
Returns: full prompt text, suggested settings, recommended tools.
Git Integration
ralph_git_status
Get git status and diff summary.
ralph_git_commit
Create a git commit manually.
Parameter: message (required) – Commit message
ralph_git_context
Get context from recent Ralph commits.
Parameter: count (optional) – Number of commits (default: 5)
External Tools
ralph_run_tools
Run external tool presets.
Parameter: presets (required, array) – Preset names
Available presets:
javascript-test– npm testjavascript-lint– ESLintpython-test– pytestpython-lint– ruffrust-test– cargo testrust-lint– clippygo-test– go testbuild– Verify project builds
ralph_detect_tools
Detect available tool presets for your project.
ralph_list_tools
List all tool presets with descriptions.
Usage Examples
Beginner Example: Building a Simple App
Step 1: Start the loop
Tell your AI to use ralph_loop with:
prompt: "Create a simple to-do list app with Node.js and Express.
Requirements:
- Add, view, delete todos
- Store in memory
- Output <promise>DONE</promise> when complete"Step 2: AI starts working
The AI will create initial files. When it reports what it did, it calls ralph_iterate with:
last_output: "I created server.js with Express and endpoints for todos"
files_modified: ["server.js", "package.json"]Step 3: AI continues iterating
The AI keeps improving the code, calling ralph_iterate each time with updates.
Step 4: Completion
When the AI meets all requirements, it outputs <promise>DONE</promise> and the loop stops.
Step-by-Step Example with Testing
Step 1: Start a development loop
ralph_loop with:
- prompt: "Create a calculator module with add, subtract, multiply, divide functions.
Write tests first. Keep iterating until tests pass.
Output <promise>CALCULATOR_DONE</promise> when complete."
- max_iterations: 20Step 2: AI writes first test
ralph_iterate with:
- last_output: "Created calculator.test.js with test for add() function"
- files_modified: ["calculator.test.js"]Step 3: AI implements function
ralph_iterate with:
- last_output: "Implemented add() function in calculator.js"
- files_modified: ["calculator.js"]
- run_tools: ["javascript-test"]Step 4: Check if tests pass
The run_tools parameter runs npm test. If tests fail, the AI sees the errors and tries again.
Step 5: Repeat until success
The loop continues calling ralph_iterate until all tests pass, then outputs <promise>CALCULATOR_DONE</promise>.
Using Pre-Built Templates
Step 1: See available templates
ralph_list_templatesStep 2: Get a specific template
ralph_get_template with template_id: "rest-api"This shows you the full prompt and recommended settings.
Step 3: Start with the template
ralph_loop with:
- template_id: "rest-api"
- auto_commit: trueThe AI automatically uses the template's prompt and settings.
Tracking Progress During Development
While a loop is running, you can check progress:
ralph_statusThis shows:
Current iteration number
Files modified so far
Errors encountered
Whether you've been stuck on the same error
ralph_historyShows detailed history of every iteration.
Template-Based Development
Quick start using built-in templates:
ralph_loop with:
- template_id: "rest-api"
- auto_commit: true
Each iteration:
ralph_iterate with:
- last_output: your response
- run_tools: ["javascript-test", "javascript-lint"]TDD with Automatic Testing
ralph_loop with:
- template_id: "tdd"
Each iteration:
ralph_iterate with:
- last_output: your response
- files_modified: ["src/calculator.ts", "src/calculator.test.ts"]
- run_tools: ["javascript-test"]Bug Fixing
ralph_loop with:
- prompt: "Fix authentication bug. Output <promise>BUG_FIXED</promise> when tests pass."
- max_iterations: 15
Track with:
- ralph_status
- ralph_history
- ralph_git_contextBest Practices
1. Clear Completion Criteria
Build a REST API for todos.
Requirements:
- All CRUD endpoints working
- Input validation
- Tests passing (coverage > 80%)
- README with API docs
Output <promise>API_COMPLETE</promise> when done.2. Use External Tools
Implement feature X with tests.
Each iteration:
- ralph_iterate with run_tools: ["javascript-test"]
- Only output <promise>COMPLETE</promise> when tests pass3. Enable Auto-Commit
Refactor codebase with auto_commit: true.
Each successful step is saved automatically.
If broken, revert to last working state.4. Leverage Templates
ralph_list_templates → view available templates
ralph_get_template with template_id: "tdd" → view full prompt
ralph_loop with template_id: "tdd" → start loopPhilosophy
Iteration > Perfection – Let the loop refine the work
Failures Are Data – Predictable failures inform prompt tuning
Operator Skill Matters – Success depends on good prompts
Persistence Wins – Keep trying until success
Measurement Improves Outcomes – Track and learn from history
When to Use
Best For:
Well-defined tasks with clear success criteria
Tasks requiring iteration and refinement
Greenfield projects
Tasks with automatic verification (tests, linters)
Refactoring with safety nets
Not Recommended For:
Human judgment or design decisions
One-shot operations
Unclear success criteria
Production debugging (use targeted debugging instead)
Development
Command | Description |
| Compile TypeScript |
| Watch mode |
| Start server |
| Run tests |
| Security tests |
| Coverage tests |
Project Structure:
ralph-wiggum-mcp/
├── src/
│ ├── index.ts # Server entry
│ ├── handlers/ # Tool handlers
│ ├── templates/ # Loop templates
│ └── utils/ # Utilities
├── dist/ # Compiled output
└── package.jsonContributing
Contributions welcome! Report bugs, suggest features, submit pull requests, improve documentation, or add new templates.
Resources
Original Technique – Geoffrey Huntley
Claude Code Plugin – Anthropic
Model Context Protocol – Specification
License
MIT License
Available Tools
13 toolsralph_cancelA
Cancel the active Ralph loop.
Stops the current Ralph loop and removes all state. Use this when you want to manually stop the loop before completion.
Inputs: no named parameters.
ralph_detect_toolsA
Detect which tool presets are available for the current project.
Analyzes the project structure and suggests relevant tool presets (e.g., if package.json exists, suggests javascript-test and javascript-lint).
Inputs: no named parameters.
ralph_get_templateB
Get details of a specific template.
Returns the full template configuration including:
Name and description
Complete prompt text
Suggested completion promise
Suggested max iterations
Suggested external tools
Git integration settings
Inputs: template_id (required).
ralph_git_commitA
Create a git commit for the current iteration.
Use this to manually create a commit with a custom message. If auto_commit is enabled, commits are created automatically.
Inputs: message (required).
ralph_git_contextC
Get context from recent Ralph commits.
Shows recent Ralph iteration commits from git history, providing context about what was done in previous iterations.
Inputs: count.
ralph_git_statusA
Get git status and diff summary.
Shows:
Current branch and commit
Modified, added, deleted, and untracked files
Diff summary (files changed, insertions, deletions)
Inputs: no named parameters.
ralph_historyB
Get detailed iteration history report.
Shows a comprehensive history of all iterations including:
Timestamp and duration
Files modified
Commands run
Errors encountered
Git commits
External tools run with results
Inputs: no named parameters.
ralph_iterateA
Process the next iteration of a Ralph loop with enhanced tracking.
After completing work on the current iteration, call this tool with your output and optional metadata to:
Check if completion promise was met
Track iteration history (files modified, commands run, errors)
Run external tools if configured
Analyze progress and detect stagnation
Create git commits if enabled
Either continue loop or stop
Enhanced features:
Automatic progress analysis
Stagnation warnings with suggestions
External tool integration
Git commit tracking
Inputs: last_output (required), files_modified, commands_run, errors, +1 more.
ralph_list_templatesC
List all available Ralph loop templates.
Templates are pre-built prompts and configurations for common tasks:
REST API development
Test-driven development
Refactoring
Bug fixing
Documentation
Performance optimization
Security hardening
And more...
Each template includes suggested settings and external tools.
Inputs: category.
ralph_list_toolsA
List all available external tool presets.
Shows all available tool presets with descriptions, regardless of whether they're applicable to the current project.
Inputs: no named parameters.
ralph_loopB
Start a Ralph Wiggum iterative development loop.
Ralph is a development methodology based on continuous AI agent loops. The technique creates a self-referential feedback loop where the same prompt is fed back repeatedly, allowing the AI to iteratively improve its work until completion.
NEW FEATURES:
Iteration history tracking with progress metrics
Git integration for automatic change tracking
External tool integration (tests, linters)
Smart stagnation detection and warnings
Pre-built templates for common tasks
Use ralph_list_templates to see available templates.
Inputs: prompt, template_id, max_iterations, completion_promise, +2 more.
ralph_run_toolsA
Run external tool presets (test runners, linters, etc.).
Available presets:
javascript-test: Run npm test
javascript-lint: Run ESLint
python-test: Run pytest
python-lint: Run ruff
rust-test: Run cargo test
rust-lint: Run clippy
go-test: Run go test
build: Verify project builds
Use ralph_detect_tools to see which presets are available for your project.
Inputs: presets (required).
ralph_statusA
Get the current status of the Ralph loop with progress insights.
Shows:
Whether a loop is active
Current iteration number
Max iterations setting
Completion promise (if set)
The current prompt being iterated on
Iteration history summary (total time, files changed, tools used)
Progress analysis (stagnation detection, repeated errors)
Estimated iterations remaining
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools have clearly distinct purposes, with only minor potential confusion between ralph_git_status and ralph_status. The git-focused tools (git_commit, git_context, git_status) are well-separated from the core loop tools (loop, iterate, cancel, status). However, ralph_detect_tools and ralph_list_tools could be slightly ambiguous about whether they show available vs. applicable tools.
All tools follow a consistent 'ralph_' prefix with snake_case naming throughout. The naming pattern is highly predictable: ralph_verb_noun or ralph_noun_verb where the second part clearly indicates the action or resource. This consistency makes the tool set easy to navigate and understand.
13 tools is an appropriate number for a comprehensive development loop management system. The count covers all essential aspects: loop control (loop, iterate, cancel, status), template management (list_templates, get_template), tool integration (list_tools, detect_tools, run_tools), git operations (git_commit, git_context, git_status), and history tracking (history). Each tool serves a distinct purpose within the domain.
The tool surface provides complete coverage for the Ralph development loop methodology. It includes all necessary operations: starting and controlling loops (loop, iterate, cancel, status), managing templates (list, get), integrating external tools (detect, list, run), tracking changes through git (commit, context, status), and accessing history. There are no apparent gaps that would prevent agents from implementing the full workflow.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Real-time planetary signal engine and Model Context Protocol (MCP) server for autonomous AI agents.
AI memory governance & hallucination-blocking MCP server with verifiable knowledge cells.
A Model Context Protocol server for Wix AI tools