agent-herder
Unified MCP interface to monitor and control coding agents across OpenCode, Claude Code, and Codex CLI.
README
Agent Herder
MCP server for monitoring and controlling coding agents.
One unified MCP interface to monitor and manage sessions across three coding agent harnesses:
- OpenCode — via HTTP server API (
opencode serve) - Claude Code — via CLI and session files
- Codex CLI — via CLI
What it does
Monitoring
- List all agents — which are running, idle, stopped, or need input
- Inspect agent details — model, cost, duration, message count, working directory
- See pending permissions — agents waiting for tool approval
Management
- Send a message — sync (wait for response), queue (fire-and-forget), or steer (redirect)
- Resume a stopped agent — with an optional new message
- Stop an agent — abort a running session
- Respond to permission requests — allow or deny tool calls (OpenCode)
- Set permissions — configure allowed tools and permission modes
Prerequisites
At least one of:
opencodeinstalled andopencode serverunningclaude(Claude Code CLI) installedcodex(OpenAI Codex CLI) installed andOPENAI_API_KEYset
Install
npm install
npm run build
Configure
Environment Variables
| Variable | Default | Description |
|---|---|---|
ENABLE_OPENCODE |
true |
Enable OpenCode adapter |
ENABLE_CLAUDE |
true |
Enable Claude Code adapter |
ENABLE_CODEX |
true |
Enable Codex adapter |
OPENCODE_URL |
http://127.0.0.1:4096 |
OpenCode server URL |
OPENCODE_SERVER_PASSWORD |
Password for OpenCode server auth | |
OPENCODE_SERVER_USERNAME |
opencode |
Username for OpenCode server auth |
CLAUDE_BIN |
claude |
Path to Claude Code CLI binary |
CODEX_BIN |
codex |
Path to Codex CLI binary |
CODEX_DATA_DIR |
~/.codex |
Codex data directory |
Add to your MCP client
Claude Code:
claude mcp add agent-herder -- node /path/to/agent-herder/dist/index.js
Cursor / other MCP clients — add to your MCP config:
{
"mcpServers": {
"agent-herder": {
"command": "node",
"args": ["/path/to/agent-herder/dist/index.js"],
"env": {
"ENABLE_OPENCODE": "true",
"ENABLE_CLAUDE": "true",
"ENABLE_CODEX": "false"
}
}
}
}
OpenCode — add to opencode.json:
{
"mcp": {
"agent-herder": {
"command": "node",
"args": ["/path/to/agent-herder/dist/index.js"]
}
}
}
Available Tools
| Tool | Description |
|---|---|
list_agents |
List all sessions, filter by harness or status |
agent_info |
Get detailed info about a specific session |
send_message |
Send a message (sync/queue/steer) |
resume_agent |
Resume a stopped session |
stop_agent |
Abort a running session |
respond_permission |
Allow/deny a pending permission request |
set_permissions |
Set allowed tools and permission mode |
Architecture
┌─────────────────┐
│ MCP Client │ (Claude Code, Cursor, OpenCode, etc.)
└────────┬────────┘
│ stdio (MCP protocol)
┌────────▼────────┐
│ Agent Herder │ (this server)
│ ┌───────────┐ │
│ │ MCP Tools │ │ 7 unified tools
│ └─────┬─────┘ │
│ │ │
│ ┌─────▼──────┐ │
│ │ Adapters │ │
│ ├────────────┤ │
│ │ OpenCode │──┼── HTTP → localhost:4096
│ │ Claude │──┼── CLI + ~/.claude/sessions
│ │ Codex │──┼── CLI + ~/.codex/sessions
│ └────────────┘ │
└─────────────────┘
Harness-specific notes
OpenCode
- Best supported — full HTTP API with session management, permissions, SSE events
- Requires
opencode serverunning (auto-starts with TUI on port 4096) - Supports remote permission response and real-time status
Claude Code
- Sessions read from
~/.claude/projects/*/sessions/*.jsonl - Sending messages uses
claude -p --resume <id> - Permissions must be set at launch via
--allowedToolsflag - Running process detection via
pgrep
Codex CLI
- Sessions read from
~/.codex/sessions/ - Sending messages spawns new
codexinvocations - Uses
--full-automode for unattended operation - Permissions set at launch via
--full-auto,--approve-toolsflags
Development
npm run dev # TypeScript watch mode
npm run build # Compile
npm run inspect # Open MCP Inspector for interactive testing
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。