MCP Hub
Back to servers

claude-octopus

Requires Setup

Spawn multiple specialized Claude Code agents as MCP servers, each independently configured.

Registry
Stars
6
Forks
1
Updated
Apr 2, 2026
Validated
Apr 4, 2026

Quick Install

npx -y claude-octopus

Claude Octopus

Claude Octopus

One brain, many arms.

An MCP server that wraps the Claude Agent SDK, letting you run multiple specialized Claude Code agents — each with its own model, tools, system prompt, and personality — from any MCP client.

Why

Claude Code is powerful. But one instance does everything the same way. Sometimes you want a strict code reviewer that only reads files. A test writer that defaults to TDD. A cheap quick helper on Haiku. A deep thinker on Opus.

Claude Octopus lets you spin up as many of these as you need. Same binary, different configurations. Each one shows up as a separate tool in your MCP client.

Prerequisites

  • Node.js >= 18
  • Claude Code — the Claude Agent SDK is bundled as a dependency, but it spawns Claude Code under the hood, so you need a working claude CLI installation
  • Anthropic API key (ANTHROPIC_API_KEY env var) or an active Claude Code OAuth session

Install

npm install claude-octopus

Or skip the install entirely — use npx directly in your .mcp.json (see Quick Start below).

Quick Start

Add to your .mcp.json:

{
  "mcpServers": {
    "claude": {
      "command": "npx",
      "args": ["claude-octopus@latest"],
      "env": {
        "CLAUDE_PERMISSION_MODE": "bypassPermissions"
      }
    }
  }
}

This gives you two tools: claude_code and claude_code_reply. That's it — you have Claude Code as a tool.

Multiple Agents

The real power is running several instances with different configurations:

{
  "mcpServers": {
    "code-reviewer": {
      "command": "npx",
      "args": ["claude-octopus@latest"],
      "env": {
        "CLAUDE_TOOL_NAME": "code_reviewer",
        "CLAUDE_SERVER_NAME": "code-reviewer",
        "CLAUDE_DESCRIPTION": "Strict code reviewer. Finds bugs and security issues. Read-only.",
        "CLAUDE_MODEL": "opus",
        "CLAUDE_ALLOWED_TOOLS": "Read,Grep,Glob",
        "CLAUDE_APPEND_PROMPT": "You are a strict code reviewer. Report real bugs, not style preferences.",
        "CLAUDE_EFFORT": "high"
      }
    },
    "test-writer": {
      "command": "npx",
      "args": ["claude-octopus@latest"],
      "env": {
        "CLAUDE_TOOL_NAME": "test_writer",
        "CLAUDE_SERVER_NAME": "test-writer",
        "CLAUDE_DESCRIPTION": "Writes thorough tests with edge case coverage.",
        "CLAUDE_MODEL": "sonnet",
        "CLAUDE_APPEND_PROMPT": "Write tests first. Cover edge cases. TDD."
      }
    },
    "quick-qa": {
      "command": "npx",
      "args": ["claude-octopus@latest"],
      "env": {
        "CLAUDE_TOOL_NAME": "quick_qa",
        "CLAUDE_SERVER_NAME": "quick-qa",
        "CLAUDE_DESCRIPTION": "Fast answers to quick coding questions.",
        "CLAUDE_MODEL": "haiku",
        "CLAUDE_MAX_BUDGET_USD": "0.02",
        "CLAUDE_EFFORT": "low"
      }
    }
  }
}

Your MCP client now sees three distinct tools — code_reviewer, test_writer, quick_qa — each purpose-built.

Agent Factory

Don't want to write configs by hand? Add a factory instance:

{
  "mcpServers": {
    "agent-factory": {
      "command": "npx",
      "args": ["claude-octopus@latest"],
      "env": {
        "CLAUDE_FACTORY_ONLY": "true",
        "CLAUDE_SERVER_NAME": "agent-factory"
      }
    }
  }
}

This exposes a single create_claude_code_mcp tool — an interactive wizard. Tell it what you want ("a strict code reviewer that only reads files") and it generates the .mcp.json entry for you, listing all available options you can customize.

In factory-only mode, no query tools are registered — just the wizard. This keeps routing clean: the factory creates agents, the agents do work.

Tools

Each non-factory instance exposes:

ToolPurpose
<name>Send a task to the agent, get a response + session_id
<name>_replyContinue a previous conversation by session_id

Per-invocation parameters (override server defaults):

