Agent Dispatch

data-ai MCP Server

MCP server + CLI that lets Claude Code agents delegate tasks to agents in other project directories. Multi-agent orchestration: parallel dispatch, sessions, async jobs, agent dialogues.

Verified
data-aidata-ai
3 views28 stars1 forksMIT

Why This Matters

Discovered via github-topic:model-context-protocol and last synced 3mo ago.

Verified
Source
github-topic:model-context-protocol
Stars
28
Last synced
3mo ago
Install
Check source

Install

Install instructions not detected yet

Check the source repository for the latest setup steps.

View source instructions
34
Tools
0
Resources
0
Prompts
Standard I/O
Transport

Available Tools (34)

goal

string

session_id

string

preview_lines

int

return_ref

bool

responder

string

max_budget_usd

float

error_type

Meaning

agent

string

timeout_seconds

int

max_rounds

int

allowed_tools

string

timeout

Process killed at the timeout

task

string

Parameter

Type

disallowed_tools

string

not_found

Agent directory or `claude` CLI missing

context

string

dispatches

string (JSON)

name

string

recursion

Dispatch nesting exceeded `max_dispatch_depth` (default 3)

caller

string

aggregate

string

directory

string

response_format

string

summary_chars

int

topic

string

requester

string

Scenario

Tool

description

string

plan

bypassPermissions # allowed_tools: # restrict which tools the agent can use # - Read # - Grep # disallowed_tools: # block specific tools # - Write settings: default_timeout: 300 # default_permission_mode: bypassPermissions # inherited by all agents # default_allowed_tools: # inherited when agent has none # - Bash # - Read # - Edit max_dispatch_depth: 3 # recursion protection max_concurrency: 5 # max parallel claude -p processes (per dispatch path) cache: enabled: true ttl: 300 # seconds max_size: 1000 # max cached entries; oldest evicted first (FIFO) ``` Config is reloaded on every tool call — add agents without restarting. ### Auto-Description `agent-dispatch add` without `--description` generates one from: - `CLAUDE.md` — first meaningful paragraph (priority) - `README.md` — first substantial line (fallback) - `pyproject.toml` / `package.json` — project description - `.mcp.json` — lists MCP server names - Stack indicators — Docker, Rust, Go, Python, Node.js - DB indicators — Prisma, Alembic, migrations ## How It Works ``` Your Claude Code session │ ├─ dispatch("infra", "find errors", caller="backend", goal="debug crash") │ ▼ agent-dispatch MCP server ├─ cache check → hit? return cached result ├─ semaphore → limit concurrent processes └─ subprocess.run("claude -p ...", cwd=~/projects/infra/) │ ▼ New Claude Code session in ~/projects/infra/ ├─ Inherits: CLAUDE.md, .mcp.json, project tools ├─ Receives structured prompt with goal/caller/context/task └─ Returns result → cached for future identical requests ``` ## Safety - **Recursion protection** — `AGENT_DISPATCH_DEPTH` env var tracks nesting. Default limit: 3. Best-effort across the subprocess boundary (see [SECURITY.md](SECURITY.md)). - **Argument-injection guard** — structured CLI fields (`session_id`, `model`, `permission_mode`, tool names) that start with `-` are rejected so they can't smuggle extra `claude` flags. - **Path-traversal guard** — caller-supplied `job_id`/`ref` values are validated as 32-char hex before any filesystem access. - **Owner-only state** — job files (`0o600`) and `agents.yaml` (`0o600`) are written for the owner only; their directories are `0o700`. - **Cost control** — `max_budget_usd` per agent or globally. - **Concurrency** — `max_concurrency` (default: 5) caps parallel `claude -p` processes. Note: the sync and async dispatch paths use separate semaphores, so the worst-case total is `2 × max_concurrency`. - **Timeout** — per-agent or global (default: 300s). Orphaned processes are cleaned up. - **Caching** — identical `(agent, task, context, caller, goal, response_format)` requests return cached results, bounded by `cache.max_size` (oldest entry evicted first). Only successes are cached. Sessions and dialogues are never cached. See [SECURITY.md](SECURITY.md) for the full threat model (including the `bypassPermissions` escalation risk and on-disk job files). ## CLI

permission_mode

string

model

string

permission

A tool call was denied

cli_error

Anything else from the `claude` subprocess