diff options
Diffstat (limited to 'knowledge/tooling/konnect.md')
| -rw-r--r-- | knowledge/tooling/konnect.md | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/knowledge/tooling/konnect.md b/knowledge/tooling/konnect.md new file mode 100644 index 0000000..e5b78f9 --- /dev/null +++ b/knowledge/tooling/konnect.md @@ -0,0 +1,69 @@ +# Konnect (KiCad MCP) + +[Konnect](https://github.com/mixelpixx/Konnect) is the MCP server that lets an AI agent read and edit KiCad projects through KiCad's IPC API. It is a Rust binary, also packaged as a KiCad plugin. This repo carries it as a git submodule at `tools/konnect`. It is AGPL-3.0, unlike the rest of this repo (MIT); see its own LICENSE. + +## Status of the projects + +- `mixelpixx/Konnect`: the open-source version (AGPL-3.0, Rust, KiCad IPC API). Archived upstream; v0.13.0 is its last release. +- `Orchis-ai-LLC/Konnect-EDA`: the successor, commercial and closed source. +- `mixelpixx/KiCAD-MCP-Server`: the older Python version (MIT), still maintained. It uses KiCad's SWIG Python bindings rather than the IPC API, and has fewer tools. + +The AGPL Konnect is the most complete open option and uses the IPC API, which is replacing SWIG. Since upstream is archived, keep your own fork if you change it. Point the submodule at it with `git config submodule.tools/konnect.url <your fork>`. + +## Build and connect + +You need the Rust toolchain pinned in `rust-toolchain.toml` (rustup installs it automatically) and `protoc` (`brew install protobuf`, or your distribution's `protobuf-compiler`). + +``` sh +git submodule update --init tools/konnect +cd tools/konnect +cargo build --release -p konnect # → target/release/konnect +``` + +Register the binary as an MCP server in your agent, e.g. for Claude Code: + +``` sh +claude mcp add konnect -- "$PWD/target/release/konnect" --config ~/Documents/KiCad/10.0/3rdparty/plugins/com_github_mixelpixx_konnect/settings.json +``` + +For Codex, add the same command and arguments to `~/.codex/config.toml`. The `settings.json` comes with the KiCad plugin install. + +- After rebuilding, reconnect the MCP server (`/mcp` in Claude Code) to load the new binary. `cargo clean` removes the binary and breaks the MCP entry until the next build. +- Per-project config: `<project>/.konnect/project.json` (design rules, overrides). Commit it. Visual baselines go in `<project>/.konnect/baselines/`. +- `tools/konnect/DEV.md` covers tests, the schematic viewer and PCM packaging. + +## Direct file edits + +Konnect's agent skills forbid editing KiCad files directly. In practice, scripted edits through KiCad's own Python (`pcbnew`) are often more reliable. Do them safely: + +1. save the editor state; +2. checkpoint the files; +3. keep a stale open editor from overwriting the change; +4. reload the exact document; +5. verify by reading back, plus ERC/DRC. + +The repo's [AGENTS.md](../../AGENTS.md) gives agents that permission. + +## Quirks seen + +- `add_schematic_text` writes `\n` literally when the text is passed with escaped newlines. Pass real line breaks. +- `update_pcb_from_schematic` needs the PCB editor open with the board. +- A local net label and a hierarchical label with the same name on one sheet do connect. +- Konnect's DSN export refuses Edge.Cuts arcs; KiCad's native export handles them. +- Typed footprint refresh refuses `net_tie_pad_groups`. KiCad's native Update Footprints from Library handles them. + +### Live track edits on an open board + +- `query_traces` (board path + full net name with sheet prefix) lists segments with their UUIDs. +- `delete_trace` takes one UUID. +- `route_trace` adds one straight segment; pass `width`, because it defaults to 0.25 mm. +- No tool deletes a via. Plan around existing vias, or edit the file with the board closed. +- `run_drc` with `sync_live_board = true, refill_zones = true` refills over IPC, saves the open board, then runs DRC on the saved file. + +A workflow that works: + +1. try the edit on a file copy with pcbnew and run DRC on it; +2. checkpoint the saved board; +3. check that the live net matches the file; +4. apply the same segments live; +5. sync, run DRC, and read back the saved file. |
