self-claude-mcp
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., "@self-claude-mcphot restart my Claude session"
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.
self-claude-mcp
Requires Claude Code | SIGN UP HERE
MCP server for Claude Code self-management commands (hot restart, compaction).
Installation
pip install self-claude-mcpAdd to your Claude MCP config:
{
"mcpServers": {
"self-claude": {
"command": "self-claude-mcp",
"env": {
"AUTOPOIESIS": "1"
}
}
}
}Note:
AUTOPOIESIS=1is optional. If set, restart messages will remind Claude to enable autopoiesis-mcp (makes Claude loop on purpose). Remove theenvblock if you don't use it.
Related MCP server: claude-sessions-mcp
Setup
After installing the MCP, Claude needs to install bash scripts for the commands to work.
Ask Claude to run:
Use self_claude with setup_only=True and install the scriptsOr manually: call self_claude(cmd="", setup_only=True) to get the installation instructions.
Requirements
tmux: Scripts use tmux for session management
Claude Code: Must be running inside a tmux session named "claude"
Starting Claude in tmux
Use claude-debug (installed by setup) or manually:
tmux -u new-session -d -s claude
tmux send-keys -t claude 'claude --debug' Enter
tmux -u attach -t claudeUsage
Once set up, Claude can use these commands:
Command | Description |
| Hot restart with auto-resume |
| Trigger context compaction |
| Get installation instructions |
Hot Restart
Use when MCP configs change and you need to reload without losing conversation:
Claude calls
self_claude("self_restart")→ returnsbash self_restartClaude runs
bash self_restartHandler sends
/exit, waits for death, relaunches, sends/resume, selects session 1
Compaction
Use when context is running low:
Claude calls
self_claude("self_compact")→ returnsbash self_compactClaude runs
bash self_compactSends
/compactto the tmux session
Troubleshooting
"No tmux session 'claude'"
Make sure Claude Code is running inside a tmux session named "claude":
tmux -u new-session -s claude
claude --debug"Handler not found"
Run the setup instructions again:
self_claude(cmd="", setup_only=True)Then install the scripts to /usr/local/bin/.
Restart hangs
Check the handler log:
cat /tmp/claude_restart_handler.logCommon issues:
pgrep -x "claude"matches wrong process → verify withpgrep -x "claude"tmux session died → restart with
claude-debug
Docker / Container
If running in a container, make sure:
tmux is installed:
apt install tmuxScripts are in PATH:
/usr/local/bin/or~/.local/bin/Container user can write to
/tmp/
Scripts Installed
Script | Location | Purpose |
|
| Start Claude in tmux background |
|
| Orchestrator (spawns handler) |
|
| Detached handler (does actual restart) |
|
| Trigger compaction |
|
| Manage Claude Code rule files |
rules command
Manage Claude Code rule files from the command line:
# Add a rule
rules global my-rules "Always use TypeScript"
rules project api-rules "Use REST conventions"
# List rules
rules show global
rules show project
# Delete a rule
rules delete global my-rulesRules are stored in ~/.claude/rules/ (global) or ./.claude/rules/ (project).
Environment Variables
Variable | Description |
| Enable autopoiesis warning in restart message. Requires autopoiesis-mcp. |
Set in your shell profile or export before running Claude.
Security Note
⚠️ Warning: You should disallow this MCP on subagents. Subagents running these commands can cause strange interactions.
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.
Latest Blog Posts
- 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/sancovp/self-claude-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server