agent-link-mcp
Spawn and collaborate with other AI coding agent CLIs through MCP tools.
Spawn a single agent (Claude, Codex, Gemini, Aider) to perform a task, optionally with context (files, error, intent, diff), model, thinking depth, retry/escalation, and timeout.
Spawn multiple agents in parallel for independent subtasks, multiple opinions, or parallel reviews.
Reply to an agent's clarifying question to continue a bidirectional conversation until it returns a result.
Kill an active agent session to terminate it and clean up resources.
List all known agent CLIs and their availability on the system.
Get the status of all active agent sessions.
Supports the use of local LLMs by spawning Ollama as a subprocess, enabling agents to use local models for specialized subtasks or private data processing.
Facilitates integration with OpenAI-powered agents such as Codex, permitting agents to exchange instructions and results for complex coding operations.
agent-link-mcp
English | 한국어
MCP server for bidirectional AI agent collaboration. Spawn and communicate with any AI coding agent CLI — Claude Code, Codex, Gemini, Aider, and more.
When to Use
Version 0.5.2 fixes Claude JSON response parsing, preserves the original task/context and working directory across replies, and connects cancellation to the running process. reply starts a fresh CLI invocation with the recorded conversation; it does not resume a provider-side session. Concurrent replies to the same session are rejected. kill_agent waits for termination, escalating after five seconds if needed; server shutdown also cancels active children. Sessions are held in memory and do not survive server restarts.
Stuck on a bug? — Your agent tried twice and failed. Let it ask another agent for a fresh perspective.
Need a second opinion? — Get code review or architectural advice from a different AI model.
Cross-model strengths — Use Claude for planning, Codex for execution, Gemini for research.
Parallel work — Spawn multiple agents to tackle independent subtasks simultaneously.
Rubber duck debugging — Have one agent explain the problem to another and get back a solution.
Related MCP server: personal-mcp
Use Cases
Get Help When Stuck
Your primary agent keeps failing on the same issue? Ask another agent:
# Claude Code is stuck on a TypeScript error it can't resolve.
# It spawns Codex for a second opinion:
spawn_agent("codex", "This TypeScript error keeps appearing. How do I fix it?", {
error: "Type 'string' is not assignable to type 'number'",
files: ["src/utils.ts"]
})Cross-Agent Code Review
Have another model review your agent's code changes:
spawn_agent("claude", "Review these changes for bugs and edge cases", {
files: ["src/api.ts", "src/handler.ts"],
intent: "Code review before merge"
})Multi-Agent Pipeline
Build a pipeline where agents handle different stages:
# Agent 1: Research
spawn_agent("gemini", "Find the best approach for WebSocket reconnection")
# Agent 2: Implementation (using Agent 1's advice)
spawn_agent("codex", "Implement WebSocket reconnection with exponential backoff", {
files: ["src/ws-client.ts"]
})
# Agent 3: Review
spawn_agent("claude", "Review this implementation for production readiness", {
files: ["src/ws-client.ts"]
})Bidirectional Collaboration
Agents can ask questions back. The host answers, and work continues:
Host: spawn_agent("codex", "Add caching to the API layer")
Codex: [QUESTION] Should I use Redis or in-memory cache?
Host: reply("codex-a1b2c3", "Use Redis, we have it in our docker-compose")
Codex: [RESULT] Added Redis caching with 5-minute TTL...Why
AI coding agents get stuck sometimes. Instead of waiting for you, they can ask another agent for help. agent-link-mcp lets any MCP-compatible agent spawn other agent CLIs as collaborators, exchange questions, and get results back — all through standard MCP tools.
One-side install — only the host agent needs this MCP server. Spawned agents are just CLI subprocesses.
Bidirectional — the host can ask questions to the spawned agent, and the spawned agent can ask questions back.
Any agent — works with any CLI that accepts a prompt and returns text. Built-in profiles for Claude, Codex, Gemini, and Aider.
Multi-agent — spawn multiple agents simultaneously for parallel collaboration.
Prerequisites
Requires Node.js 20 or later, including the MCP host's npx environment. Agent CLIs may have additional requirements of their own.
agent-link-mcp spawns other AI agents as CLI subprocesses. You need to install and authenticate the agent CLIs you want to collaborate with:
Agent | Install | Auth |
Claude Code |
|
|
Codex |
|
|
Gemini CLI |
| Run |
Aider |
| Set |
You only need the ones you plan to use. agent-link-mcp auto-detects which CLIs are installed.
Install
# Claude Code
claude mcp add agent-link npx agent-link-mcp
# Codex
codex mcp add agent-link npx agent-link-mcp
# Any MCP client
npx agent-link-mcpNote: Only the agent you're working in needs this MCP server installed. The other agents are spawned as subprocesses — they don't need agent-link-mcp.
Tools
spawn_agent
Spawn an agent and send it a task.
{
"agent": "codex",
"task": "Refactor this function for better performance",
"context": {
"files": ["src/utils.ts"],
"error": "TypeError: Cannot read property 'x' of undefined",
"intent": "Performance improvement"
},
"model": "o3",
"timeoutMs": 7200000
}Parameter | Type | Default | Description |
| string | required | Agent name ( |
| string | required | Task description |
| object | — | Optional |
| string | cwd | Working directory for the agent process |
| string | — | Model to use (e.g. |
| string | — | Thinking/reasoning depth; supported values depend on the selected CLI and model. Claude: |
| boolean | false | Auto-retry on failure (up to 3 attempts). |
| boolean | false | On retry, automatically increase thinking level. Requires |
| number | 3600000 | Timeout in ms. Default: 1 hour. |
Returns one of:
{ status: "done", agentId: "codex-a1b2c3", result: "..." }— task completed{ status: "waiting_for_reply", agentId: "codex-a1b2c3", question: "..." }— agent needs clarification{ error: "...", agentId: "codex-a1b2c3" }— something went wrong
spawn_agents
Run multiple agents in parallel. Returns all results together.
{
"agents": [
{ "agent": "codex", "task": "Review for bugs", "context": { "diff": true } },
{ "agent": "claude", "task": "Review for security", "context": { "diff": true } }
],
"cwd": "/path/to/project"
}Returns { summary: { total, succeeded, failed, waiting }, results: [...] }.
reply
Answer a spawned agent's question and continue the conversation.
{
"agentId": "codex-a1b2c3",
"message": "Yes, you can remove the side effects"
}kill_agent
Abort a running agent session.
{
"agentId": "codex-a1b2c3"
}list_agents
List available agent CLIs.
{
"agents": [
{ "name": "claude", "command": "claude", "source": "auto", "available": true },
{ "name": "codex", "command": "codex", "source": "auto", "available": true },
{ "name": "gemini", "command": "gemini", "source": "auto", "available": false }
]
}get_status
Get active agent sessions.
{
"sessions": [
{ "agentId": "codex-a1b2c3", "agent": "codex", "status": "waiting_for_reply", "startedAt": "..." }
]
}How It Works
You (using Claude Code)
↓
"Ask Codex to help with this refactoring"
↓
Claude Code → spawn_agent("codex", task, context)
↓
agent-link-mcp server → spawns `codex` CLI as subprocess
↓
Codex processes the task...
↓
Codex: "[QUESTION] Should I remove the side effects?"
↓
agent-link-mcp → parses response → returns to Claude Code
↓
Claude Code → reply("codex-a1b2c3", "Yes, remove them")
↓
agent-link-mcp → re-invokes Codex with accumulated context
↓
Codex: "[RESULT] Refactoring complete. Here's what I changed..."
↓
Claude Code receives the result and continues workingConfiguration
Custom profiles using outputFormat: "json" must emit a single result object with a string result field (the Claude print-mode format). is_error: true or an error subtype is treated as failure; metadata is not included in the conversation.
Auto-detection
agent-link-mcp automatically detects installed agent CLIs:
Agent | CLI Command |
Claude Code |
|
Codex |
|
Gemini |
|
Aider |
|
Custom agents
Add custom agents via config file at ~/.agent-link/config.json:
{
"agents": {
"codex": {
"command": "/usr/local/bin/codex",
"args": ["--full-auto"],
"promptFlag": null,
"outputFormat": "text"
},
"my-local-llm": {
"command": "ollama",
"args": ["run", "codellama"],
"promptFlag": null,
"outputFormat": "text"
}
}
}Override config path with AGENT_LINK_CONFIG environment variable.
Model Selection
You can specify which model the spawned agent should use via the model parameter:
# Use a specific model for Codex
spawn_agent("codex", "Debug this issue", { model: "o3" })
# Use a specific model for Claude
spawn_agent("claude", "Review this code", { model: "claude-sonnet-4" })The model name is passed to the agent CLI via its --model flag. If omitted, the agent uses its default model.
Thinking / Reasoning Depth
Control how deeply the agent reasons with the thinking parameter:
# High reasoning for complex debugging
spawn_agent("codex", "Debug this race condition", { thinking: "high" })
# Max effort for Claude
spawn_agent("claude", "Architect a new auth system", { thinking: "max" })Agent | Flag | Values |
Claude |
|
|
Codex |
| Model-dependent, e.g. |
Aider |
|
|
If omitted, the agent uses its default reasoning level.
Timeout
Default timeout is 1 hour (3,600,000ms). You can override per-call:
# 2 hour timeout for complex tasks
spawn_agent("codex", "Refactor the entire auth system", { timeoutMs: 7200000 })Conversation Protocol
Spawned agents receive instructions to format their responses:
[QUESTION] ...— needs clarification from the host agent[RESULT] ...— task completed
If the agent doesn't follow the format, the entire output is treated as a result.
Development
Run npm ci, npm run build, and npm test locally. Tests use offline Node.js fixtures and do not call model providers. CI is manual (workflow_dispatch) and requires an available self-hosted runner; pushes and pull requests do not start GitHub-hosted jobs.
License
MIT
Available Tools
6 toolsget_statusARead-only
Get the status of all active agent sessions.
Inputs: no named parameters.
kill_agentADestructive
Terminate an active agent session and clean up its resources.
Inputs: agentId (required).
list_agentsARead-only
List all known agents and their availability on this system.
Inputs: no named parameters.
replyA
Reply to an agent that is waiting for clarification. Continues the conversation until the agent returns a result or asks another question.
Inputs: agentId (required), message (required).
spawn_agentA
Spawn an AI agent to work on a task. Returns a question if the agent needs clarification, or a result when done.
Inputs: task (required), agent (required), cwd, model, +5 more.
spawn_agentsA
Spawn multiple AI agents in parallel. Each agent runs independently and results are returned together. Great for getting multiple opinions, parallel code reviews, or distributing subtasks.
Inputs: agents (required), cwd, timeoutMs.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clear, distinct purpose: spawn, spawn multiple, list, get status, reply to clarification, kill. No overlap between get_status and list_agents, and spawn_agent vs spawn_agents are differentiated by number of agents.
Most tools follow verb_noun pattern (e.g., get_status, kill_agent, list_agents, spawn_agent, spawn_agents). 'reply' is a verb-only exception, but it's a common pattern for interactive tools and does not cause confusion.
6 tools is well within the optimal 3-15 range, covering the core operations for managing AI agent sessions without being bloated or sparse.
The tool surface covers the full agent lifecycle: spawning (solo and parallel), listing, status checking, interactive dialogue (reply), and termination. Minor gaps like retrieving results from completed agents are handled by spawn/reply outputs, so no critical missing functionality.
Maintenance
Related MCP Connectors
LLM Orchestration Agent (Mcp)
Real-time chat for AI agents. Claude Code, Cursor, Cline and Codex join channels over MCP.
HiveCapital MCP Server — autonomous investment layer for AI agents
Impri MCP server — human-in-the-loop approval inbox for AI agents
Related MCP Servers
- AlicenseBqualityBmaintenanceMCP server that lets AI models invoke CLI agents (Gemini, Codex, Claude, OpenCode) as tools — with parallel execution, retries, and structured output parsing.11,038 PyPI3MIT
- FlicenseNot gradedqualityBmaintenanceMCP server that bridges coding agents (Claude Code, Codex, Gemini CLI) via ACP for pair programming, enabling agents to consult each other as tools.3-
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to communicate, coordinate, and collaborate on complex tasks through a local MCP server.8Business Source 1.1
- AlicenseNot gradedqualityDmaintenanceA multi-agent MCP server that enables AI coding agents (Claude Code, Codex CLI, Gemini CLI) to communicate with each other.MIT