kicad-mcp

kicad-mcp

Enables natural language interaction with KiCad projects, schematics, and PCBs, supporting project management, design rule checking, netlist extraction, and datasheet RAG search.

Category
访问服务器

README

KiCad MCP Server

This guide will help you set up a Model Context Protocol (MCP) server for KiCad. While the examples in this guide often reference Claude Desktop, the server is compatible with any MCP-compliant client. You can use it with Claude Desktop, your own custom MCP clients, or any other application that implements the Model Context Protocol.

Table of Contents

Prerequisites

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

Build

1. Set Up Your Python Environment

First, let's install dependencies and set up our environment:

# Clone the repository
git clone https://github.com/fsbondtec/kicad-mcp.git
cd kicad-mcp

# Create the environment from environment.yml
conda env create -f environment.yml

# Activate the environment
conda activate kicad-mcp

#Install package in editable mode
pip install -e .

# Run all tests
pytest tests/ -v

# run server
kicad-mcp

2. Configure Your Environment

Change the path directly in config.py where the global variables KICAD_USER_DIR and KICAD_APP_PATH should be changed

3. Configure an MCP Client

Now, let's configure Claude Desktop to use our MCP server:

  1. Create or edit the Claude Desktop configuration file:
# 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

Or change with Claude Desktop under:

  • Files -> Settings -> Developer -> Edit Config
  1. Add the KiCad MCP server to the configuration:
{
    "mcpServers": {
        "kicad": {
            "command": "C:/Users/{user}/AppData/Local/miniconda3/envs/kicad-mcp/python.exe",
            "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.

4. Restart Your MCP Client

Close and reopen your MCP client to load the new configuration.

Understanding MCP Components

The Model Context Protocol (MCP) defines three primary ways to provide capabilities:

Resources vs Tools vs Prompts

Resources are read-only data sources that LLMs can reference:

  • Similar to GET endpoints in REST APIs
  • Provide data without performing significant computation
  • Used when the LLM needs to read information
  • Typically accessed programmatically by the client application
  • Example: kicad://projects returns a list of all KiCad projects

Tools are functions that perform actions or computations:

  • Similar to POST/PUT endpoints in REST APIs
  • Can have side effects (like opening applications or generating files)
  • Used when the LLM needs to perform actions in the world
  • Typically invoked directly by the LLM (with user approval)
  • Example: open_project() launches KiCad with a specific project

Prompts are reusable templates for common interactions:

  • Pre-defined conversation starters or instructions
  • Help users articulate common questions or tasks
  • Invoked by user choice (typically from a menu)
  • Example: The debug_pcb_issues prompt helps users troubleshoot PCB problems

For more information on resources vs tools vs prompts, read the MCP docs.

Feature Highlights

The KiCad MCP Server provides several key features, each with detailed documentation:

  • Project Management: List, and examine KiCad projects

    • Example: "Show me all my recent KiCad projects" → Lists all projects claude has access to
  • Schematic Design Analysis: Get insights about your schematics

    • Example: "Analyze the High Voltage Part of my Circuit" → Provides high voltage analysis
  • Netlist Extraction: Extract and analyze component connections from schematics

    • Example: "What components are connected to the MCU in my Arduino shield?" → Shows all connections to the microcontroller
  • Design Rule Checking: Run DRC checks using the KiCad CLI and track your progress over time

    • Example: "Run DRC on my power supply board and compare to last week" → Shows progress in fixing violations
  • Datasheet RAG Search: Automatically indexes component datasheets and lets Claude answer technical questions about your components

    • Example: "What is the I2C address of U3?" → Searches the indexed datasheet and returns the relevant section
  • Schematic and PCB path visualisation in SVG files: Generate visual representation of paths in schematic and PCB SVG plotting

    • Example: "Can you find the high voltage path through my project and highlight it in schematic and pcb?" → Plots with kicad-cli all schematics to SVG and then all PCB layers in one SVG file, highlights the connections

For more examples and details on each feature, see the dedicated guides in the documentation. You can also ask the LLM what tools it has access to!

Natural Language Interaction

While our documentation often shows examples like:

Show me the DRC report for /Users/username/Documents/KiCad/my_project/my_project.kicad_pro

You don't need to type the full path to your files! The LLM can understand more natural language requests.

For example, instead of the formal command above, you can simply ask:

Can you check if there are any design rule violations in my Arduino shield project?

The LLM will understand your intent and request the relevant information from the KiCad MCP Server. If it needs clarification about which project you're referring to, it will ask.

Documentation

Detailed documentation for each feature is available in the docs/ directory:

Configuration

The KiCad MCP Server can be configured using environment variables or a .env file:

Key Configuration Options

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

See Configuration Guide for more details.

Development Guide

Project Structure

The KiCad MCP Server is organized into a modular structure:

kicad-mcp/
├── README.md                       # Project documentation
├── main.py                         # Entry point that runs the server
├── requirements.txt                # Python dependencies
├── kicad_mcp/                      # Main package directory
│   ├── __init__.py
│   ├── server.py                   # MCP server setup
│   ├── config.py                   # Configuration constants and settings
│   ├── context.py                  # Lifespan management and shared context
│   ├── resources/                  # Resource handlers
│   ├── tools/                      # Tool handlers
│   ├── prompts/                    # Prompt templates
│   └── utils/                      # Utility functions
├── docs/                           # Documentation
└── tests/                          # Unit tests

Adding New Features

To add new features to the KiCad MCP Server, follow these steps:

  1. Identify the category for your feature (resource, tool, or prompt)
  2. Add your implementation to the appropriate module
  3. Register your feature in the corresponding register function
  4. Test your changes with the development tools

See Development Guide for more details.

Troubleshooting

If you encounter issues:

  1. Server Not Appearing in MCP Client:

    • Check your client's configuration file for errors
    • Make sure the path to your project and Python interpreter is correct
    • Ensure Python can access the mcp package
    • Check if your KiCad installation is detected
  2. Server Errors:

    • Check the terminal output when running the server in development mode
    • Check Claude logs at:
      • ~/Library/Logs/Claude/mcp-server-kicad.log (server-specific logs)
      • ~/Library/Logs/Claude/mcp.log (general MCP logs)
  3. Working Directory Issues:

    • The working directory for servers launched via client configs may be undefined
    • Always use absolute paths in your configuration and .env files
    • For testing servers via command line, the working directory will be where you run the command

See Troubleshooting Guide for more details.

If you're still not able to troubleshoot, please open a Github issue.

License

This project is open source under the MIT license.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选