Skip to content

Lavender3533/cccp

Repository files navigation

CCCP - Claude Code Concurrent Processor

npm version License: MIT

🐝 MCP server that enables AI agents to work in parallel

CCCP is a MCP (Model Context Protocol) server that allows Claude Code to dispatch multiple sub-agents to execute tasks in parallel, significantly improving efficiency (2-5x speedup).

Table of Contents

Features

  • Parallel Execution - Run multiple tasks concurrently, 2-5x speedup
  • API Mode - Direct Anthropic API calls for fast response
  • CLI Mode - Use Claude/Codex CLI with full tool support
  • 7 Built-in Tools - read_file, write_file, edit_file, list_directory, run_command, search_files, glob_files
  • Dependency Graph - Support task dependencies with topological sorting
  • Auto-Repair - Automatic code validation and repair on failure
  • Dual-Pool Concurrency - Separate pools for API and CLI tasks
  • Swarm Mode - Main AI as commander, sub-agents as swarm 🐝

Installation

From npm

npm install -g mcp-cccp-server

From source

git clone https://github.com/anthropics/cccp.git
cd cccp
npm install

Quick Start

1. Add to Claude Code

# Using npx (recommended)
claude mcp add --transport stdio cccp -- npx mcp-cccp-server

# Or using absolute path
claude mcp add --transport stdio cccp -- node /path/to/cccp/src/index.js

2. Configure environment (optional)

Edit ~/.claude/settings.json:

{
  "mcpServers": {
    "cccp": {
      "command": "npx",
      "args": ["mcp-cccp-server"],
      "env": {
        "CCCP_PROVIDER": "api",
        "ANTHROPIC_AUTH_TOKEN": "your-api-key"
      }
    }
  }
}

3. Use in Claude Code

// Parallel execution
mcp__cccp__parallel_code({
  provider: "api",
  tasks: [
    { name: "Analyze Module A", task: "Analyze src/moduleA.js responsibilities" },
    { name: "Analyze Module B", task: "Analyze src/moduleB.js responsibilities" },
    { name: "Analyze Module C", task: "Analyze src/moduleC.js responsibilities" },
  ]
})

Configuration

MCP Configuration

{
  "mcpServers": {
    "cccp": {
      "command": "node",
      "args": ["/path/to/cccp/src/index.js"],
      "env": {
        "CCCP_PROVIDER": "api",
        "ANTHROPIC_AUTH_TOKEN": "your-api-key",
        "ANTHROPIC_BASE_URL": "https://your-proxy.com",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
        "DISABLE_TELEMETRY": "1"
      }
    }
  }
}

Model Requirements

When using provider: 'api', CCCP only supports Claude 4.5 models:

  • claude-sonnet-4-5-20250514 (default)
  • claude-opus-4-5-20251101

API Reference

parallel_code

Execute multiple tasks in parallel.

mcp__cccp__parallel_code({
  provider: "api",           // "api" | "claude" | "codex" (default: "api")
  tasks: [
    {
      name: "Task Name",     // Required: task identifier
      task: "Task description", // Required: detailed task description
      outputPath: "src/file.js", // Optional: output file (new files only)
      use_tools: "auto",     // Optional: "auto" | "true" | "false"
      complexity: "medium",  // Optional: "simple" | "medium" | "complex"
      id: "task-1",          // Optional: unique ID for dependencies
      dependsOn: ["task-0"], // Optional: IDs of tasks this depends on
    }
  ],
  show_windows: false,       // Optional: show terminal windows (Windows only)
})

sequential_code

Execute tasks sequentially with context passing.

mcp__cccp__sequential_code({
  provider: "api",
  tasks: [
    { name: "Step 1", task: "First step" },
    { name: "Step 2", task: "Second step (has context from step 1)" },
  ]
})

ping

Health check for the MCP server.

mcp__cccp__ping()
// Returns: { status: "ok", timestamp: "..." }

Task Fields

Field Type Required Description
name string Task identifier
task string Detailed task description
outputPath string Output file path (new files only!)
use_tools string Tool usage: "auto" | "true" | "false"
complexity string Task complexity: "simple" | "medium" | "complex"
id string Unique task ID for dependencies
dependsOn string[] IDs of dependent tasks

use_tools Behavior

Value Behavior
"auto" Auto-detect based on task content (keywords + path patterns)
"true" Force enable tools (read/write files, run commands)
"false" Force disable tools (pure text generation)

Environment Variables

Core

