- The problem
The library kept lying to me
mckicad is an MCP server that lets a language model design KiCad schematics on its own. For a long time it stood on
kicad-sch-api— and that library kept returning wrong answers.Global labels: dropped silently. Custom library pins: empty lists. When the layer you build on returns confident nonsense, nothing downstream can be trusted. So I did the reckless thing and ripped it out.
- The engine
A parser that round-trips clean
The heart is
sexp_tree— a full S-expression parser and serializer for KiCad's native format. Parse it, mutate it, write it back, byte-for-byte identical.On top sits
SchDocument: load a schematic and ask it real questions. Where is every pin. What net is this wire on. Which labels actually connect. Answers from the file itself, not a guess. - Autowire
It routes around itself
Place the components; autowire pulls the nets for you — with real collision detection, so wires route around each other instead of bridging into shorts.
It clamps stub lengths when they would overlap, offsets labels so they don't collide, and tracks power-wire stubs as obstacles. The messy part of drawing a schematic, done carefully.
- It checks its own work
One call, zero ambiguity
run_schematic_ercruns the full electrical rules check and reports back: zero errors — or exactly what's wrong, and where.The engine grades its own homework, so the model gets a hard signal instead of a hopeful vibe.
- The proof
It drew Timbre
It generated the phase-1 bench schematic for Timbre, a Cypress PSoC-based synthesizer. Zero ERC errors.
A language model, placing parts and pulling nets, for real hardware headed to a bench. That's the whole point.