Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

kicad-placement-mcp

Component placement for KiCad boards, as an MCP server for Claude (or any MCP client) and as a command-line tool.

You and the assistant decide the structure of the board: zones, anchors (connectors, ICs, anything you place by hand) and the design intent that the netlist does not show. The tool does the tedious, error-prone part deterministically:

  • measure a placement: overlaps, copper too close to the edge, pads on vias or tracks of other nets, parts in keepout areas, decoupling capacitors whose own pad blocks the route to their pin, IC power pins without a decoupling capacitor, isolation barriers, your constraints, and wire length (HPWL);
  • place the 2-pad passives (R, C, L, D, LED, ferrite beads, fuses) around the anchors, or, in conservative mode, fix only what is wrong in a placement done by hand;
  • orient the passives (90° steps) so that their pads face their nets and do not block the routes;
  • apply the proposal to the board open in KiCad, through the official IPC API, in one undoable commit.

It never edits a .kicad_pcb file: it reads it with its own parser and writes only through KiCad.

Status: alpha (0.1.0a1). It has been used on about ten real boards, two of them public (in tests/data). Expect wrong placements: please report them. Read the limitations before trusting a proposal, and always review the result and run DRC before routing.

Install

Python 3.12 or newer.

pip install --pre kicad-placement-mcp

This installs both the MCP server (kicad-placement-mcp) and the command-line tool (kicad-placement). With uv you can skip the install and register uvx kicad-placement-mcp instead.

Register the MCP server

Claude Code:

claude mcp add -s user kicad-placement -- kicad-placement-mcp

Claude Desktop or other clients (claude_desktop_config.json or equivalent):

{
  "mcpServers": {
    "kicad-placement": { "command": "kicad-placement-mcp" }
  }
}

If kicad-placement-mcp is not on the client's PATH, give the full path of the script, or run the module with the Python of your environment: "command": "C:\\path\\to\\.venv\\Scripts\\python.exe", "args": ["-m", "kicad_placement.mcp_server"].

apply changes the board open in KiCad. It is marked as destructive, so clients ask before running it; in Claude Code you can make sure with "permissions": {"ask": ["mcp__kicad-placement__apply"]} in ~/.claude/settings.json.

Docker (MCP Toolkit)

The server is also published as an image. Mount the folder with your boards; the tools see it as /boards:

docker run -i --rm -v /path/to/boards:/boards ghcr.io/cvaldess/kicad-placement-mcp:latest

In Docker Desktop's MCP Toolkit you can add it to a catalog of your own with docker mcp catalog create <your-catalog> --server docker://ghcr.io/cvaldess/kicad-placement-mcp:latest. It is also listed in the MCP Registry as io.github.cvaldess/kicad-placement-mcp.

From a container, apply cannot reach KiCad's IPC socket on Windows or macOS: use the container for measure, place and orient, and a local install (above) to apply.

Enable the KiCad IPC API (only for apply)

KiCad 9 or newer. In KiCad: Preferences → Plugins → Enable KiCad API, then open the board in the PCB editor (the project manager alone does not serve it). apply connects to the default socket; pass --socket (CLI) if yours is different.

How to use it

Ask the assistant in plain words, for example "measure my board", "place the passives around U3 and U5", "fix what is wrong in my placement without moving the rest" (conservative), "apply it". The tools:

Tool What it does Touches the board?
measure metrics and problems of the current placement no
place proposes positions for the movable passives (movable, or all 2-pad passives that are not anchors); conservative keeps what already complies no
orient proposes rotations only no
apply takes the last proposal to the board open in KiCad, in one commit (one Ctrl+Z); does not save yes

Every call writes its result next to the board, in placement/: <board>.measure.json, <board>.place.json, <board>.orient.json and a .png view of each (overwritten each time). The JSON of place says, for each part, where it was, where it goes, how far it moves and why ("decoupling of U3:16", "next to the control pin Q2:1", "stays: already complies where it is"…), plus a before/after summary.

Before applying, apply checks that the open board matches the file that was measured, part by part; afterwards it reads the pads back and checks that every footprint is unchanged except for its position. If anything differs it says so and reports ok: false. Parts with tracks connected are refused unless you force it (the routing would be left behind).

Command line

The same actions, without an assistant:

kicad-placement measure board.kicad_pcb --png view.png --json measure.json [--rules rules.json]
kicad-placement place   board.kicad_pcb --json place.json [--movable C1,C2,R5] [--conservative] [--rules rules.json]
kicad-placement orient  board.kicad_pcb --json orient.json [--only C8,C10]
kicad-placement apply   board.kicad_pcb place.json        # to the board open in KiCad

On Windows, run Python with -X utf8 if the console shows mangled characters.

Rules

The design intent goes in placement/<board>.rules.json, next to the board (or --rules). Everything is optional. Distances are in mm, edge to edge (courtyard ∪ pads); in constraints and exemptions, references accept * and ? wildcards; "U2:31" means pad 31 of U2.

