The Model Context Protocol (MCP) has changed how we build AI-assisted development tools. It allows local coding agents (like Codex, Claude Code, or Cursor) to seamlessly query knowledge bases, execute code, and retrieve persistent memory.
However, setting them up can be a friction-filled developer experience:
~/.codex/config.toml
or running CLI command configurations) manually is tedious and error-prone.To address this, I've added a local setup harness to my flagship project, ** A-Modular-Kingdom (AMK)**. This harness acts as a bridge that automatically configures local agents to talk to the AMK server, with thermal monitoring built-in.
Rather than requiring developers to copy-paste config blocks, the repo now includes a single bootstrap script:
./scripts/setup_mcp.sh
This script automates two integrations under the hood:
It runs a Python registration script (scripts/register_mcp.py
) that checks for the presence of Codex configuration at ~/.codex/config.toml
. It automatically registers and configures modular_kingdom_host
with paths mapped dynamically to your local clone, adding the following setup:
[mcp_servers.modular_kingdom_host]
command = "/path/to/A-Modular-Kingdom/scripts/thermal_runner.py"
args = ["--threshold", "85", "--", "/path/to/A-Modular-Kingdom/.venv/bin/python", "-u", "/path/to/A-Modular-Kingdom/src/agent/host.py"]
startup_timeout_sec = 60
tool_timeout_sec = 30
env = { "PYTHONUNBUFFERED" = "1", "MCP_LOG_FILE" = "/tmp/modular_kingdom_mcp.log" }
It auto-detects if the claude
CLI tool is installed and registers the server using Claude Code's native command:
claude mcp add a-modular-kingdom \
/path/to/python \
/path/to/thermal_runner.py --threshold 85 -- \
/path/to/python -u /path/to/host.py
A key part of the new bridge is the thermal_runner.py
wrapper.
Local agents running large code bases or dense RAG models can cause significant CPU spikes. If your laptop thermal limits kick in, your whole development workspace lags.
The thermal runner sits between the agent and the MCP server. It continuously monitors the CPU core temperatures. If the system temperature exceeds a safe threshold (e.g., 85°C), it gently s the MCP server execution, resuming it only once the cores cool down. This ensures your local development flow remains smooth and your machine doesn't overheat.
With the bridge in place, your local agent gets immediate, friction-free access to:
No more manual configurations. Clone, run the setup script, and let your local agent benefit from a standardized memory and knowledge baseline.
Check out the repository and set it up today:
👉 MasihMoafi/A-Modular-Kingdom
For more of my work, visit my website: