LK

lamaalrajih/kicad-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

536 stars 83 forks 质量 62 趋势 1MIT

适用于 Mac、Windows 和 Linux 的 KiCad 模型上下文协议服务器

概览

本指南将帮助您为 KiCAD 搭建模型上下文协议(MCP)服务器。虽然本指南中的示例经常引用 Claude Desktop,但该服务器兼容 。您可以将其与 Claude Desktop、您自己的自定义 MCP 客户端或任何实现模型上下文协议的其他应用程序一起使用。 - macOS、Windows 或 Linux - Python 3.10 及以上 - KiCad 9.0 及以上 - uv 0.8.0 或更高 - Claude Desktop(或其他 MCP 客户端) 首先,让我们安装依赖并搭建环境: 创建一个 .env 文件,用于自定义服务器查找 KiCad 项目的位置: 在 .env 文件中,添加你的自定义项目目录: 环境搭建完成后,你可以运行服务器: 现在,让我们配置 Claude Desktop 以使用我们的 MCP 服务器: 1. 创建或编辑 Claude Desktop 配置文件:

概述(AI 翻译)

本指南将帮助您为 KiCad 搭建模型上下文协议(MCP)服务器。虽然本指南中的示例经常引用 Claude Desktop,但该服务器兼容任何符合 MCP 的客户端。您可以将其与 Claude Desktop、您自己的自定义 MCP 客户端,或任何实现模型上下文协议的其他应用程序一起使用。

目录

  • 先决条件
  • 安装步骤
  • 理解MCP组件
  • 特色亮点
  • 自然语言交互
  • 文档
  • 配置
  • 发展指南
  • 故障排除
  • 贡献
  • 未来发展理念
  • 许可证

先修条件

  • macOS、Windows或Linux
  • Python 3.10 或更高版本
  • KiCad 9.0及以上
  • UV 0.8.0或更高
  • Claude 桌面(或其他 MCP 客户端)

安装步骤

1.搭建你的Python环境

首先,让我们安装依赖并搭建环境:

2.配置您的环境

创建一个 .env 文件,用于自定义服务器查找 KiCad 项目的位置:

在 .env 文件中,添加你的自定义项目目录:

3.运行服务器

环境搭建完成后,你可以运行服务器:

4.配置MCP客户端

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 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)

Installation Steps

1. Set Up Your Python Environment

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

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

# Install dependencies – `uv` will create a `.venv/` folder automatically
# (Install `uv` first: `brew install uv` on macOS or `pipx install uv`)
make install

# Optional: activate the environment for manual commands
source .venv/bin/activate

2. Configure Your Environment

Create a .env file to customize 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

3. Run the Server

Once the environment is set up, you can run the server:

python main.py

4. 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
  1. Add the KiCad MCP server to the 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.

5. 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:

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "kicad": { "command": "/ABSOLUTE/PATH/TO/YOUR/PROJECT/kicad-mcp/.venv/bin/python", "args": [ "/ABSOLUTE/PATH/TO/YOUR/PROJECT/kicad-mcp/main.py" ] } } }