{
  "anchors": ["C1", "R5"],
  "movable": ["TP3"],
  "decoupling": {"C8": "U3:16"},
  "decoupling_exempt": ["U10:5"],
  "overlap_exempt": ["J7", "J2–J3"],
  "edge_exempt": ["J1"],
  "edge_mm": 0.5,
  "constraints": [
    {"type": "near", "a": "C19", "b": "D3", "max": 1.5, "source": "input protection next to the connector"},
    {"type": "separate", "a": ["J7:1", "J7:2"], "b": ["*"], "min": 2.0},
    {"type": "outside", "footprint": "J7", "margin": 0.5, "except": ["J1"]},
    {"type": "outside", "rect": [10, 20, 40, 35], "refs": ["C*", "R*"]},
    {"type": "zone", "refs": ["R1?"], "rect": [50, 10, 70, 30]},
    {"type": "edge", "ref": "J1", "edge": "left", "max": 1.0},
    {"type": "side", "ref": "U4", "side": "F"},
    {"type": "barrier", "dru": "barrera_tc", "min": 3.6, "nets": ["/GND_TC", "/+3V3_TC"], "footprints": ["U2"]}
  ]
}
Key Meaning
anchors 2-pad passives that must not move (exact references). Parts locked in KiCad and everything that is not a 2-pad passive are anchors already
movable extra parts that may move (exact references: test points, net ties…)
decoupling ties a capacitor to a pin; overrides the automatic assignment (also valid on signal nets: RC filters)
decoupling_exempt power pins that do not need a capacitor next to them (the datasheet says so: e.g. an eFuse output)
overlap_exempt parts, or pairs "A–B" / ["A", "B"], whose overlaps are intended
edge_exempt, edge_mm parts allowed past the edge clearance, and the clearance (0.5 mm)
near a within max of b
separate copper of a at least min from copper of b
outside nothing (or refs, minus except) inside a rectangle [x0, y0, x1, y1] or a footprint's courtyard, plus margin
zone refs inside the rectangle
edge ref within max of the board edge top/bottom/left/right
side ref on side F or B
barrier isolation between two domains: the nets, footprints and net classes of one side keep min from the rest; dru names the .kicad_dru rule it comes from

source (or _note) is free text for you. If the .kicad_dru has an isolation clearance that no barrier covers, measure warns and place refuses (unless forced): the proposal would not respect it.

Keepout areas drawn in KiCad, vias, tracks and copper zones are read from the board; they need no rules.

Limitations

  • One side: only parts on their current side are placed; parts are not flipped.
  • Anchors are not placed: connectors, ICs, crystals and anything not a 2-pad passive stay where you put them.
  • Test points need a rule to move.
  • Rotations in 90° steps only.
  • Notes that depend on routing (keep away from a trace, Kelvin connections, differential pairs) are not modelled.
  • Decoupling capacitors are assigned by geometry and pin types; bulk capacitors also by the schematic. Ambiguous cases are reported and need a decoupling rule.
  • No RF awareness.
  • A full placement of a 150-part board takes a few minutes.

See DESIGN.md for how it works and why.

Reporting a failure

Any placement you consider wrong is a failure of the tool or of the rules, and the most useful contribution you can make. Please open an issue with the Placement failure form and include:

  • what you asked (tool and options, or the assistant's call) and the version (pip show kicad-placement-mcp);
  • the part(s) and what is wrong, and where you would put them and why (a datasheet note, a layout rule of thumb);
  • the placement/<board>.<action>.json and .png, and your rules.json;
  • the board files if you can share them (.kicad_pcb, .kicad_pro, .kicad_dru, .kicad_sch). A failure that comes with its board becomes a regression test; if the board is private, a minimal board that shows the same failure works just as well.

Crashes and wrong measurements go in a Bug report. If you use the assistant, ask it to draft the issue: it has the JSON at hand.

Development

git clone https://github.com/cvaldess/kicad-placement-mcp
cd kicad-placement-mcp
python -m venv .venv
.venv/bin/pip install -e ".[test]"       # Windows: .venv\Scripts\pip
.venv/bin/python -m pytest -q

The tests do not need KiCad, except tests/test_apply.py, which runs KiCad 11 nightly in Docker and is skipped if the image is missing:

docker build -t kicad-placement-kicad:nightly-YYYYMMDD -f docker/kicad-nightly.Dockerfile docker
docker build -t kicad-placement-test:nightly-YYYYMMDD -f docker/test.Dockerfile docker

(Set IMAGE in tests/test_apply.py to your tag.) Read CONTRIBUTING.md before a pull request: every change of criterion comes with a test on a real board.

License

GPL-3.0-or-later, like KiCad. The test boards in tests/data are CERN-OHL-S-2.0 (NOTICE).

This project is not affiliated with or endorsed by the KiCad project.

Metadata

Release files for kicad-placement-mcp 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kicad-placement-mcp 0.1.0a1
File Size Uploaded Provenance Actions
kicad_placement_mcp-0.1.0a1.tar.gz 116.1 kB With provenance Details for kicad_placement_mcp-0.1.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kicad-placement-mcp 0.1.0a1
File Interpreter ABI Platform Actions
kicad_placement_mcp-0.1.0a1-py3-none-any.whl Python 3 none any Details for kicad_placement_mcp-0.1.0a1-py3-none-any.whl

Total release size: 213.8 kB

Release files / kicad_placement_mcp-0.1.0a1.tar.gz

Download URL kicad_placement_mcp-0.1.0a1.tar.gz
Size 116.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c681977b81b187b9468990dcd9b99ae6d360213c4c1015aacd52e3afe3113d83
BLAKE2b-256 checksum
How to use checksums
9f45ea3ba1023bcf2b305f6a379448404044c8583c21bf17d97ab745afa9eb3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / kicad_placement_mcp-0.1.0a1-py3-none-any.whl

Download URL kicad_placement_mcp-0.1.0a1-py3-none-any.whl
Size 97.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c610bf0dbbcc551c7c396fcc2c5754090a7f23af55708ce2e58d8e564d9e670
BLAKE2b-256 checksum
How to use checksums
95dfb29ab06c515c23f829d1b6371b184610cc10cea706cb30ff4af9e72fda3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for kicad-placement-mcp 0.1.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kicad_placement_mcp-0.1.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page