claude-code-docker-mcp

SamuraiBuddha/claude-code-docker-mcp

3.2

If you are the rightful owner of claude-code-docker-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Model Context Protocol (MCP) server is designed to facilitate distributed AI agent architectures, enabling significant amplification of AI capabilities through systematic infrastructure.

Claude Code Docker MCP

šŸš€ Distributed AI Agent Architecture for 10000x Amplification

A containerized Claude Code environment with MCP (Model Context Protocol) server integration. This project enables systematic infrastructure for distributed AI agents working in parallel coordination.

šŸŽÆ Philosophy

"Careful architecture beats rushed implementation" - Jordan Ehrig

This project embodies systematic infrastructure development, preventing technical debt while enabling genuine productivity amplification through specialized AI coordination.

šŸ—ļø Architecture Overview

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                     CLAUDE (MELCHIOR)                  │
│                  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”                   │
│                  │  MCP Tools      │                   │
│                  │  Ecosystem      │                   │
│                  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜                   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
                    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”“ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
                    │   Claude Code MCP   │
                    │   (This Project)    │
                    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                              │
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│             DOCKER CONTAINER                           │
│  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¼ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”  │
│  │        MCP SERVER        │                         │  │
│  │                          ā–¼                         │  │
│  │  ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”   │  │
│  │  │           CLAUDE CODE ENGINE                │   │  │
│  │  │                                             │   │  │
│  │  │  • Project Analysis                         │   │  │
│  │  │  • Multi-file Implementation               │   │  │
│  │  │  • Recursive Debugging                     │   │  │
│  │  │  • Comprehensive Refactoring               │   │  │
│  │  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜   │  │
│  ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜  │
│                                                           │
│  Mounted Volumes: /workspace -> Host Project Directories  │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

⚔ Amplification Architecture

Current Workflow Evolution

L1 (10x):   Memory → Sequential → Store
L2 (100x):  Memory → Sequential → Sandbox → Store  
L3 (1000x): Memory → Sequential → (Parallel: Sandbox + LocalLLM) → Store
L4 (10000x): Memory → Sequential → (Parallel: Sandbox + LocalLLM + ClaudeCode) → Store

Agent Specialization

  • MELCHIOR (Claude): Conductor & Architect - Planning, coordination, high-level decisions
  • CLAUDE CODE: Coding Specialist - Project-wide context, recursive resolution, comprehensive implementation
  • LOCAL LLM: Research Sidekick - Domain knowledge, parallel analysis, validation
  • SANDBOXES: Computation Engine - Heavy processing, testing, data analysis

šŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Anthropic API key
  • Windows with Docker Desktop (Claude Code requires Linux container)

Installation

  1. Clone the repository

    git clone https://github.com/SamuraiBuddha/claude-code-docker-mcp.git
    cd claude-code-docker-mcp
    
  2. Configure environment

    cp .env.template .env
    # Edit .env and add your ANTHROPIC_API_KEY
    
  3. Create project directories

    mkdir -p projects logs
    
  4. Build and start

    docker-compose build
    docker-compose up -d
    
  5. Verify installation

    curl http://localhost:3001/health
    

šŸ“š API Endpoints

Health Check

GET /health
# Returns: server status, uptime, active tasks

Project Analysis

POST /claude-code/analyze
{
  "project_path": "my-project",
  "analysis_type": "structure|health|dependencies|issues"
}

Task Execution

POST /claude-code/execute
{
  "task_description": "Add error handling to main file",
  "project_path": "my-project",
  "context": "Express.js application with TypeScript",
  "priority": "medium"
}

Status Check

GET /claude-code/status
# Returns: Claude Code version, task summary, system health

Task Monitoring

GET /claude-code/task/:taskId
# Returns: detailed task status and results

šŸ›”ļø Security Features

  • Container Security: Non-root user, limited capabilities, resource limits
  • API Security: Rate limiting, input validation, CORS policies, security headers
  • Secret Management: Environment-based configuration, no secrets in images
  • Network Security: Localhost binding, isolated container networking

šŸ“ Project Structure

