The KiCad MCP Server provides an interface between KiCad PCB design software and AI assistants that implement the Model Context Protocol (MCP), enabling you to interact with your KiCad projects through natural language. This allows you to analyze PCB designs, check design rules, manage BOMs, and more through conversation with compatible clients like Claude Desktop.
# Clone the repository
git clone https://github.com/lamaalrajih/kicad-mcp.git .
# Create a virtual environment and activate it
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the MCP SDK and other dependencies
pip install -r requirements.txt
Create a .env
file to specify where the server looks for your KiCad projects:
# Copy the example environment file
cp .env.example .env
# Edit the .env file
vim .env
In the .env
file, add your custom project directories:
# Add paths to your KiCad projects (comma-separated)
KICAD_SEARCH_PATHS=~/pcb,~/Electronics,~/Projects/KiCad
Start the MCP server:
python main.py
Set up Claude Desktop to use the KiCad MCP server:
# Create the directory if it doesn't exist
mkdir -p ~/Library/Application\ Support/Claude
# Edit the configuration file
vim ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"kicad": {
"command": "/ABSOLUTE/PATH/TO/YOUR/PROJECT/kicad-mcp/venv/bin/python",
"args": [
"/ABSOLUTE/PATH/TO/YOUR/PROJECT/kicad-mcp/main.py"
]
}
}
}
Replace /ABSOLUTE/PATH/TO/YOUR/PROJECT/kicad-mcp
with the actual path to your project directory.
Close and reopen your MCP client to load the new configuration.
You don't need to use formal commands or full file paths. Instead, you can use natural language requests like:
Can you check if there are any design rule violations in my Arduino shield project?
Or:
I'm working on the temperature sensor circuit. Can you identify what patterns it uses?
The MCP client will interpret your request and communicate with the KiCad MCP Server to get the information you need.
The server can be configured using environment variables or a .env
file:
Environment Variable | Description | Example |
---|---|---|
KICAD_SEARCH_PATHS |
Comma-separated list of directories to search for KiCad projects | ~/pcb,~/Electronics,~/Projects |
KICAD_USER_DIR |
Override the default KiCad user directory | ~/Documents/KiCadProjects |
KICAD_APP_PATH |
Override the default KiCad application path | /Applications/KiCad7/KiCad.app |
If you encounter issues:
mcp
package~/Library/Logs/Claude/mcp-server-kicad.log
(server-specific logs)~/Library/Logs/Claude/mcp.log
(general MCP logs)There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.