
KiCad
STDIOMCP server for KiCad PCB design automation using official IPC-API integration
MCP server for KiCad PCB design automation using official IPC-API integration
This project is a Model Context Protocol (MCP) server for KiCad. As MCP server that utilizes KiCad's official IPC-API, it provides the most stable and reliable way for AI models like Claude to interact with KiCad, automating and assisting with PCB design and schematic tasks.
kicad-python
library.https://github.com/user-attachments/assets/e2ba57e7-2c77-4c56-a911-c461c77307e4
https://github.com/user-attachments/assets/de6c93dc-8808-4321-827e-ebad0556e7b1
https://github.com/user-attachments/assets/0fea60de-d012-4b4d-bfa4-dd1b758b2c7f
This server features AnalyzeTools
for enhanced board analysis. A key tool is get_board_status
, which provides a comprehensive overview of the PCB layout, including screenshots.
To ensure robust and reliable operations, the server uses an ActionFlowManager
. This manager orchestrates the execution of actions by automatically invoking get_board_status
both before and after each action. This flow provides the AI model with critical context:
This automated verification process significantly improves the accuracy and reliability of automated PCB design tasks.
With this MCP server, an AI model can perform tasks such as:
get_board_status
for comprehensive analysis.This project uses Poetry to manage dependencies.
kicad-python
This project uses the kicad-python
library as a Git submodule. Therefore, you must build and install kicad-python
before running this project.
Clone Repository and Initialize Submodules: Run git submodule update --init to add kicad-python's source code as a submodule.
git submodule update --init --depth 1
Build and Install kicad-python
:
Navigate to the kicad-python
directory and follow the instructions in that project's COMPILING.md
file to build and install the library.
Before running the server, you need to create a .env
file in the project's root directory (KiCad-mcp-python/.env
). This file is crucial for tools that rely on KiCad's command-line interface (CLI), such as get_board_status
which generates screenshots to provide visual context of the board. It stores the necessary environment variables for the server to function correctly.
Create a file named .env
and add the following content, adjusting the paths to match your system configuration:
KICAD_CLI_PATH=/path/to/your/kicad-cli
PCB_PATHS=/path/to/your/project1.kicad_pcb,/path/to/your/project2.kicad_pcb
Variable Explanations:
KICAD_CLI_PATH
: The absolute path to the KiCad command-line interface (CLI) executable.
/Applications/KiCad/KiCad.app/Contents/MacOS/kicad-cli
C:\Program Files\KiCad\7.0\bin\kicad-cli.exe
/usr/bin/kicad-cli
PCB_PATHS
: A comma-separated list of absolute paths to the .kicad_pcb
files you want the MCP server to be able to access.Install Dependencies:
Once kicad-python
is installed, return to this project's root directory and run the following command to install the remaining dependencies:
poetry install
Enable KiCad IPC Server: Launch KiCad and enable the IPC server by selecting Tools -> External Plugin -> Start Server.
Start the MCP Server: Start the MCP server with the following command:
poetry run python main.py
The server is now waiting for a connection from an MCP client.
To use this server with an MCP client (e.g., a VSCode extension), you need to configure the server execution command correctly.
Find the Poetry Virtual Environment Interpreter Path: Run the following command to find the full path to the Python interpreter installed in the current project's Poetry virtual environment:
poetry env info --path
Copy the path output by the command (e.g., /pypoetry/virtualenvs/kicad-mcp-python-xxxxxxxx-py3.10
).
Add MCP Server Configuration:
Add the server information to your MCP client's configuration file (e.g., mcp_servers.json
) as follows:
command
: Enter the full path to the interpreter by appending /bin/python
to the path you copied above.args
: Add ["/path/to/your/KiCad-mcp-python/main.py"]
to specify the script to run. Make sure to provide the full, absolute path to main.py
.Configuration Example:
{ "servers": [ { "name": "kicad-mcp-server", "command": "/pypoetry/virtualenvs/kicad-mcp-python-xxxxxxxx-py3.10/bin/python", "args": ["/path/to/your/kicad-mcp-python/main.py"], } ] }
Schematic Support: Currently developing APIs related to schematics in KiCad, and we plan to implement these features in the MCP as soon as development is complete.
Simultaneous Multi-Item Editing/Moving: We will implement functionality to select and modify or move multiple PCB items at once.
Workflow Improvements: We will improve the step-by-step flow of tools like item creation and modification to provide a more efficient and intuitive API.
get_board_status
to include pre and post operation board information with screenshots for visual verification. (0714 commit)kicad-python
submodule installation.