---
name: "Server self-rebuild and restart via MCP tool"
---

# Story 286: Server self-rebuild and restart via MCP tool

## User Story

As a project owner away from my terminal, I want to tell the bot to restart the server so that it picks up new code changes, without needing physical access to the machine.

## Acceptance Criteria

- [ ] MCP tool `rebuild_and_restart` triggers a cargo build of the server
- [ ] If the build fails, server stays up and returns the build error
- [ ] If the build succeeds, server re-execs itself with the new binary using std::os::unix::process::CommandExt::exec()
- [ ] Server logs the restart so it's traceable
- [ ] Matrix bot reconnects automatically after the server comes back up
- [ ] Running agents are gracefully stopped before re-exec

## Out of Scope

- TBD
