Model Context Protocol overview
The Model Context Protocol (MCP) is an open protocol for connecting AI assistants to external tools and data sources. It provides:- Standardized tool interface — Uniform tool registration and invocation
- Transport-agnostic — Works over stdio, HTTP, WebSocket
- Security model — Sandboxed execution, permission controls
- Type safety — JSON Schema validation for parameters
orchestrate.sh, preserving exact behavioral parity with the Claude Code plugin.
Server architecture
Component diagram
Startup sequence
- Claude Code reads
.mcp.jsonon plugin load - Spawns MCP server:
node mcp-server/dist/index.js - Server initializes stdio transport
- Registers 11 tools with MCP SDK
- Loads skill metadata from
.claude/skills/*.md - Sends
server/initializedmessage to client - Client can now invoke tools
Configuration via .mcp.json
The.mcp.json file tells Claude Code how to launch the server:
- Server name:
octo-claw(arbitrary identifier) - Command:
nodewith path to compiled TypeScript - Environment:
CLAUDE_OCTOPUS_MCP_MODE=truesignals MCP execution context - Transport: stdio (stdin/stdout) — no network ports required
11 exposed tools
The MCP server registers these tools (see full API in OpenClaw integration):Workflow tools (8)
| Tool | Phase | Parameters |
|---|---|---|
octopus_discover | Probe | prompt |
octopus_define | Grasp | prompt |
octopus_develop | Tangle | prompt, quality_threshold? |
octopus_deliver | Ink | prompt |
octopus_embrace | All 4 phases | prompt, autonomy? |
octopus_debate | Debate | question, rounds?, style?, mode? |
octopus_review | Review | target |
octopus_security | Security | target |
Introspection tools (2)
| Tool | Purpose |
|---|---|
octopus_list_skills | List all 44 available skills |
octopus_status | Check provider availability |
IDE integration tool (1)
| Tool | Purpose |
|---|---|
octopus_set_editor_context | Inject editor state (file, selection, cursor) |
Connecting MCP clients
Claude Desktop
Add to~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or equivalent:
OpenClaw
Install the OpenClaw extension (see OpenClaw integration):Cursor
Cursor supports MCP via its settings:Custom MCP client
Use the MCP SDK:Tool execution flow
Example: octopus_develop
-
Client invokes tool:
-
Server validates parameters (Zod schema):
-
Server builds environment:
-
Server executes orchestrate.sh:
-
orchestrate.sh runs workflow:
- Detects available providers (Codex, Gemini, Claude)
- Routes to appropriate agents
- Runs quality gates
- Returns synthesis file
-
Server returns result:
Security model
Environment variable isolation
Only allowed environment variables are forwarded toorchestrate.sh:
API key sanitization
Error messages sanitize leaked API keys:Path validation
IDE context paths reject traversal attempts:Selection size limit
Editor selections are truncated to 50KB:Transport security
stdio transport (default) is scoped to the spawning process — no network exposure.Skill metadata
The server loads skill metadata from frontmatter:Debugging the MCP server
Enable debug logs
Test with MCP Inspector
Use the MCP Inspector to test the server:Check server logs
Server logs are written to:- Claude Code:
~/.claude/logs/mcp-server.log - OpenClaw:
~/.openclaw/logs/mcp-server.log
Common issues
Server fails to start
Server fails to start
Symptoms: Client reports “MCP server not available”Causes:
- Missing dependencies: Run
npm installinmcp-server/ - TypeScript not compiled: Run
npm run buildinmcp-server/ - Wrong Node.js version: Requires Node.js ≥18
Tool invocation times out
Tool invocation times out
Symptoms: Client times out waiting for responseCauses:
- orchestrate.sh hung on provider call
- Quality gate blocked execution
- Large synthesis file being generated
- Check
~/.claude-octopus/logs/orchestrate.log - Increase timeout in client config
- Enable debug mode:
OCTOPUS_DEBUG=true
Environment variables not passing through
Environment variables not passing through
Symptoms: orchestrate.sh can’t find API keysCauses:
- Env vars not set in MCP server environment
- Blocked by security filter
- Set env vars in
.mcp.json: - Check blocked vars list in
mcp-server/src/index.ts:53
Source code reference
- MCP server:
mcp-server/src/index.tsin source code:~/workspace/source/mcp-server/src/index.ts - MCP config:
.mcp.jsonin source code:~/workspace/source/.mcp.json - Skill schema:
mcp-server/src/schema/skill-schema.json - Package config:
mcp-server/package.json
Related documentation
- OpenClaw integration — Installing and configuring OpenClaw extension
- Workflows — Understanding workflow phases
- Security — Security model and threat mitigation
- Debugging guide — Troubleshooting workflows
