Manages Next.js development servers, capturing output and providing status information without blocking Claude Code
Handles npm run commands for development servers, capturing output and allowing process management without blocking Claude Code
Supports pnpm development commands, enabling non-blocking execution and log retrieval for pnpm-based projects
Manages React development servers, capturing compilation output and allowing restarts after code changes
MCP Rewatch
A Model Context Protocol (MCP) server that enables AI coding assistants like Claude Code to manage long-running development processes. Without this tool, Claude Code cannot run commands like npm run dev
because it will block waiting for the process to complete and eventually timeout without seeing any output.
The Problem
When using Claude Code for development, you hit a fundamental limitation:
Claude Code cannot:
- ❌ See any output from long-running processes
- ❌ Know if a dev server started successfully
- ❌ Check for compilation errors
- ❌ Restart servers after making changes
- ❌ Run multiple dev processes simultaneously
This makes it nearly impossible to develop effectively with Claude Code, as you need to manually run all dev servers and restart them after changes.
The Solution
MCP Rewatch acts as a bridge between Claude Code and your development processes:
- Runs processes in the background - Claude Code doesn't block
- Captures all output - stdout/stderr saved in memory buffers
- Provides async access - Claude Code can check logs anytime
- Enables restarts - Claude Code can restart servers after making changes
- Manages multiple processes - Run frontend, backend, database servers together
How It Works
MCP Rewatch acts as an intermediary between Claude Code and your development processes:
- Runs as a separate service that Claude Code can communicate with via MCP
- Manages processes independently - starts your dev servers as child processes
- Non-blocking operations - Claude Code can start/restart processes and immediately continue
- Async log retrieval - Claude Code can check logs later without blocking
- Handles lifecycle properly - graceful shutdown, no orphaned processes
This architecture allows Claude Code to effectively manage long-running processes despite its inherent limitation of not being able to run them directly.
Installation
Install globally via npm:
Or use directly with npx (no installation needed):
Configuration
Create a rewatch.config.json
file in your project root (where you'll be running Claude Code):
The startupDelay
should be tuned based on your specific processes:
- Fast tools (scripts, small servers): 1000-2000ms
- Next.js/React dev servers: 3000-5000ms
- Heavy build processes: 5000-10000ms
- Services with dependencies: 8000-15000ms
Configuration Options
- command: The executable to run (e.g.,
npm
,pnpm
,node
) - args: Array of command arguments
- cwd: Working directory for the process (relative to where MCP server runs, i.e., your project root)
- env: Additional environment variables (optional)
- startupDelay: Time in milliseconds to wait after starting before checking status (default: 3000)
- readyPattern: (Not implemented yet - see roadmap)
Usage with Claude Code
Quick Start (Single Project)
- Add MCP Rewatch to Claude Code:
- Create
rewatch.config.json
in your project root - Start Claude Code from your project directory - MCP Rewatch will look for the config in the current working directory
User-Scoped Setup (Global Access)
To make MCP Rewatch available in all Claude Code sessions:
Important: The server looks for rewatch.config.json
in the current working directory where Claude Code is running. Each project needs its own config file.
Managing Multiple Projects
How it works: MCP Rewatch looks for rewatch.config.json
in the current working directory where Claude Code is running.
Best practices:
- Keep configs project-specific: Each project should have its own
rewatch.config.json
- Use relative paths: In your config, use relative
cwd
paths like"./backend"
or"./frontend"
- Launch Claude Code from project root: Always start Claude Code from your project directory
Example multi-service config:
Available Tools
Once configured, Claude Code can use these tools:
restart_process
Stop and restart a development process by name. Waits for the configured startupDelay
(or 3 seconds by default), then returns initial logs.
get_process_logs
Retrieve logs from a process, optionally limiting the number of lines.
list_processes
List all configured processes and their current status.
stop_all
Stop all running processes gracefully.
Typical Workflow
Here's how Claude Code uses MCP Rewatch during development:
- Initial setup (done once by you):
- Create
rewatch.config.json
in your project - Start Claude Code - servers can be started on demand
- Create
- During development Claude Code will:
- Make code changes to your files
- Call
restart_process({ name: "nextjs" })
to restart the server - Automatically receive initial logs after a 3-second startup delay
- Check the logs for success indicators or errors
- Continue with more changes based on the results
- Call
get_process_logs({ name: "nextjs" })
later if needed
- Key benefits:
- Claude Code never gets blocked by long-running processes
- You don't need to manually restart servers after every change
- Claude Code can verify changes worked by checking logs
- Multiple servers can be managed in parallel
How It Works
When restart_process
is called:
- Stops any existing process with that name
- Starts the new process
- Waits for the configured
startupDelay
(default: 3 seconds) - Returns the startup status and initial logs
This gives Claude Code immediate feedback about whether:
- The process started successfully
- There were immediate errors (port conflicts, missing deps)
- The server is beginning to compile/build
For ongoing monitoring, Claude Code can use get_process_logs
to check progress later.
Why This Matters
Without MCP Rewatch, the development flow with Claude Code is frustrating:
- ❌ Claude Code tries
npm run dev
→ blocks and times out - ❌ You make changes → servers break → manual restart needed
- ❌ No way to check if changes compiled successfully
With MCP Rewatch:
- ✅ Claude Code uses
restart_process
→ returns immediately - ✅ Servers restart automatically after changes
- ✅ Claude Code can check logs to verify success
Troubleshooting
- Processes not starting: Check that
rewatch.config.json
exists in your project root - Permission errors: Ensure the commands in your config have proper execution permissions
- Can't find tools: Verify MCP Rewatch appears in Claude Code's MCP menu
- Logs not appearing: Processes might be buffering output; some servers need specific flags to disable buffering
Development
To contribute to MCP Rewatch:
For development, you can point Claude Code directly to the built output:
Then create a rewatch.config.json
in whatever directory you're testing from.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A Model Context Protocol server that enables AI coding assistants like Claude Code to manage long-running development processes, solving the problem where Claude Code cannot see output from processes like 'npm run dev' that don't exit immediately.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that enables Claude to manage software development projects with complete context awareness and code execution through Docker environments.Last updated -1Python
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.Last updated -1Python
- -securityAlicense-qualityA Model Context Protocol server that connects Claude and other MCP clients to Aider, enabling AI assistants to efficiently edit files, create new files, and interact with git repositories through natural language.Last updated -9PythonThe Unlicense
- -securityFlicense-qualityA Model Context Protocol server that gives Claude access to multiple AI models (Gemini, OpenAI, OpenRouter) for enhanced code analysis, problem-solving, and collaborative development through AI orchestration with conversations that continue across tasks.Last updated -3,681Python