Claude Code Control MCP Server

$pip3 install -r requirements.txt
README.md

Claude Code automation and control for agentic workflows.

Claude Code Control MCP Server

Claude Code automation and control for agentic workflows.

Part of the Agentic System - a 24/7 autonomous AI framework with persistent memory.

Programmatic task execution using Claude AI for autonomous coding workflows.

Overview

The Claude Code Control MCP enables programmatic code task execution through the Model Context Protocol. It provides a bridge for AI agents and workflows to execute coding tasks using Claude Sonnet 4.5, with comprehensive file tracking, command execution, and status monitoring.

Features

  • Programmatic Task Execution: Execute natural language coding tasks autonomously
  • File Operations: Read, write, edit, and track file changes
  • Code Search: Grep-like search across codebases
  • Command Execution: Run shell commands with output capture
  • Change Tracking: Monitor all file modifications during execution
  • Status Monitoring: Real-time execution status and history

Architecture

┌─────────────────────────────────────────────────────────┐
│                  MCP Client (Claude Code)               │
└────────────────────┬────────────────────────────────────┘
                     │ MCP Protocol
┌────────────────────▼────────────────────────────────────┐
│         Claude Code Control MCP Server                  │
│  ┌──────────────┐  ┌───────────────┐  ┌─────────────┐ │
│  │   Server     │  │   Executor    │  │   Tracker   │ │
│  │   (MCP)      │  │  (Claude AI)  │  │   (Files)   │ │
│  └──────────────┘  └───────────────┘  └─────────────┘ │
└────────────────────┬────────────────────────────────────┘
                     │ Anthropic API
┌────────────────────▼────────────────────────────────────┐
│         Claude Sonnet 4.5 (Anthropic API)              │
└─────────────────────────────────────────────────────────┘

Installation

  1. Install dependencies:
cd ${AGENTIC_SYSTEM_PATH:-/opt/agentic}/mcp-servers/claude-code-control-mcp
pip3 install -r requirements.txt
  1. Set API key:
export ANTHROPIC_API_KEY="sk-ant-..."
  1. Register with Claude Code:

Add to ~/.claude.json:

{
  "mcpServers": {
    "claude-code-control": {
      "command": "python3",
      "args": [
        "${AGENTIC_SYSTEM_PATH:-/opt/agentic}/mcp-servers/claude-code-control-mcp/server.py"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      },
      "disabled": false
    }
  }
}
  1. Restart Claude Code:
# Exit current session and restart

MCP Tools

execute_code_task

Execute a coding task using Claude AI with autonomous tool use.

Input:

{
  "task_description": "Add error handling to the API endpoint in server.py",
  "working_directory": "${AGENTIC_SYSTEM_PATH:-/opt/agentic}/api",
  "context_files": ["server.py", "tests/test_api.py"],
  "max_iterations": 20
}

Output:

{
  "success": true,
  "task_description": "Add error handling...",
  "working_directory": "${AGENTIC_SYSTEM_PATH:-/opt/agentic}/api",
  "iterations": 8,
  "tool_uses": [
    {
      "tool": "read_file",
      "input": {"path": "server.py"},
      "result": "File content..."
    }
  ],
  "file_changes": {
    "total_changes": 2,
    "files_modified": ["server.py"],
    "files_created": [],
    "files_deleted": []
  },
  "duration_seconds": 12.5,
  "final_message": "Successfully added error handling..."
}

read_codebase

Read and analyze multiple files using glob patterns.

Input:

{
  "patterns": ["*.py", "src/**/*.ts"],
  "working_directory": "${AGENTIC_SYSTEM_PATH:-/opt/agentic}",
  "max_files": 50
}

Output:

{
  "files_read": 12,
  "files": [
    {
      "path": "server.py",
      "size": 2048,
      "content": "#!/usr/bin/env python3..."
    }
  ]
}

search_code

Search for code patterns across the codebase.

Input:

{
  "query": "async def.*execute",
  "working_directory": "${AGENTIC_SYSTEM_PATH:-/opt/agentic}",
  "file_pattern": "*.py",
  "case_sensitive": true,
  "max_results": 100
}

Output:

{
  "query": "async def.*execute",
  "total_matches": 5,
  "matches": [
    "executor.py:42:async def execute_task(...)",
    "server.py:156:async def execute_command(...)"
  ]
}

modify_files

Modify multiple files with batch operations.

Input:

{
  "changes": [
    {
      "path": "config.py",
      "action": "write",
      "content": "DEBUG = True\n"
    },
    {
      "path": "server.py",
      "action": "edit",
      "old_content": "po

Tools (4)

execute_code_taskExecute a coding task using Claude AI with autonomous tool use.
read_codebaseRead and analyze multiple files using glob patterns.
search_codeSearch for code patterns across the codebase.
modify_filesModify multiple files with batch operations.

Environment Variables

ANTHROPIC_API_KEYrequiredAPI key for Claude Sonnet 4.5 execution
AGENTIC_SYSTEM_PATHPath to the agentic system installation

Configuration

claude_desktop_config.json
{"mcpServers":{"claude-code-control":{"command":"python3","args":["${AGENTIC_SYSTEM_PATH:-/opt/agentic}/mcp-servers/claude-code-control-mcp/server.py"],"env":{"ANTHROPIC_API_KEY":"sk-ant-..."},"disabled":false}}}

Try it

Add error handling to the API endpoint in server.py using the execute_code_task tool.
Search for all occurrences of 'async def.*execute' in the Python files of my project.
Read all TypeScript files in the src directory using glob patterns to analyze the codebase.
Apply a batch modification to update the DEBUG flag in config.py and edit server.py.

Frequently Asked Questions

What are the key features of Claude Code Control?

Programmatic Task Execution for autonomous coding workflows. Comprehensive File Operations including read, write, and edit. Grep-like Code Search across entire codebases. Command Execution with output capture and status monitoring. Real-time Change Tracking for all file modifications.

What can I use Claude Code Control for?

Autonomous AI agents performing complex refactoring tasks. Automated error handling and bug fixing in existing codebases. Batch processing of file modifications across large projects. Persistent monitoring of file changes during agentic workflows.

How do I install Claude Code Control?

Install Claude Code Control by running: pip3 install -r requirements.txt

What MCP clients work with Claude Code Control?

Claude Code Control works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Use Claude Code Control with Conare

Manage MCP servers visually, upload persistent context, and never start from zero with Claude Code & Codex.

Try Free