使用说明
Shelfwood Agents
MCP server for orchestrating GitHub Copilot CLI agents via Claude Code.
Architecture
mcp-servers/agent/
├── index.js # MCP server (entry point)
└── src/
├── session-manager.js # Session lifecycle, state detection, await
├── tmux.js # Tmux interface (all tmux calls)
├── store.js # Single-file metadata store
└── copilot.js # Copilot binary discovery and command building
All logic is in-process Node.js. No bash scripts, no subprocess spawning for state management.
Design
- Session reuse — idle sessions are resumed via
copilot --resume=UUIDinstead of creating new tmux sessions per task - Ephemeral copilot — copilot exits after completing a task; no background CPU/memory between tasks
- Inline tasks — task content is passed directly as a prompt; no file staging required
- Single metadata file — one
sessions.jsonreplaces per-session JSON files - Event-based await —
await_allwaits for all sessions;await_anyreturns on first change
Setup
cd mcp-servers/agent && npm install
Data
Session metadata is persisted to ~/.local/share/copilot-agent/sessions.json (respects $XDG_DATA_HOME).
Agent output is streamed via pipe-pane to ~/.local/share/copilot-agent/logs/<session-name>.log. These files are written continuously while a session is running and are useful for debugging without read_output.
Add to Claude Code MCP settings:
{
"mcpServers": {
"agent": {
"command": "node",
"args": ["/path/to/shelfwood-agents/mcp-servers/agent/index.js"],
"type": "stdio"
}
}
}
MCP Tools
| Tool | Description |
|---|---|
run_task |
Launch a task (reuses idle sessions, inline task content). Optional: session_name, system_instructions |
send_message |
Send message to agent (auto-resumes if idle) |
await_all |
Wait for all sessions to reach terminal state (idle, waiting_for_input, error, missing) |
await_any |
Wait for first session to change state |
list_sessions |
List sessions with status |
read_output |
Read recent tmux pane output (default 50, max 200 lines) |
get_status |
Detailed session status including detected state |
stop_session |
Kill session and remove from store |
cleanup |
Remove idle sessions older than N minutes (default 60) |
health_check |
System health check |
Testing
npm test
69 tests across 6 suites: store, tmux, copilot, handler, session-manager, validation.
License
MIT