mcp-restart
Click on "Install 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., "@mcp-restartrestart the claude agent"
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.
mcp-restart
Supervise your local agents over MCP — start, stop, and restart them, including restarting themselves.
mcp-restart is a small supervisor server. You run it, it starts your agent (Claude Code, or anything else you can launch from a command line) as a child process, and exposes start_agent, stop_agent, restart_agent over a Model Context Protocol endpoint on localhost.
The killer feature: because the agent is a child of the supervisor, the agent can call restart_agent on itself. It edits its own launch config, restarts, and comes back up as the new version — an evolution loop with no human in the middle.
┌─────────────────────────────────────────────┐
│ mcp-restart (supervisor) │
│ │
│ http://127.0.0.1:4310/mcp ◄── MCP tools │
│ │ │
│ │ spawn / SIGTERM / SIGKILL │
│ ▼ │
│ ┌───────────────────────────┐ │
│ │ claude (child process) │ │
│ │ --mcp-config → restart │ │
│ └───────────────────────────┘ │
└─────────────────────────────────────────────┘Why a supervisor instead of an MCP server the agent spawns?
An MCP server over stdio is a child of the agent. If the agent kills itself, its pipes close and the server dies with it — you can't restart something from inside a process it spawned.
mcp-restart inverts that: the supervisor is the parent, the agent is the child. Restarting an agent is just kill + respawn, the supervisor owns one port for the whole session (no port contention across restarts), and the supervisor's lifetime is independent of any single agent's lifetime. The agent talks to it over loopback HTTP, so the connection is re-established on every boot.
Related MCP server: hcom-mcp
Quickstart
# install
npm install -g mcp-restart # or: npx mcp-restart ... (no install)
# create a config
mcp-restart init
# → wrote ./mcp-restart.config.json
# start the supervisor (starts agents with "autostart": true)
mcp-restart serveGenerated config:
{
"host": "127.0.0.1",
"port": 4310,
"agents": [
{
"name": "claude",
"command": "claude",
"cwd": ".",
"autostart": true
}
]
}When serve starts, it spawns Claude with --mcp-config <generated> pointing at http://127.0.0.1:4310/mcp. Claude has the restart tools from the moment it boots. Ctrl+C the supervisor and everything shuts down cleanly together.
MCP tools
Tool | Description |
| All configured agents with state, pid, uptime, last exit code |
| Version, pid, endpoint URL, uptime, agent statuses |
| Start a configured agent (name) |
| Stop gracefully: SIGTERM → wait for graceful timeout → SIGKILL |
| Stop, re-read the config file, start again with the fresh config |
Every tool returns structured JSON. Unknown agents and invalid operations come back as MCP tool errors, never crashes.
The self-restart loop (agent evolution)
The point of this project. An agent that can restart itself can evolve: edit its code or its launch config, then reboot into the new version.
The agent writes its own entry into
mcp-restart.config.json(it knows how it's launched).It calls
restart_agentwith its own name.The supervisor terminates it, re-reads the config file, and spawns the replacement.
The new agent boots, reconnects to the same endpoint, and picks up where the loop left off.
Because the config is re-read on every restart, changes take effect immediately — no supervisor restart required. The supervisor itself only cares that the agent is running; what the agent becomes is up to the agent.
Config reference
Top-level:
Field | Default | Description |
|
| Bind address. Non-loopback addresses require a |
|
| TCP port. |
| — | Bearer token required on all MCP requests (also settable via |
|
| Generated MCP configs, supervisor log, agent logs. |
|
| Array of agent definitions. |
Per agent:
Field | Default | Description |
| — | Unique name used to address the agent (letters, digits, |
| — | Executable to spawn, resolved via PATH. No shell involved — put everything in |
|
| Arguments. |
| supervisor's cwd | Working directory. |
| — | Extra environment variables. |
|
| Start when the supervisor starts. |
|
| How long to wait after SIGTERM before SIGKILL. |
|
| Wire the restart MCP config into the agent (see below). |
|
| Agent stdout/stderr in |
MCP injection
With injectMcp: true (default), the supervisor:
generates a standard MCP config file (
{ "mcpServers": { "restart": { "type": "http", "url": ... } } }) in<stateDir>/mcp-config/<name>.mcp.json,sets
MCP_RESTART_URLandMCP_RESTART_CONFIG_FILEenv vars for the agent,for Claude Code (
commandbasename starting withclaude), appends--mcp-config <file>so it's wired up automatically.
Any MCP-capable agent can read MCP_RESTART_CONFIG_FILE and register the restart server itself.
Running in the background
mcp-restart serve --daemonDaemon mode detaches from the terminal, writes the supervisor log to <stateDir>/mcp-restart.log, and routes agent output to per-agent log files. Agents run headless. Stop it with pkill -TERM -f "mcp-restart serve" or a service manager.
For always-on setups, run serve --daemon under launchd/systemd/whatever you already use for long-running things.
Security
Loopback only by default. Binding anything else is refused unless you set a
token.Token auth — when set, every MCP request requires
Authorization: Bearer <token>.The supervisor only touches processes it spawned. There is no "kill arbitrary PID" tool.
restart_agentoperates exclusively on configured agents.Graceful-then-forced stops. SIGTERM first, SIGKILL only after
gracefulTimeoutMs.No shell.
command/argsare passed toexecvpdirectly — no shell injection surface.
FAQ
Why not stdio? Because a stdio MCP server dies with the agent that spawned it. The whole point is surviving the agent's death — and the supervisor model removes the "detached respawn" dance entirely.
Why HTTP instead of spawning a fresh MCP server per boot? One supervisor owns one port for the whole session. No port contention, no config re-wiring across restarts, and the loopback endpoint is reachable by any local process.
Does my agent auto-restart when it crashes? No. autostart only runs at supervisor boot; crashes are logged, never restarted silently. No crash loops. If you want crash-restart, wrap the agent (or run it under launchd/systemd) — the supervisor will happily supervise whatever comes up.
What about Windows? The code has basic support (no process-group kills — children are signalled directly) but it's untested. macOS and Linux are the supported platforms.
What if I remove an agent from the config while it's running? The process keeps running (we don't kill things just because you edited a file) but it stops appearing in list_agents. Use stop_agent first.
Development
npm install
npm run build # tsc → dist/
npm test # 30 tests: config validation, supervision, full MCP loop, CLI
npm run typecheck # strict typecheck of src + testThe integration test boots the real stack (HTTP server + MCP client) with a fake agent, restarts it through the MCP protocol, verifies the replacement sees the edited config, and confirms auth rejection without a token.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityAmaintenanceMCP server that enables AI agents to run a deterministic orchestration loop with decomposition, subagent execution, and review feedback across multiple LLM backends.53MIT
- Alicense-qualityBmaintenanceA control-plane MCP server for launching and supervising hcom-managed agents, running as a single persistent HTTP server to coordinate multiple sessions.1MIT
- Flicense-qualityBmaintenanceMCP server orchestrating local multi-agent workflows with gated lifecycle, handoff events, and host-level continuation.
- AlicenseAqualityBmaintenanceMCP server that enables a coordinator AI agent to spawn, control, and supervise local coding agents with interactive gating for high-risk operations.10381MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
Hosted AgentLux MCP server for marketplace, identity, creator, services, and social flows.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sje397/mcp-restart'
If you have feedback or need assistance with the MCP directory API, please join our Discord server