Hosted OAuth MCP

Let Claude Code, Cursor, and Codex test real firmware on virtual hardware.

Coding agents write C and Rust fast, then stall because they have no dev board plugged in. Connect your agent to https://app.circuittwin.ai/mcp so it can flash ELFs, read UART output, catch register bugs, and prove every fix.

Connect in one command (zero downloads)

CircuitTwin hosts an OAuth-authenticated Streamable HTTP MCP server at https://app.circuittwin.ai/mcp. Pick your client, run the command, and sign in once in your browser.

Claude Code
claude mcp add --transport http circuittwin https://app.circuittwin.ai/mcp
ChatGPT / Codex CLI
codex mcp add circuittwin --url https://app.circuittwin.ai/mcp
Gemini CLI
gemini mcp add --transport http circuittwin https://app.circuittwin.ai/mcp
Cursor / Web MCP connectors
https://app.circuittwin.ai/mcp

What your agent can do in a tight loop

  1. Search the twin catalog: Look up existing STM32, ESP32, RP2040, nRF52, and sensor twins before writing register code.
  2. Upload and execute ELFs: Flash the exact compiled binary onto a board twin and inspect UART stdout, GPIO pins, bus frames, and hardfault traces.
  3. Check explicit verdicts: Read deterministic passed, failed, or inconclusive verdicts instead of guessing from compiler warnings.
  4. Generate missing parts: Feed a vendor datasheet PDF to create a new sensor or MCU twin when a part is missing from the catalog.

Compact agent primer (under 400 tokens)

Drop https://circuittwin.ai/agent-skill.md into your AGENTS.md or CLAUDE.md. It teaches your coding agent the MCP URL, ct run --json flags, exit codes (0 pass, 1 fail, 4 inconclusive), and capability labels in under 400 tokens.

Proven on 43 real STM32F407 binaries

On our public agent benchmark, CircuitTwin caught 24 of 26 seeded STM32F407 firmware bugs and passed all 17 of 17 working builds. Renode passed 15 of 17 working builds (catching 12/26 bugs), and QEMU passed 10 of 17 working builds (catching 19/26 raw, 8 distinct).

What the agent sees in each kind of loop

LoopFeedback the agent getsBugs it can find
Code generation onlyCompiler errors onlyMisses clock setup, DMA, pinouts, and bus bugs
Agent + host mocksUnit test assertions on x86Tests mocks instead of target registers and ISRs
Agent + CircuitTwin MCPThe real ELF runs: UART, CAN, SPI and I2C logs, register tracesClock gating, baud, DMA, HardFault and bus failures the firmware can observe

Connecting coding agents to embedded twins via MCP

Let coding agents compile firmware, run the ELF on a deterministic board twin, read structured JSON diagnostics and fix bugs without guessing.

A coding agent writing C or Rust firmware without execution feedback compiles code and hopes the registers are right. Wiring CircuitTwin into the agent via the hosted OAuth MCP server (https://app.circuittwin.ai/mcp) or ct run --json gives it deterministic verdicts on every edit.

Every ct command returns one JSON document and a stable exit code: 0 pass, 1 fail, 2 invalid input, 3 platform error, 4 inconclusive (unmodelled register named by peripheral, offset and PC). Never treat exit code 4 as a pass. A compact primer for agents is published at /agent-skill.md.

Stable ct CLI exit codes for agent loops

Exit codeMeaningAgent action
0Pass: all assertions met, zero unmodelled accessesAccept edit or proceed to next fault case
1Fail: assertion failed, timeout or HardFaultRead JSON trace/registers, patch firmware, re-run
2Invalid input: bad CLI flag or suite schemaFix command/YAML syntax before retrying
3Platform or network errorRetry or report environment issue
4Inconclusive: firmware touched unmodelled registerReport peripheral + PC explicitly; do not claim pass
Shell — agent-friendly JSON execution
# Compact primer for coding-agent system prompts:
curl -fsSL https://circuittwin.ai/agent-skill.md

# Single-document JSON verdict for automated loops:
ct run --json --board nucleo-f767zi build/app.elf
MCP client configuration (OAuth HTTPS)
{
  "mcpServers": {
    "circuittwin": {
      "url": "https://app.circuittwin.ai/mcp"
    }
  }
}

Troubleshooting

SymptomFix
Agent claims test passed on exit code 4Enforce strict exit-code == 0 checking in your agent prompt (documented in /agent-skill.md).
Agent loops on compilation errors before simulationRun make/cmake first and only invoke ct run after an updated ELF exists.
Need reproducible bug benchmark numbersReview published seeded-bug comparison records at /docs/agent-benchmark.
Headless CI needs non-interactive authUse CT_TOKEN=ctk_... with ct cloud commands rather than browser OAuth.

Automated firmware fix loops via MCP (Claude, ChatGPT, Gemini, Cursor)

Give your coding assistant real hardware feedback: build, run on a board twin, read the exact HardFault or bus trace, and verify the fix.

Without a simulator, coding assistants guess at peripheral register bits and declare victory once gcc returns zero. Bugs in RCC clocks, I2C NACK handlers and DMA alignments survive untouched.

Wiring Claude, ChatGPT, Gemini or Cursor to the CircuitTwin MCP bundle lets the agent execute your real compiled ELF on a twin, inspect structured JSON diagnostics and iterate until every fault test passes.

MCP tool loop steps

StepMCP tool callStructured output returned
1. CompileRun cmake / cargo / west buildTarget .elf binary
2. Simulatect_run / ct_test_run on board twinExit code, UART console, fault registers, unmodelled regs
3. DiagnoseInspect CFSR/BFAR or bus traceExact failing PC, register address and bus frame
4. VerifyRe-run suite with --recheckZero regressions and green JUnit summary
Shell - launch local CircuitTwin MCP server
# Verify local ct MCP server responds over stdio
ct mcp serve --catalog "$CT_CATALOG_DIR"
mcp.json (Claude / Cursor / Gemini / ChatGPT client)
{
  "mcpServers": {
    "circuittwin": {
      "command": "ct",
      "args": ["mcp", "serve"]
    }
  }
}

Troubleshooting

SymptomFix
Agent tries to silence exit code 4 by mocking the peripheralKeep strict suite.yaml checks in CI so PRs must pass on the real board twin with zero unmodelled-register workarounds.
Agent loops on the same HardFault addressInclude -g3 symbols in the debug ELF so the agent can resolve the exact C line from the fault PC.

Which clients work with the CircuitTwin MCP server?

Any standard MCP stdio client including Claude Code, Claude Desktop, ChatGPT, Gemini CLI and Cursor.

Frequently asked questions

Do I need to install a local binary to use CircuitTwin MCP?

No. Point Claude Code, Cursor, ChatGPT/Codex, or Gemini CLI at https://app.circuittwin.ai/mcp over Streamable HTTP and complete the OAuth browser login. Local ct mcp serve is also available if you run offline.

What permissions does an AI agent get through OAuth?

You pick one workspace and choose either Read only or Read, run firmware, and generate twins. MCP tools cannot delete projects, revoke tokens, or overwrite workspace data.

Do firmware runs from Claude or Cursor burn credits?

No. Running firmware, reading UART consoles, inspecting faults, and running test suites cost zero credits on every plan including Free. Credits only apply when generating brand-new part twins from datasheets.

How does the agent know when a hardware register is missing?

CircuitTwin returns structured JSON with explicit verdicts: passed, failed, inconclusive, or error. If firmware touches an unmodelled register, the verdict is inconclusive (exit code 4) with the exact address.