Autonomous agent orchestration for GitHub Copilot CLI with MCP server for Claude Code
  • JavaScript 100%
Find a file
2026-08-27 10:55:39 +02:00
mcp-servers/agent wip: snapshot of uncommitted local changes, 2026-08-27 (preserved before workstation cleanup) 2026-08-27 10:55:39 +02:00
.editorconfig Add repository standards and metadata cleanup automation 2025-11-16 01:37:01 +01:00
.gitignore Add comprehensive test suite and fix discovered security vulnerabilities 2025-12-19 21:36:06 +01:00
LICENSE Add repository standards and metadata cleanup automation 2025-11-16 01:37:01 +01:00
package.json wip: snapshot of uncommitted local changes, 2026-08-27 (preserved before workstation cleanup) 2026-08-27 10:55:39 +02:00
README.md wip: snapshot of uncommitted local changes, 2026-08-27 (preserved before workstation cleanup) 2026-08-27 10:55:39 +02:00

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=UUID instead 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.json replaces per-session JSON files
  • Event-based await — await_all waits for all sessions; await_any returns 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