KiCad MCP server

Enables Claude to analyze and validate KiCad electronic design projects through PCB visualization, design rule checking, and schematic analysis for improved troubleshooting and manufacturing preparation.
Back to servers
Provider
Lama Alrajih
Release date
Mar 20, 2025
Language
Python
Stats
134 stars

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.

Prerequisites

  • macOS, Windows, or Linux
  • Python 3.10 or higher
  • KiCad 9.0 or higher
  • Claude Desktop (or another MCP client)

Installation

Set Up Python Environment

# 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

Configure Environment

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

Run the Server

python main.py

Configure an MCP Client

To set up Claude Desktop with your KiCad MCP server:

  1. Create/edit the Claude Desktop configuration:
# 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
  1. Add the KiCad MCP server configuration:
{
    "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.

  1. Restart your MCP client to load the new configuration.

MCP Components

The server provides three types of capabilities:

Resources, Tools, and Prompts

  • Resources: Read-only data sources (like kicad://projects for listing all KiCad projects)
  • Tools: Functions that perform actions or computations (like open_project() to launch KiCad)
  • Prompts: Pre-defined templates for common interactions (like troubleshooting PCB issues)

Key Features

  • Project Management: List, examine, and open KiCad projects
  • PCB Design Analysis: Get insights about your PCB designs and schematics
  • Netlist Extraction: Extract and analyze component connections
  • BOM Management: Analyze and export Bills of Materials
  • Design Rule Checking: Run DRC checks and track progress
  • PCB Visualization: Generate visual representations of PCB layouts
  • Circuit Pattern Recognition: Identify common circuit patterns

Using Natural Language

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?

Configuration Options

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

Troubleshooting

If the server isn't appearing in your MCP client:

  • Verify the client configuration file has correct paths
  • Ensure Python can access the mcp package
  • Check if KiCad is properly detected

For server errors:

  • Check terminal output when running the server
  • Review Claude logs at:
    • ~/Library/Logs/Claude/mcp-server-kicad.log
    • ~/Library/Logs/Claude/mcp.log

Working directory issues:

  • Always use absolute paths in configuration and .env files
  • For command-line testing, run from the known directory

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later