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
- Install dependencies:
cd ${AGENTIC_SYSTEM_PATH:-/opt/agentic}/mcp-servers/claude-code-control-mcp
pip3 install -r requirements.txt
- Set API key:
export ANTHROPIC_API_KEY="sk-ant-..."
- 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
}
}
}
- 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 executionAGENTIC_SYSTEM_PATHPath to the agentic system installationConfiguration
{"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}}}