ParameterDescription
promptThe task or question (required)
cwdWorking directory override
modelModel override
toolsRestrict available tools (intersects with server restriction)
disallowedToolsBlock additional tools (unions with server blacklist)
additionalDirsExtra directories the agent can access
pluginsAdditional plugin paths to load
effortThinking effort (low, medium, high, max)
permissionModePermission mode (can only tighten, never loosen)
maxTurnsMax conversation turns
maxBudgetUsdMax spend in USD
systemPromptAdditional prompt (appended to server default)

Configuration

All configuration is via environment variables in .mcp.json. Every env var is optional.

Identity

Env VarDescriptionDefault
CLAUDE_TOOL_NAMETool name prefix (<name> and <name>_reply)claude_code
CLAUDE_DESCRIPTIONTool description shown to the host AIgeneric
CLAUDE_SERVER_NAMEMCP server name in protocol handshakeclaude-octopus
CLAUDE_FACTORY_ONLYOnly expose the factory wizard toolfalse

Agent

Env VarDescriptionDefault
CLAUDE_MODELModel (sonnet, opus, haiku, or full ID)SDK default
CLAUDE_CWDWorking directoryprocess.cwd()
CLAUDE_PERMISSION_MODEdefault, acceptEdits, bypassPermissions, plandefault
CLAUDE_ALLOWED_TOOLSComma-separated tool restriction (available tools)all
CLAUDE_DISALLOWED_TOOLSComma-separated tool blacklistnone
CLAUDE_MAX_TURNSMax conversation turnsunlimited
CLAUDE_MAX_BUDGET_USDMax spend per invocationunlimited
CLAUDE_EFFORTlow, medium, high, maxSDK default

Prompts

Env VarDescription
CLAUDE_SYSTEM_PROMPTReplaces the default Claude Code system prompt
CLAUDE_APPEND_PROMPTAppended to the default prompt (usually what you want)

Advanced

Env VarDescription
CLAUDE_ADDITIONAL_DIRSExtra directories to grant access (comma-separated)
CLAUDE_PLUGINSLocal plugin paths (comma-separated)
CLAUDE_MCP_SERVERSMCP servers for the inner agent (JSON)
CLAUDE_PERSIST_SESSIONtrue/false — enable session resume (default: true)
CLAUDE_SETTING_SOURCESSettings to load: user, project, local
CLAUDE_SETTINGSPath to settings JSON or inline JSON
CLAUDE_BETASBeta features (comma-separated)

Authentication

Env VarDescriptionDefault
ANTHROPIC_API_KEYAnthropic API key for this agentinherited from parent
CLAUDE_CODE_OAUTH_TOKENClaude Code OAuth token for this agentinherited from parent

Leave both unset to inherit auth from the parent process. Set one per agent to use a different account or billing source.

Lists accept JSON arrays when values contain commas: ["path,with,comma", "/normal"]

Security

  • **Permission mode defaults to **default — tool executions prompt for approval unless you explicitly set bypassPermissions.
  • cwd overrides preserve agent knowledge — when the host overrides cwd, the agent's configured base directory is automatically added to additionalDirectories so it retains access to its own context.
  • Tool restrictions narrow, never widen — per-invocation tools intersects with the server restriction (can only remove tools, not add). disallowedTools unions (can only block more).
  • _reply** tool respects persistence** — not registered when CLAUDE_PERSIST_SESSION=false.

Architecture

┌─────────────────────────────────┐
│  MCP Client                     │
│  (Claude Desktop, Cursor, etc.) │
│                                 │
│  Sees: code_reviewer,           │
│        test_writer, quick_qa    │
└──────────┬──────────────────────┘
           │ JSON-RPC / stdio
┌──────────▼──────────────────────┐
│  Claude Octopus (per instance)  │
│                                 │
│  Env: CLAUDE_MODEL=opus         │
│       CLAUDE_ALLOWED_TOOLS=...  │
│       CLAUDE_APPEND_PROMPT=...  │
│                                 │
│  Calls: Agent SDK query()       │
└──────────┬──────────────────────┘
           │ in-process
┌──────────▼──────────────────────┐
│  Claude Agent SDK               │
│  Runs autonomously: reads files,│
│  writes code, runs commands     │
│  Returns result + session_id    │
└─────────────────────────────────┘

How It Compares

Feature``claude-code-mcpClaude Octopus
ApproachBuilt-inCLI wrappingAgent SDK
Exposes16 raw tools1 prompt tool1 prompt + reply
Multi-instanceNoNoYes
Per-instance configNoNoYes (18 env vars)
Factory wizardNoNoYes
Session continuityNoNoYes

Development

pnpm install
pnpm build       # compile TypeScript
pnpm test        # run tests (vitest)
pnpm test:coverage  # coverage report

License

ISC - Xiaolai Li

Reviews

No reviews yet

Sign in to write a review