The KiCad MCP Server enables interaction with your KiCad projects through the Model Context Protocol, allowing you to analyze, manage, and visualize PCB designs using natural language commands with any MCP-compliant client such as 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 your KiCad project locations:
# Copy the example environment file
cp .env.example .env
# Edit the .env file
vim .env
Add your KiCad project directories to the .env file:
# Add paths to your KiCad projects (comma-separated)
KICAD_SEARCH_PATHS=~/pcb,~/Electronics,~/Projects/KiCad
python main.py
To set up Claude Desktop with your 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.
The server provides three types of capabilities:
kicad://projects
for listing all KiCad projects)open_project()
to launch KiCad)Rather than typing exact commands, you can use natural language:
Instead of formal syntax:
Show me the DRC report for /Users/username/Documents/KiCad/my_project/my_project.kicad_pro
You can simply ask:
Can you check if there are any design rule violations in my Arduino shield project?
Configure the server using environment variables or a .env
file:
Environment Variable | Description | Example |
---|---|---|
KICAD_SEARCH_PATHS |
Directories to search for KiCad projects | ~/pcb,~/Electronics,~/Projects |
KICAD_USER_DIR |
Override default KiCad user directory | ~/Documents/KiCadProjects |
KICAD_APP_PATH |
Override default KiCad application path | /Applications/KiCad7/KiCad.app |
If the server isn't appearing in your MCP client:
mcp
packageFor server errors:
~/Library/Logs/Claude/mcp-server-kicad.log
~/Library/Logs/Claude/mcp.log
Working directory issues:
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.