Variable Description Default
CCCP_PROVIDER Provider: api | claude | codex claude
CCCP_MODEL Model name Auto-selected
ANTHROPIC_API_KEY API key for API mode -
ANTHROPIC_AUTH_TOKEN Alternative API key -
ANTHROPIC_BASE_URL Custom API endpoint -

Concurrency

Variable Description Default
CCCP_API_CONCURRENCY Max concurrent API tasks 8
CCCP_CLI_CONCURRENCY Max concurrent CLI tasks 2
CCCP_MAX_DEPTH Max nesting depth 3

Auto-Repair

Variable Description Default
CCCP_AUTO_REPAIR Enable auto-repair true
CCCP_REPAIR_MAX_ATTEMPTS Max repair attempts 2
CCCP_REPAIR_MAX_FILE_CHARS Max file chars in repair prompt 12000

Cache

Variable Description Default
CCCP_CACHE_TTL_MS Cache TTL in milliseconds 3600000

Context Prefetch

Variable Description Default
CCCP_PREFETCH_ENABLED Enable context prefetch true
CCCP_PREFETCH_MAX_FILE_CHARS Max chars per file 8000
CCCP_PREFETCH_MAX_TOTAL_CHARS Total budget for all files 20000
CCCP_PREFETCH_MAX_FILES Max files to prefetch 5

Architecture

src/
├── index.js              # MCP server entry point
├── llm-runner.js         # Provider abstraction layer
├── task-runner.js        # Single task execution with retry
├── parallel-runner.js    # Parallel orchestration with dependency graph
├── sequential-runner.js  # Sequential execution
├── auto-writer.js        # Auto-write with validation
├── dual-pool.js          # Dual-pool concurrency control
├── providers/
│   ├── claude-cli.js     # Claude CLI wrapper
│   ├── codex-cli.js      # Codex CLI wrapper
│   ├── anthropic-api.js  # Direct Anthropic API
│   └── api-tools.js      # Tool definitions
├── cache/
│   └── task-cache.js     # File-based caching
└── utils/
    ├── code-extractor.js # Code extraction from LLM output
    └── code-repair.js    # Auto-repair on validation failure

Key Concepts

  • Provider Pattern: Abstracted CLI/API invocation
  • Dependency Graph: Topological sorting (Kahn's algorithm)
  • Dual-Pool: Separate semaphores for API and CLI
  • Local Validation: JS (node --check), JSON (JSON.parse)
  • Auto-Repair: API first, then CLI fallback

Swarm Mode

Activate Swarm Mode in Claude Code with /swarm on:

  • Main AI = Commander (thinking & coordination only)
  • Sub-agents = Swarm (execute tasks)
  • Rule: outputPath only for new files, use tools for existing files

Example

mcp__cccp__parallel_code({
  provider: "api",
  tasks: [
    // New file → use outputPath
    { name: "New Component", task: "Create...", outputPath: "src/new.js" },
    // Modify existing → use tools
    { name: "Update Config", task: "Read config.js, use edit_file to change A to B" },
  ]
})

Examples

Create Multiple Files

mcp__cccp__parallel_code({
  provider: "api",
  tasks: [
    { name: "User API", task: "Create user API module", outputPath: "src/api/user.js" },
    { name: "Product API", task: "Create product API module", outputPath: "src/api/product.js" },
    { name: "Order API", task: "Create order API module", outputPath: "src/api/order.js" },
  ]
})

With Dependencies

mcp__cccp__parallel_code({
  provider: "api",
  tasks: [
    {
      id: "schema",
      name: "Generate Schema",
      task: "Generate User JSON Schema",
      outputPath: "src/schemas/user.json",
    },
    {
      id: "validator",
      name: "Generate Validator",
      task: "Generate validator based on the schema",
      outputPath: "src/validators/user.js",
      dependsOn: ["schema"],  // Wait for schema to complete
    },
  ]
})

Parallel Analysis

mcp__cccp__parallel_code({
  provider: "api",
  tasks: [
    { name: "Architecture", task: "Analyze project architecture (brief, <20 lines)" },
    { name: "Dependencies", task: "Check package.json for outdated packages" },
    { name: "Code Quality", task: "Scan src/ for potential issues" },
  ]
})

Commands

# Install dependencies
npm install

# Start MCP server
npm start

# Run tests
npm test

# Smoke test
node scripts/mcp-smoke.js --call

License

MIT

Contributing

Contributions are welcome! Please read the contributing guidelines before submitting a PR.

Related

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors