claude-mcp-swarm
An MCP server that wraps Anthropic's Claude Code CLI (claude) with true parallel execution, live task monitoring, git worktree isolation, and MCP Tasks support. Powered by stdlib-only mcp-swarm-core (zero third-party runtime dependencies).
Why?
Run multiple Claude Code (claude -p) agents concurrently from Codex, Antigravity, Claude Code, or any MCP client without serial queueing, with live visibility into tool calls, token usage, structured output, tool errors, permission denials, and isolated HEAD-based git worktrees.
Key features:
- True parallel fan-out - each task runs as an independent
claude -p --output-format=stream-json --verbosesubprocess - Worktree isolation -
worktree: truecreates an isolatedHEAD-based git worktree (claude-swarm/<id>) per task so parallel runs never edit past each other - Batch wait & MCP Tasks - supports both explicit fan-out (
claude_async+claude_wait) and the official MCP 2026-07-28 Tasks extension (io.modelcontextprotocol/tasks) - Live JSONL streaming status - parses
system,assistant,user, and terminalresultNDJSON events incrementally for live tool counts, last tool call, token usage, tool errors, and permission denials - Non-interactive
claude -pflag support ---model,--fallback-model,--effort,--permission-mode,--dangerously-skip-permissions,--tools,--allowed-tools,--disallowed-tools,--add-dir,--agent,--agents,--system-prompt,--append-system-prompt,--json-schema,--settings,--setting-sources,--mcp-config,--strict-mcp-config,--max-turns,--max-budget-usd,--disable-slash-commands,--no-session-persistence,--bare,--resume, and--fork-session - Safe stdin transport - prompts are sent via UTF-8 stdin and all value options use
--flag=valuesyntax, avoiding OS argv length limits, leading--option injection, Commander.js variadic greediness, and Windows shell quoting issues
MCP Protocol Support
- Stateless MCP
2026-07-28- supportsserver/discover, per-request_meta["io.modelcontextprotocol/protocolVersion"]and_meta["io.modelcontextprotocol/clientCapabilities"],resultTypediscriminators, and unsupported-version rejection (-32022). - Official Tasks extension (
io.modelcontextprotocol/tasks) - when a client advertisesio.modelcontextprotocol/tasks,claudeandclaude_replyimmediately return aCreateTaskResult(resultType: "task") with a 128-bittaskId. Clients polltasks/getand cancel viatasks/cancelper SEP-2663. - Backward-compatible stateful MCP (
2024-11-05through2025-11-25) - supportsinitializenegotiation, top-level serverinstructions,ping, toolannotations,outputSchema+structuredContent, accurateisErrorflags, enrichednotifications/progress, and JSON-RPC 2.0 §4.1 silent handling of unknown notifications.
Tools
| Tool | Description |
|---|---|
claude |
Synchronous execution (or native MCP Task when client supports io.modelcontextprotocol/tasks); returns text, session_id, token usage, optional structured_output, tool_errors, permission_denials, and structured failure details |
claude_async |
Launch a task, get a task_id immediately (fan-out). Not fire-and-forget: results come back only via claude_wait. Pass session_id to resume a session (with optional fork_session: true) |
claude_reply |
Continue a previous session via claude --resume=<session_id>. Automatically reuses the original session's working directory (including its worktree path) when cwd is omitted |
claude_status |
Live read-only peek: tools called, last tool call, permission mode, tool errors, token usage, and failure cause |
claude_wait |
Block until multiple tasks complete and return results or structured failure details |
claude_cancel |
Kill a running async task and its child process tree (preserves worktree for inspection); if already completed or failed, preserves and reports that outcome |
claude_models |
List available Claude Code model aliases/identifiers, resolved model IDs, and supported effort levels (queried live without starting a turn, persisting a session, or running hooks) |
Installation
PyPI
uvx --upgrade claude-mcp-swarm --model opus
Local checkout (development)
uvx --from /path/to/claude-mcp-swarm --with /path/to/mcp-swarm-core claude-mcp-swarm --model opus
Codex (~/.codex/config.toml)
[mcp_servers.claude-swarm]
command = "uvx"
args = ["--upgrade", "claude-mcp-swarm", "--model", "opus", "--dangerously-skip-permissions"]
Unattended permissions & MCP isolation
- Pass
--dangerously-skip-permissionsor--permission-mode bypassPermissions/acceptEdits/dontAskin server defaults (or per call) for unattended runs in trusted repos or sandboxes. - If you want spawned Claude workers to skip loading your user MCP servers (faster startup and avoids recursive MCP server loading), pass
--strict-mcp-config(optionally with--mcp-config <file-or-json>).
Usage
Parallel execution
1. Call claude_async(prompt="Audit module A", worktree=true) -> task_id: "a1b2c3d4"
2. Call claude_async(prompt="Audit module B", worktree=true) -> task_id: "e5f60718"
3. Call claude_wait(task_ids=["a1b2c3d4", "e5f60718"])
-> blocks until all finish, returns all results
claude_async and claude_wait belong in the same turn: task_id is internal to this server and not tracked by legacy MCP clients. Short timeout values on claude_wait are raised to a floor (default 150s, configurable via CLAUDE_SWARM_MIN_WAIT) so long waits cross the client's 2-minute auto-backgrounding threshold; already-finished tasks return immediately.
Session continuity & worktree cwd preservation
- When
cwdis omitted onclaude_reply(orclaude_async(session_id=...)), the server automatically reuses the original session's working directory (including its worktree path if it still exists; persisted on disk for async and worktree runs, and tracked in-process for non-worktree sync runs). - Pass
fork_session: truealongsidesession_idto branch a conversation into a newsession_idwithout mutating the original transcript. - Note that
no_session_persistence: truedisables writing session transcripts to disk, so those sessions cannot be resumed later.
Structured output (json_schema)
Pass json_schema (JSON object or string) to forward --json-schema to Claude Code so it can emit validated JSON via its StructuredOutput tool. When claude returns result.structured_output, it is exposed on structuredContent.structured_output. Callers should still check that structured_output is present, because Claude CLI can exit 0 without it on short-circuited CLI commands or prose fallbacks.
Credentials in config flags
Inline JSON passed via --settings or --mcp-config is redacted from the claude-swarm:///config resource, while file paths remain visible. Prefer file paths (e.g. --mcp-config /path/to/mcp.json) over inline tokens or env secrets so credentials are not passed on process command lines or stored in .meta files.
Worktree isolation
Caveats:
- Because worktrees branch from
HEAD(git worktree add -b claude-swarm/<id> ... HEAD), uncommitted and untracked changes in your working tree are not included in the worktree. Commit prerequisite edits first if the task needs them.- Expired worktrees (older than
CLAUDE_SWARM_TASK_MAX_AGE, default 24 hours) are lazily removed on a subsequent task launch viagit worktree remove --forceandgit branch -D. Merge or cherry-pick before expiry.
Server flags
| Flag | Description |
|---|---|
--version |
Show version and exit |
--model MODEL |
Default model alias or full name (e.g. opus, sonnet, haiku, fable) |
--fallback-model MODEL |
Default fallback model(s), comma-separated |
--effort LEVEL |
Default reasoning effort (low, medium, high, xhigh, max) |
--permission-mode MODE |
Default permission mode (acceptEdits, auto, bypassPermissions, manual, dontAsk, plan) |
--dangerously-skip-permissions |
Bypass all permission checks by default |
--tools TOOLS |
Built-in tools to expose ("" for none, "default", or comma-separated names) |
--allowed-tools TOOL |
Tool rule to allow by default (repeatable) |
--disallowed-tools TOOL |
Tool rule to deny by default (repeatable) |
--add-dir DIR |
Additional directory Claude can access by default (repeatable) |
--agent NAME |
Default agent name |
--agents JSON_OR_PATH |
Default custom agents JSON object or file path |
--system-prompt TEXT |
Default system prompt override |
--append-system-prompt TEXT |
Default text appended to the system prompt |
--settings JSON_OR_PATH |
Default extra settings JSON object or file path |
--setting-sources SOURCES |
Comma-separated setting sources (user,project,local) |
--mcp-config JSON_OR_PATH |
Default MCP config file or JSON string (repeatable) |
--strict-mcp-config |
Only use MCP servers from --mcp-config by default |
--max-turns N |
Default maximum agentic turns per invocation |
--max-budget-usd AMOUNT |
Default maximum API budget in USD per invocation |
--disable-slash-commands |
Disable skills and slash commands by default |
--no-session-persistence |
Do not persist sessions to disk by default |
--bare |
Minimal headless mode (skip hooks, plugins, CLAUDE.md discovery, OAuth/keychain; API-key / provider auth only) |
Boolean server flags can be explicitly overridden to false on any individual tool call.
MCP Resources
| URI | Description |
|---|---|
claude-swarm:///server-info |
Version, capabilities, directories, CLI protocol contract |
claude-swarm:///config |
Current server-level CLI defaults |
claude-swarm:///models |
Available Claude Code model aliases, resolved IDs, and supported effort levels |
claude-swarm:///tasks |
All known tasks and their state, usage, tool errors, permission denials, and failure details |
Environment variables
| Variable | Default | Description |
|---|---|---|
CLAUDE_SWARM_LOG |
<user-runtime>/claude-swarm/claude_mcp_swarm.log |
Log file path |
CLAUDE_SWARM_LOG_LEVEL |
WARNING |
Log level (DEBUG, INFO, WARNING, ERROR) |
CLAUDE_SWARM_TASK_DIR |
<user-runtime>/claude-swarm/tasks |
Task output storage directory (owner-only 0700 when using default) |
CLAUDE_SWARM_WORKTREE_DIR |
<user-cache>/claude-swarm/worktrees |
Worktree storage directory (owner-only 0700 when using default) |
CLAUDE_SWARM_TASK_MAX_AGE |
86400 (24h) |
Seconds after completion / last reply activity before task artifacts and worktrees are cleaned up |
CLAUDE_SWARM_MIN_WAIT |
150 |
Floor in seconds for claude_wait |
CLAUDE_SWARM_BIN |
(auto) | Explicit path or command name for claude (auto-searches PATH and ~/.local/bin/claude) |
Requirements
- Python 3.8+
- Claude Code CLI (
claude) installed and authenticated - Only depends on stdlib-only
mcp-swarm-core(no third-party packages)
License
MIT
Metadata
Release files for claude-mcp-swarm 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| claude_mcp_swarm-0.1.0.tar.gz | 30.3 kB | Without provenance | Details for claude_mcp_swarm-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| claude_mcp_swarm-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for claude_mcp_swarm-0.1.0-py3-none-any.whl |
Total release size: 61.2 kB
Release files / claude_mcp_swarm-0.1.0.tar.gz
| Download URL | claude_mcp_swarm-0.1.0.tar.gz |
|---|---|
| Size | 30.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ca282352c599c9f8839c5ee0bd3971be12c9a6e937ec732b5fd0c94d6332b94
|
|
BLAKE2b-256 checksum How to use checksums |
649c16646f14985ed778bfb609a25e06f385c86270cf1bf5fb0072052338fefe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / claude_mcp_swarm-0.1.0-py3-none-any.whl
| Download URL | claude_mcp_swarm-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db1494fd38908e66205e68fcaf49ac1451ec5dd054aa7109667d853883c523ea
|
|
BLAKE2b-256 checksum How to use checksums |
b81316664e4c8edceb0437924b98058c6dbe9c108695db82246971adc9eef173
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for claude-mcp-swarm 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.