claude-octopus

claude-octopus

Wraps the Claude Agent SDK as MCP servers, letting you spawn multiple specialized Claude Code agents — each with its own model, tools, system prompt, and personality — from any MCP client.

Category
访问服务器

README

<p align="center"> <img src="https://raw.githubusercontent.com/xiaolai/claude-octopus/main/assets/claude-octopus-icon.svg" alt="Claude Octopus" width="200" /> </p>

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:

Tool Purpose
<name> Send a task to the agent, get a response + session_id
<name>_reply Continue a previous conversation by session_id

Per-invocation parameters (override server defaults):

Parameter Description
prompt The task or question (required)
cwd Working directory override
model Model override
tools Restrict available tools (intersects with server restriction)
disallowedTools Block additional tools (unions with server blacklist)
additionalDirs Extra directories the agent can access
plugins Additional plugin paths to load
effort Thinking effort (low, medium, high, max)
permissionMode Permission mode (can only tighten, never loosen)
maxTurns Max conversation turns
maxBudgetUsd Max spend in USD
systemPrompt Additional prompt (appended to server default)

Configuration

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

Identity

Env Var Description Default
CLAUDE_TOOL_NAME Tool name prefix (<name> and <name>_reply) claude_code
CLAUDE_DESCRIPTION Tool description shown to the host AI generic
CLAUDE_SERVER_NAME MCP server name in protocol handshake claude-octopus
CLAUDE_FACTORY_ONLY Only expose the factory wizard tool false

Agent

Env Var Description Default
CLAUDE_MODEL Model (sonnet, opus, haiku, or full ID) SDK default
CLAUDE_CWD Working directory process.cwd()
CLAUDE_PERMISSION_MODE default, acceptEdits, bypassPermissions, plan default
CLAUDE_ALLOWED_TOOLS Comma-separated tool restriction (available tools) all
CLAUDE_DISALLOWED_TOOLS Comma-separated tool blacklist none
CLAUDE_MAX_TURNS Max conversation turns unlimited
CLAUDE_MAX_BUDGET_USD Max spend per invocation unlimited
CLAUDE_EFFORT low, medium, high, max SDK default

Prompts

Env Var Description
CLAUDE_SYSTEM_PROMPT Replaces the default Claude Code system prompt
CLAUDE_APPEND_PROMPT Appended to the default prompt (usually what you want)

Advanced

Env Var Description
CLAUDE_ADDITIONAL_DIRS Extra directories to grant access (comma-separated)
CLAUDE_PLUGINS Local plugin paths (comma-separated)
CLAUDE_MCP_SERVERS MCP servers for the inner agent (JSON)
CLAUDE_PERSIST_SESSION true/false — enable session resume (default: true)
CLAUDE_SETTING_SOURCES Settings to load: user, project, local
CLAUDE_SETTINGS Path to settings JSON or inline JSON
CLAUDE_BETAS Beta features (comma-separated)

Authentication

Env Var Description Default
ANTHROPIC_API_KEY Anthropic API key for this agent inherited from parent
CLAUDE_CODE_OAUTH_TOKEN Claude Code OAuth token for this agent inherited 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-mcp Claude Octopus
Approach Built-in CLI wrapping Agent SDK
Exposes 16 raw tools 1 prompt tool 1 prompt + reply
Multi-instance No No Yes
Per-instance config No No Yes (18 env vars)
Factory wizard No No Yes
Session continuity No No Yes

Development

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

License

ISC - Xiaolai Li

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选