claude-code-docker-mcp/
ā”œā”€ā”€ .env.template          # Environment configuration template
ā”œā”€ā”€ .gitignore            # Comprehensive exclusions (secrets, logs, etc.)
ā”œā”€ā”€ secrets.md            # Secret management protocols
ā”œā”€ā”€ SECURITY.md           # Security policy and incident response
ā”œā”€ā”€ Dockerfile            # Multi-stage container build
ā”œā”€ā”€ docker-compose.yml    # Service orchestration with security
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ mcp-server.js     # Main MCP server implementation
│   ā”œā”€ā”€ health-check.js   # Container health monitoring
│   └── package.json      # Node.js dependencies
ā”œā”€ā”€ projects/             # Mount point for project access
ā”œā”€ā”€ logs/                 # Container logs
└── README.md            # This file

šŸ”§ Configuration

Environment Variables

VariableDefaultDescription
ANTHROPIC_API_KEYrequiredYour Anthropic API key
MCP_PORT3001MCP server port
MCP_HOST127.0.0.1Bind address (localhost only)
CLAUDE_CODE_LOG_LEVELinfoLogging verbosity
CLAUDE_CODE_TIMEOUT300000Task timeout in milliseconds
CONTAINER_MEMORY_LIMIT2gDocker memory limit
CONTAINER_CPU_LIMIT1.0Docker CPU limit

Volume Mounts

  • ./projects:/workspace/projects:rw - Project file access
  • ./logs:/workspace/logs:rw - Container logs

šŸš€ Usage Examples

Analyze Project Structure

curl -X POST http://localhost:3001/claude-code/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "project_path": "my-webapp",
    "analysis_type": "structure"
  }'

Implement Feature

curl -X POST http://localhost:3001/claude-code/execute \
  -H "Content-Type: application/json" \
  -d '{
    "task_description": "Add user authentication with JWT tokens",
    "project_path": "my-webapp",
    "context": "Express.js REST API with MongoDB",
    "priority": "high"
  }'

Debug Issues

curl -X POST http://localhost:3001/claude-code/execute \
  -H "Content-Type: application/json" \
  -d '{
    "task_description": "Fix memory leak in user session management",
    "project_path": "my-webapp",
    "context": "Memory usage increases over time, suspect session storage",
    "priority": "critical"
  }'

šŸ“Š Monitoring

Health Checks

  • Docker health check every 30 seconds
  • HTTP endpoint monitoring
  • Claude Code binary verification
  • Resource usage tracking

Logging

  • Structured JSON logging
  • Request/response tracking
  • Claude Code execution logs
  • Error handling and reporting

šŸ”„ Development Phases

āœ… Phase 1: Proof of Concept

  • Basic Dockerfile with Claude Code installation
  • Container startup and health verification
  • Simple command execution test
  • Volume mounting validation

āœ… Phase 2: Basic MCP Server

  • MCP server framework implementation
  • Health check and status endpoints
  • Basic error handling and logging
  • Container networking configuration

āœ… Phase 3: Core Functionality

  • claude_code_analyze function implementation
  • claude_code_execute function implementation
  • Request validation and sanitization
  • Comprehensive error handling

šŸŽÆ Phase 4: Integration Testing

  • Integration with existing MCP ecosystem
  • Real project testing scenarios
  • Performance benchmarking
  • Tool chain validation

šŸŽÆ Phase 5: Production Hardening

  • Security audit and hardening
  • Resource optimization
  • Monitoring and alerting
  • Documentation and runbooks

šŸ¤ Contributing

Contributions are welcome! Please read our security policy and follow the systematic development approach:

  1. Fork the repository
  2. Create a feature branch
  3. Test thoroughly in isolation
  4. Submit pull request with detailed description

šŸ“„ License

MIT License - see LICENSE file for details.

šŸ†˜ Support

  • Issues: GitHub Issues
  • Security: See SECURITY.md for vulnerability reporting
  • Documentation: Check the /docs directory for detailed guides

šŸ”— Related Projects


šŸŽÆ Ready to unlock 10000x amplification through distributed AI coordination! šŸš€

Built with systematic infrastructure principles by Jordan Ehrig for the MAGI distributed AI architecture.