Claude Code
Why this agent
Claude Code is Anthropic’s official CLI for Claude. Once espctl is wired up, you can ask Claude Code in plain English to build firmware, watch the build, and read the result — all from your terminal.
Prerequisites
- Claude Code installed and on
$PATH. espctlinstalled somewhere stable on disk (full path needed below).- (Optional, for remote builds) An Aegis build server URL + an
MCP_AUTH_SECRETaccess key.
Install snippet (or alternative)
Add an espctl entry under mcpServers in .claude/settings.json. Use
the per-project file (<project>/.claude/settings.json, kept in your
repo) or the global file (~/.claude/settings.json).
{
"mcpServers": {
"espctl": {
"command": "/path/to/espctl",
"args": ["mcp", "serve"],
"cwd": "/path/to/your/esp-idf/project",
"env": {
"CONTROL_BASE_URL": "https://esphome.cloud",
"MCP_AUTH_SECRET": "your-access-key"
}
}
}
}
Replace:
/path/to/espctl— full path to theespctlprogram on your computer./path/to/your/esp-idf/project— full path to the project Claude should work on.CONTROL_BASE_URL— your build server URL. Leave it (andMCP_AUTH_SECRET) out to run in plan-only mode.MCP_AUTH_SECRET— your access key from the build server. Treat it like a password; don’t put it in a public repo. If you check your.claude/settings.jsoninto version control, remove theMCP_AUTH_SECRETline first or add the file to.gitignore.
Alternative — fetch a pre-filled snippet from any already-wired AI tool:
Read the
install://claude-coderesource and show me the JSON.
First-run verification
Restart Claude Code (/exit, then re-open). Then ask:
What espctl tools do you have?
Expected: a list of ~40 tools (build, doctor, store_versions,
project.init, …).
Troubleshooting
- “no tools” or “espctl failed to start” → run
espctl mcp servein a terminal yourself; the error there points at the cause (missing binary, badcwd, etc.). - Tools listed but every call returns “auth required” → your
MCP_AUTH_SECRETis missing or has been revoked. Get a fresh access key from the control plane and paste it into the config. - Per-project config not picked up → Claude Code reads
<project>/.claude/settings.jsononly when you start it from inside the project directory. Runcd <project> && clauderather than pointing at the project from outside.
For a deeper checklist see Troubleshooting.
Tested as-of 2026-05-19
Per-project vs global config
| Where | When to use |
|---|---|
<project>/.claude/settings.json | Most ESP-IDF projects. The path and chip target are project-specific. Check the file in (without the access key!) so collaborators get the same setup. |
~/.claude/settings.json | When you only have one ESP-IDF project, or you want espctl available everywhere by default. |
A common pattern: keep the espctl path and CONTROL_BASE_URL in the
global file, and just override cwd per project.
What to ask Claude next
- “Run doctor” — quick health check.
- “Initialize an esp32s3 project here” — sets up a new project.
- “Build the project for esp32s3 and tell me if anything breaks” — builds and reports back.
See Typical Workflow for a longer example.