Merge pull request #150 from Kletternaut/feature/vscode-clean

feat: multilingual README, VS Code setup guide, add_no_connect handler, tool descriptions, corrected tool counts
This commit is contained in:
Tom
2026-05-03 12:01:51 +02:00
committed by GitHub
18 changed files with 680 additions and 433 deletions

119
.github/README.de.md vendored Normal file
View File

@@ -0,0 +1,119 @@
<a name="top"></a>
<div align="center">
<img src="../resources/images/KiCAD-MCP-Server_only_css.svg" alt="KiCAD-MCP-Server Logo" height="240" />
# KiCAD MCP Server
[🇺🇸 **English** (EN)](README.md) &nbsp;&nbsp; [🇩🇪 **Deutsch** (DE)](#) &nbsp;&nbsp; [🇨🇳 **中文** (ZH)](README.zh.md)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](../docs/PLATFORM_GUIDE.md)
[![KiCAD](https://img.shields.io/badge/KiCAD-9.0+-green.svg)](https://www.kicad.org/)
[![Stars](https://img.shields.io/github/stars/mixelpixx/KiCAD-MCP-Server.svg)](https://github.com/mixelpixx/KiCAD-MCP-Server/stargazers)
[![Discussions](https://img.shields.io/badge/community-Discussions-orange.svg)](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions)
</div>
<!-- prettier-ignore-start -->
<div align="center">
#### Unser neues Forum ist online: https://forum.orchis.ai — Fragen? Ideen? Projekte zeigen?
</div>
<!-- prettier-ignore-end -->
#
**KiCAD MCP Server** ist ein Model Context Protocol (MCP) Server, der KI-Assistenten wie Claude ermöglicht, mit KiCAD für die PCB-Design-Automatisierung zu interagieren. Aufgebaut auf der MCP-Spezifikation 2025-06-18, bietet dieser Server umfassende Tool-Schemas und Echtzeit-Projektzugriff für intelligente PCB-Design-Workflows.
### PCBs mit natürlicher Sprache designen
Beschreibe was du bauen möchtest — und lass die KI die EDA-Arbeit übernehmen. Bauteile platzieren, eigene Symbole und Footprints erstellen, Verbindungen routen, Prüfungen ausführen und Fertigungsdateien exportieren — alles im Gespräch mit deinem KI-Assistenten.
### Was es heute kann
- Projektanlage, Schaltplan-Bearbeitung, Bauteil-Platzierung, Routing, DRC/ERC, Export
- **Eigene Symbole und Footprints generieren** — auch für Module die in KiCAD-Standardbibliotheken fehlen
- **Eigene Bibliotheksverwaltung** — einmal erstellt, in jedem Projekt wiederverwendbar
- **JLCPCB-Integration** — Bauteilkatalog mit Preisen und Lagerbestand
- **Freerouting-Integration** — automatisches PCB-Routing via Java/Docker
- **Visuelles Feedback** — Snapshots und Session-Logs für Nachvollziehbarkeit
- **Plattformübergreifend** — Windows, Linux, macOS
### Schnellstart
1. [KiCAD 9.0+](https://www.kicad.org/download/) installieren
2. [Node.js 18+](https://nodejs.org/) und [Python 3.11+](https://www.python.org/) installieren
3. Klonen und bauen:
```bash
git clone https://github.com/mixelpixx/KiCAD-MCP-Server.git
cd KiCAD-MCP-Server
npm install
npm run build
```
4. KI-Client konfigurieren — siehe [Plattform-Anleitung](../docs/PLATFORM_GUIDE.md)
### GitHub Copilot (VS Code)
Template kopieren:
```bash
cp config/vscode-mcp.example.json .vscode/mcp.json
```
VS Code erkennt `.vscode/mcp.json` automatisch und registriert den Server. Das Template nutzt `${workspaceFolder}` — kein Pfad muss angepasst werden.
### Claude Desktop
Konfigurationsdatei bearbeiten:
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS/Linux:** `~/.config/claude/claude_desktop_config.json`
Beispielkonfiguration: `config/windows-config.example.json` oder `config/macos-config.example.json`
### Dokumentation
- [**Vollständige README**](../README.md) — komplette Dokumentation
- [Schnellstart (Router Tools)](../docs/ROUTER_QUICK_START.md) — erste Schritte
- [Werkzeug-Übersicht](../docs/TOOL_INVENTORY.md) — alle verfügbaren Werkzeuge
- [Schaltplan-Werkzeuge](../docs/SCHEMATIC_TOOLS_REFERENCE.md)
- [Routing-Werkzeuge](../docs/ROUTING_TOOLS_REFERENCE.md)
- [Footprint & Symbol erstellen](../docs/FOOTPRINT_SYMBOL_CREATOR_GUIDE.md)
- [JLCPCB-Anleitung](../docs/JLCPCB_USAGE_GUIDE.md)
- [Plattform-Anleitung](../docs/PLATFORM_GUIDE.md)
- [Changelog](../CHANGELOG.md)
### Community
- [Diskussionen](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — Fragen, Ideen, Projekte zeigen
- [Issues](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — Fehler und Feature-Wünsche
- [Mitwirken](../CONTRIBUTING.md)
### KI-Hinweis
> **Entwickelt mit KI-Unterstützung**
> Dieses Projekt wurde unter Einsatz von KI-gestützten Entwicklungswerkzeugen (GitHub Copilot, Claude) erstellt.
> Sämtlicher Code wurde von den Maintainern geprüft, getestet und integriert.
> KI-Werkzeuge dienten der Entwicklungsbeschleunigung — kreative Entscheidungen, Architektur und Verantwortung liegen ausschließlich bei den Autoren.
### Haftungsausschluss
> **Keine Haftung — Nutzung auf eigene Verantwortung**
>
> Dieses Projekt wird ohne jegliche Gewährleistung bereitgestellt — weder ausdrücklich noch stillschweigend. Die Autoren und Mitwirkenden übernehmen keinerlei Haftung für Schäden jeder Art, die durch die Nutzung oder Nichtnutzung dieser Software entstehen, einschließlich aber nicht beschränkt auf:
>
> - Fehler in erzeugten Schaltplänen, PCB-Layouts oder Fertigungsdateien
> - Schäden an Hardware, Bauteilen oder Geräten durch fehlerhafte Designs
> - Finanzielle Verluste durch Fehlproduktionen oder Fehlerbestellungen
> - Datenverlust oder Beschädigung von KiCAD-Projektdateien
>
> KI-generierte Design-Vorschläge ersetzen keine qualifizierte ingenieurtechnische Prüfung. Sicherheitskritische Anwendungen (Medizintechnik, Luftfahrt, Automotive o.ä.) erfordern zwingend eine unabhängige Fachprüfung.
>
> Dieses Projekt steht unter der MIT-Lizenz — die Lizenz schließt ebenfalls jede Haftung aus.
<div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div>

209
.github/README.md vendored
View File

@@ -1,4 +1,4 @@
<a name="top"></a> <a name="top"></a>
<div align="center"> <div align="center">
@@ -6,7 +6,7 @@
# KiCAD MCP Server # KiCAD MCP Server
[🇺🇸 **English** (EN)](#english) &nbsp;&nbsp; [🇩🇪 **Deutsch** (DE)](#deutsch) &nbsp;&nbsp; [🇨🇳 **中文** (ZH)](#中文) [🇺🇸 **English** (EN)](#) &nbsp;&nbsp; [🇩🇪 **Deutsch** (DE)](README.de.md) &nbsp;&nbsp; [🇨🇳 **中文** (ZH)](README.zh.md)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](../docs/PLATFORM_GUIDE.md) [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](../docs/PLATFORM_GUIDE.md)
@@ -16,14 +16,15 @@
</div> </div>
<!-- prettier-ignore-start -->
<div align="center"> <div align="center">
---
Our new forum is up: https://forum.orchis.ai
Need help? Have suggestions? Want to show off your work
---
</div>
## English #### Our new forum is up: https://forum.orchis.ai — Need help? Have suggestions? Want to show off your work?
</div>
<!-- prettier-ignore-end -->
#
**KiCAD MCP Server** is a Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with KiCAD for PCB design automation. Built on the MCP 2025-06-18 specification, this server provides comprehensive tool schemas and real-time project state access for intelligent PCB design workflows. **KiCAD MCP Server** is a Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with KiCAD for PCB design automation. Built on the MCP 2025-06-18 specification, this server provides comprehensive tool schemas and real-time project state access for intelligent PCB design workflows.
@@ -54,7 +55,20 @@ npm install
npm run build npm run build
``` ```
4. Configure Claude Desktop — see [Platform Guide](../docs/PLATFORM_GUIDE.md) 4. Configure your AI client — see [Platform Guide](../docs/PLATFORM_GUIDE.md)
### GitHub Copilot (VS Code)
Copy `config/vscode-mcp.example.json` to `.vscode/mcp.json` — VS Code auto-detects it. → [Full setup guide](../README.md#github-copilot-vs-code)
### Claude Desktop
Edit your config file:
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS/Linux:** `~/.config/claude/claude_desktop_config.json`
Example configs: `config/windows-config.example.json` or `config/macos-config.example.json`
### Documentation ### Documentation
@@ -69,11 +83,21 @@ npm run build
- [Changelog](../CHANGELOG.md) - [Changelog](../CHANGELOG.md)
### Community ### Community
- [Forum](https://forum.orchis.ai) — Official Forum for discussions, help, and troubleshooting
- [Discussions](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — questions, ideas, showcase - [Discussions](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — questions, ideas, showcase
- [Issues](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — bugs and feature requests - [Issues](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — bugs and feature requests
- [Contributing](../CONTRIBUTING.md) - [Contributing](../CONTRIBUTING.md)
## Star History
<a href="https://www.star-history.com/?repos=mixelpixx%2FKiCAD-MCP-Server&type=date&legend=top-left">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&legend=top-left" />
</picture>
</a>
### AI Disclosure ### AI Disclosure
> **Developed with AI Assistance** > **Developed with AI Assistance**
@@ -97,168 +121,3 @@ npm run build
> This project is licensed under the MIT License — which likewise excludes all liability. > This project is licensed under the MIT License — which likewise excludes all liability.
<div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div> <div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div>
---
## Star History
<a href="https://www.star-history.com/?repos=mixelpixx%2FKiCAD-MCP-Server&type=date&legend=top-left">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=mixelpixx/KiCAD-MCP-Server&type=date&legend=top-left" />
</picture>
</a>
## Deutsch
**KiCAD MCP Server** ist ein Model Context Protocol (MCP) Server, der KI-Assistenten wie Claude ermöglicht, mit KiCAD für die PCB-Design-Automatisierung zu interagieren. Aufgebaut auf der MCP-Spezifikation 2025-06-18, bietet dieser Server umfassende Tool-Schemas und Echtzeit-Projektzugriff für intelligente PCB-Design-Workflows.
### PCBs mit natürlicher Sprache designen
Beschreibe was du bauen möchtest — und lass die KI die EDA-Arbeit übernehmen. Bauteile platzieren, eigene Symbole und Footprints erstellen, Verbindungen routen, Prüfungen ausführen und Fertigungsdateien exportieren — alles im Gespräch mit deinem KI-Assistenten.
### Was es heute kann
- Projektanlage, Schaltplan-Bearbeitung, Bauteil-Platzierung, Routing, DRC/ERC, Export
- **Eigene Symbole und Footprints generieren** — auch für Module die in KiCAD-Standardbibliotheken fehlen
- **Eigene Bibliotheksverwaltung** — einmal erstellt, in jedem Projekt wiederverwendbar
- **JLCPCB-Integration** — Bauteilkatalog mit Preisen und Lagerbestand
- **Freerouting-Integration** — automatisches PCB-Routing via Java/Docker
- **Visuelles Feedback** — Snapshots und Session-Logs für Nachvollziehbarkeit
- **Plattformübergreifend** — Windows, Linux, macOS
### Schnellstart
1. [KiCAD 9.0+](https://www.kicad.org/download/) installieren
2. [Node.js 18+](https://nodejs.org/) und [Python 3.11+](https://www.python.org/) installieren
3. Klonen und bauen:
```bash
git clone https://github.com/mixelpixx/KiCAD-MCP-Server.git
cd KiCAD-MCP-Server
npm install
npm run build
```
4. Claude Desktop konfigurieren — siehe [Plattform-Anleitung](../docs/PLATFORM_GUIDE.md)
### Dokumentation
- [**Vollständige README**](../README.md) — komplette Dokumentation
- [Schnellstart (Router Tools)](../docs/ROUTER_QUICK_START.md) — erste Schritte
- [Werkzeug-Übersicht](../docs/TOOL_INVENTORY.md) — alle verfügbaren Werkzeuge
- [Schaltplan-Werkzeuge](../docs/SCHEMATIC_TOOLS_REFERENCE.md)
- [Routing-Werkzeuge](../docs/ROUTING_TOOLS_REFERENCE.md)
- [Footprint & Symbol erstellen](../docs/FOOTPRINT_SYMBOL_CREATOR_GUIDE.md)
- [JLCPCB-Anleitung](../docs/JLCPCB_USAGE_GUIDE.md)
- [Plattform-Anleitung](../docs/PLATFORM_GUIDE.md)
- [Changelog](../CHANGELOG.md)
### Community
- [Diskussionen](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — Fragen, Ideen, Projekte zeigen
- [Issues](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — Fehler und Feature-Wünsche
- [Mitwirken](../CONTRIBUTING.md)
### KI-Hinweis
> **Entwickelt mit KI-Unterstützung**
> Dieses Projekt wurde unter Einsatz von KI-gestützten Entwicklungswerkzeugen (GitHub Copilot, Claude) erstellt.
> Sämtlicher Code wurde von den Maintainern geprüft, getestet und integriert.
> KI-Werkzeuge dienten der Entwicklungsbeschleunigung — kreative Entscheidungen, Architektur und Verantwortung liegen ausschließlich bei den Autoren.
### Haftungsausschluss
> **Keine Haftung — Nutzung auf eigene Verantwortung**
>
> Dieses Projekt wird ohne jegliche Gewährleistung bereitgestellt — weder ausdrücklich noch stillschweigend. Die Autoren und Mitwirkenden übernehmen keinerlei Haftung für Schäden jeder Art, die durch die Nutzung oder Nichtnutzung dieser Software entstehen, einschließlich aber nicht beschränkt auf:
>
> - Fehler in erzeugten Schaltplänen, PCB-Layouts oder Fertigungsdateien
> - Schäden an Hardware, Bauteilen oder Geräten durch fehlerhafte Designs
> - Finanzielle Verluste durch Fehlproduktionen oder Fehlerbestellungen
> - Datenverlust oder Beschädigung von KiCAD-Projektdateien
>
> KI-generierte Design-Vorschläge ersetzen keine qualifizierte ingenieurtechnische Prüfung. Sicherheitskritische Anwendungen (Medizintechnik, Luftfahrt, Automotive o.ä.) erfordern zwingend eine unabhängige Fachprüfung.
>
> Dieses Projekt steht unter der MIT-Lizenz — die Lizenz schließt ebenfalls jede Haftung aus.
<div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div>
---
## 中文
**KiCAD MCP Server** 是一个模型上下文协议MCP服务器使 Claude 等 AI 助手能够与 KiCAD 交互,实现 PCB 设计自动化。本服务器基于 MCP 2025-06-18 规范构建,为智能 PCB 设计工作流提供全面的工具模式和实时项目状态访问。
### 用自然语言设计 PCB
描述你想构建的内容 — 让 AI 处理 EDA 工作。放置元件、创建自定义符号和封装、布线、运行检查并导出生产文件 — 全程通过与 AI 助手对话完成。
### 当前功能
- 项目创建、原理图编辑、元件放置、布线、DRC/ERC、导出
- **自定义符号和封装生成** — 适用于标准 KiCAD 库中未收录的模块
- **个人库管理** — 一次创建,跨项目复用
- **JLCPCB 集成** — 包含价格和库存数据的元件目录
- **Freerouting 集成** — 通过 Java/Docker 实现自动 PCB 布线
- **可视化反馈** — 快照和会话日志,便于追溯
- **跨平台** — Windows、Linux、macOS
### 快速开始
1. 安装 [KiCAD 9.0+](https://www.kicad.org/download/)
2. 安装 [Node.js 18+](https://nodejs.org/) 和 [Python 3.11+](https://www.python.org/)
3. 克隆并构建:
```bash
git clone https://github.com/mixelpixx/KiCAD-MCP-Server.git
cd KiCAD-MCP-Server
npm install
npm run build
```
4. 配置 Claude Desktop — 参见 [平台指南](../docs/PLATFORM_GUIDE.md)
### 文档
- [**完整 README**](../README.md) — 完整文档
- [快速开始(路由工具)](../docs/ROUTER_QUICK_START.md) — 入门指引
- [工具清单](../docs/TOOL_INVENTORY.md) — 所有可用工具
- [原理图工具参考](../docs/SCHEMATIC_TOOLS_REFERENCE.md)
- [布线工具参考](../docs/ROUTING_TOOLS_REFERENCE.md)
- [封装与符号创建指南](../docs/FOOTPRINT_SYMBOL_CREATOR_GUIDE.md)
- [JLCPCB 使用指南](../docs/JLCPCB_USAGE_GUIDE.md)
- [平台指南](../docs/PLATFORM_GUIDE.md)
- [更新日志](../CHANGELOG.md)
### 社区
- [讨论区](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — 问题、想法、展示项目
- [问题反馈](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — 错误报告和功能请求
- [贡献指南](../CONTRIBUTING.md)
### AI 声明
> **借助 AI 辅助开发**
> 本项目在 AI 辅助编码工具GitHub Copilot、Claude的支持下开发完成。
> 所有代码均经过维护者的审查、测试和集成。
> AI 工具用于加速开发 — 创意决策、架构设计和责任归属完全由作者承担。
### 免责声明
> **不提供任何保证 — 使用风险自负**
>
> 本项目按现状提供,不附带任何明示或暗示的保证。作者和贡献者对因使用或无法使用本软件而造成的任何类型的损害不承担任何责任,包括但不限于:
>
> - 生成的原理图、PCB 布局或生产文件中的错误
> - 因设计错误导致的硬件、元件或设备损坏
> - 因生产错误或错误订单造成的经济损失
> - KiCAD 项目文件的数据丢失或损坏
>
> AI 生成的设计建议不能替代专业工程师审查。安全关键型应用(医疗、航空航天、汽车等)必须进行独立的专业验证。
>
> 本项目采用 MIT 许可证 — 该许可证同样排除一切责任。
<div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div>

119
.github/README.zh.md vendored Normal file
View File

@@ -0,0 +1,119 @@
<a name="top"></a>
<div align="center">
<img src="../resources/images/KiCAD-MCP-Server_only_css.svg" alt="KiCAD-MCP-Server Logo" height="240" />
# KiCAD MCP Server
[🇺🇸 **English** (EN)](README.md) &nbsp;&nbsp; [🇩🇪 **Deutsch** (DE)](README.de.md) &nbsp;&nbsp; [🇨🇳 **中文** (ZH)](#)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](../LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](../docs/PLATFORM_GUIDE.md)
[![KiCAD](https://img.shields.io/badge/KiCAD-9.0+-green.svg)](https://www.kicad.org/)
[![Stars](https://img.shields.io/github/stars/mixelpixx/KiCAD-MCP-Server.svg)](https://github.com/mixelpixx/KiCAD-MCP-Server/stargazers)
[![Discussions](https://img.shields.io/badge/community-Discussions-orange.svg)](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions)
</div>
<!-- prettier-ignore-start -->
<div align="center">
#### 我们的新论坛已上线https://forum.orchis.ai — 有问题?有建议?想展示你的作品?
</div>
<!-- prettier-ignore-end -->
#
**KiCAD MCP Server** 是一个模型上下文协议MCP服务器使 Claude 等 AI 助手能够与 KiCAD 交互,实现 PCB 设计自动化。本服务器基于 MCP 2025-06-18 规范构建,为智能 PCB 设计工作流提供全面的工具模式和实时项目状态访问。
### 用自然语言设计 PCB
描述你想构建的内容 — 让 AI 处理 EDA 工作。放置元件、创建自定义符号和封装、布线、运行检查并导出生产文件 — 全程通过与 AI 助手对话完成。
### 当前功能
- 项目创建、原理图编辑、元件放置、布线、DRC/ERC、导出
- **自定义符号和封装生成** — 适用于标准 KiCAD 库中未收录的模块
- **个人库管理** — 一次创建,跨项目复用
- **JLCPCB 集成** — 包含价格和库存数据的元件目录
- **Freerouting 集成** — 通过 Java/Docker 实现自动 PCB 布线
- **可视化反馈** — 快照和会话日志,便于追溯
- **跨平台** — Windows、Linux、macOS
### 快速开始
1. 安装 [KiCAD 9.0+](https://www.kicad.org/download/)
2. 安装 [Node.js 18+](https://nodejs.org/) 和 [Python 3.11+](https://www.python.org/)
3. 克隆并构建:
```bash
git clone https://github.com/mixelpixx/KiCAD-MCP-Server.git
cd KiCAD-MCP-Server
npm install
npm run build
```
4. 配置 AI 客户端 — 参见 [平台指南](../docs/PLATFORM_GUIDE.md)
### GitHub CopilotVS Code
复制配置模板:
```bash
cp config/vscode-mcp.example.json .vscode/mcp.json
```
VS Code 会自动检测 `.vscode/mcp.json` 并注册服务器。模板使用 `${workspaceFolder}`,无需修改路径。
### Claude Desktop
编辑配置文件:
- **Windows** `%APPDATA%\Claude\claude_desktop_config.json`
- **macOS/Linux** `~/.config/claude/claude_desktop_config.json`
示例配置:`config/windows-config.example.json``config/macos-config.example.json`
### 文档
- [**完整 README**](../README.md) — 完整文档
- [快速开始(路由工具)](../docs/ROUTER_QUICK_START.md) — 入门指引
- [工具清单](../docs/TOOL_INVENTORY.md) — 所有可用工具
- [原理图工具参考](../docs/SCHEMATIC_TOOLS_REFERENCE.md)
- [布线工具参考](../docs/ROUTING_TOOLS_REFERENCE.md)
- [封装与符号创建指南](../docs/FOOTPRINT_SYMBOL_CREATOR_GUIDE.md)
- [JLCPCB 使用指南](../docs/JLCPCB_USAGE_GUIDE.md)
- [平台指南](../docs/PLATFORM_GUIDE.md)
- [更新日志](../CHANGELOG.md)
### 社区
- [讨论区](https://github.com/mixelpixx/KiCAD-MCP-Server/discussions) — 问题、想法、展示项目
- [问题反馈](https://github.com/mixelpixx/KiCAD-MCP-Server/issues) — 错误报告和功能请求
- [贡献指南](../CONTRIBUTING.md)
### AI 声明
> **借助 AI 辅助开发**
> 本项目在 AI 辅助编码工具GitHub Copilot、Claude的支持下开发完成。
> 所有代码均经过维护者的审查、测试和集成。
> AI 工具用于加速开发 — 创意决策、架构设计和责任归属完全由作者承担。
### 免责声明
> **不提供任何保证 — 使用风险自负**
>
> 本项目按现状提供,不附带任何明示或暗示的保证。作者和贡献者对因使用或无法使用本软件而造成的任何类型的损害不承担任何责任,包括但不限于:
>
> - 生成的原理图、PCB 布局或生产文件中的错误
> - 因设计错误导致的硬件、元件或设备损坏
> - 因生产错误或错误订单造成的经济损失
> - KiCAD 项目文件的数据丢失或损坏
>
> AI 生成的设计建议不能替代专业工程师审查。安全关键型应用(医疗、航空航天、汽车等)必须进行独立的专业验证。
>
> 本项目采用 MIT 许可证 — 该许可证同样排除一切责任。
<div align="right"><a href="#top"><img src="https://img.shields.io/badge/%E2%96%B4_top-grey?style=flat-square" alt="back to top"></a></div>

3
.gitignore vendored
View File

@@ -94,3 +94,6 @@ windows-mcp-config.json
# Personal notes / local contributions (not for upstream) # Personal notes / local contributions (not for upstream)
myContribution/ myContribution/
CLAUDE.md CLAUDE.md
inspect-tools.mjs
resources/images/icon_b64.txt

View File

@@ -2,3 +2,4 @@ coverage.xml
htmlcov/ htmlcov/
data/ data/
*.kicad_* *.kicad_*
.github/*.md

View File

@@ -734,6 +734,18 @@ which python3 # Example output: /usr/bin/python3
python3 -c "import pcbnew; print(pcbnew.GetBuildVersion())" # Verify pcbnew access python3 -c "import pcbnew; print(pcbnew.GetBuildVersion())" # Verify pcbnew access
``` ```
### GitHub Copilot (VS Code)
Copy the template to your workspace:
```bash
cp config/vscode-mcp.example.json .vscode/mcp.json
```
VS Code will auto-detect `.vscode/mcp.json` and register the server. The template uses `${workspaceFolder}` so no path editing is needed.
> **Note:** `.vscode/mcp.json` is listed in `.gitignore` — your local configuration won't be committed.
### Cline (VSCode) ### Cline (VSCode)
Edit: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` Edit: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`

View File

@@ -0,0 +1,16 @@
{
"servers": {
"KiCAD-MCP-Server": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/dist/index.js"],
"env": {
"NODE_ENV": "production",
"PYTHONPATH": "C:\\Program Files\\KiCad\\9.0\\bin\\Lib\\site-packages",
"LOG_LEVEL": "info",
"KICAD_AUTO_LAUNCH": "false",
"KICAD_MCP_DEV": "0"
}
}
}
}

View File

@@ -1,16 +1,18 @@
# KiCAD MCP Server - Complete Tool Inventory # KiCAD MCP Server - Complete Tool Inventory
**Version:** 2.2.3 **Version:** 2.1.0-alpha
**Total Tools:** 124 (18 direct + 65 routed + 4 router + 37 additional) **Total Tools:** 137 (verifiziert via VS Code MCP Discovery Log)
**Last Updated:** 2026-04-20 **Last Updated:** 2026-05-02
## How Tools Are Organized ## How Tools Are Organized
The server uses a **router pattern** to reduce AI context usage. Tools fall into three groups: Tools are registered directly via `server.tool()`
- **Direct tools** - Always visible to the AI. High-frequency operations used in most sessions. The `Access` column below uses legacy labels from when a router pattern was planned:
- **Routed tools** - Organized into categories. Discovered via the router tools (`list_tool_categories`, `get_category_tools`, `search_tools`) and invoked via `execute_tool`.
- **Additional tools** - Registered directly (always visible) but not part of the router categories. - **Direct** — High-frequency tools, originally intended as always-visible
- **Routed** — Originally planned for router dispatch; now also registered directly
- **Additional** — Registered directly (always visible)
--- ---
@@ -130,64 +132,86 @@ _Source: `src/tools/export.ts`_
--- ---
## Schematic (29 tools) ## Schematic (43 tools)
_Source: `src/tools/schematic.ts`_ _Source: `src/tools/schematic.ts`_
### Component Operations ### Component Operations (10)
| Tool | Description | Access | | Tool | Description | Access |
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------ | | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------ |
| `add_schematic_component` | Add component to schematic (symbol from library) | Direct | | `add_schematic_component` | Add component to schematic (symbol from library) | Direct |
| `delete_schematic_component` | Remove component from schematic | Additional | | `delete_schematic_component` | Remove component from schematic | Additional |
| `edit_schematic_component` | Edit footprint, value, reference, label positions, and **arbitrary custom properties** (MPN, Manufacturer, DigiKey, …) | Additional | | `edit_schematic_component` | Edit footprint, value, reference, label positions, and arbitrary custom properties (MPN, Manufacturer, DigiKey, …) | Additional |
| `set_schematic_component_property` | Add or update a single custom property (BOM/sourcing field) on a component | Additional | | `set_schematic_component_property` | Add or update a single custom property (BOM/sourcing field) on a component | Additional |
| `remove_schematic_component_property` | Delete a single custom property from a component | Additional | | `remove_schematic_component_property` | Delete a single custom property from a component | Additional |
| `get_schematic_component` | Get component info: built-in fields + all custom properties + label positions | Additional | | `get_schematic_component` | Get component info: built-in fields + all custom properties + label positions | Additional |
| `list_schematic_components` | List all components in schematic | Direct | | `list_schematic_components` | List all components in schematic | Direct |
| `move_schematic_component` | Move component to new position | Routed (schematic) | | `move_schematic_component` | Move component to new position | Routed (schematic) |
| `rotate_schematic_component` | Rotate component | Routed (schematic) | | `rotate_schematic_component` | Rotate component | Routed (schematic) |
| `annotate_schematic` | Auto-annotate reference designators | Direct | | `annotate_schematic` | Auto-annotate reference designators | Direct |
### Wiring and Connections ### Wiring and Connections (10)
| Tool | Description | Access | | Tool | Description | Access |
| ----------------------------- | ------------------------------------------------ | ------------------ | | ----------------------------- | ---------------------------------------------------- | ------------------ |
| `add_wire` | Add wire connection between two points | Routed (schematic) | | `add_schematic_wire` | Add wire segment between two points | Routed (schematic) |
| `delete_schematic_wire` | Delete wire segment | Routed (schematic) | | `delete_schematic_wire` | Delete wire segment | Routed (schematic) |
| `add_schematic_connection` | Connect two component pins with wire | Routed (schematic) | | `add_schematic_net_label` | Add net label to schematic | Direct |
| `add_schematic_net_label` | Add net label to schematic | Direct | | `delete_schematic_net_label` | Delete net label | Routed (schematic) |
| `delete_schematic_net_label` | Delete net label | Routed (schematic) | | `add_no_connect` | Add no-connect flag (X marker) to an unconnected pin | Direct |
| `connect_to_net` | Connect component pin to named net | Direct | | `move_schematic_net_label` | Move net label to new position | Routed (schematic) |
| `connect_passthrough` | Connect all matching pins between two connectors | Direct | | `connect_to_net` | Connect component pin to named net | Direct |
| `get_schematic_pin_locations` | Get pin locations for a component | Additional | | `connect_passthrough` | Connect all matching pins between two connectors | Direct |
| `get_schematic_pin_locations` | Get pin locations for a component | Additional |
| `get_wire_connections` | Get all connections at a wire endpoint | Additional |
### Net Analysis ### Hierarchical Schematics (2)
| Tool | Description | Access | | Tool | Description | Access |
| ----------------------- | ----------------------------- | ------------------ | | ---------------------------------- | -------------------------------------------------- | ------------------ |
| `get_net_connections` | Get all connections for a net | Routed (schematic) | | `add_schematic_hierarchical_label` | Add hierarchical label for multi-sheet connections | Routed (schematic) |
| `list_schematic_nets` | List all nets in schematic | Routed (schematic) | | `add_sheet_pin` | Add a sheet pin to a hierarchical sheet symbol | Routed (schematic) |
| `list_schematic_wires` | List all wires in schematic | Routed (schematic) |
| `list_schematic_labels` | List all net labels | Routed (schematic) |
### Text Annotations ### Net Analysis (5)
| Tool | Description | Access |
| ----------------------- | ------------------------------------ | ------------------ |
| `get_net_connections` | Get all connections for a net | Routed (schematic) |
| `get_net_at_point` | Get the net name at an XY coordinate | Additional |
| `list_schematic_nets` | List all nets in schematic | Routed (schematic) |
| `list_schematic_wires` | List all wires in schematic | Routed (schematic) |
| `list_schematic_labels` | List all net labels | Routed (schematic) |
### Text Annotations (2)
| Tool | Description | Access | | Tool | Description | Access |
| ---------------------- | ------------------------------------------------ | ------------------ | | ---------------------- | ------------------------------------------------ | ------------------ |
| `add_schematic_text` | Add free-form text annotation to schematic | Routed (schematic) | | `add_schematic_text` | Add free-form text annotation to schematic | Routed (schematic) |
| `list_schematic_texts` | List all text annotations (with optional filter) | Routed (schematic) | | `list_schematic_texts` | List all text annotations (with optional filter) | Routed (schematic) |
### Schematic Creation and Export ### Visual / Geometry Helpers (8)
| Tool | Description | Access | | Tool | Description | Access |
| ---------------------- | -------------------------------- | ------------------ | | ----------------------------- | --------------------------------------------------------- | ------------------ |
| `create_schematic` | Create a new schematic file | Routed (schematic) | | `get_schematic_view` | Render schematic as image (PNG/SVG) | Routed (schematic) |
| `get_schematic_view` | Get schematic as image (PNG/SVG) | Routed (schematic) | | `get_schematic_view_region` | Render a specific region of the schematic as image | Additional |
| `export_schematic_svg` | Export schematic to SVG | Routed (schematic) | | `find_overlapping_elements` | Find schematic elements that visually overlap | Additional |
| `export_schematic_pdf` | Export schematic to PDF | Routed (schematic) | | `get_elements_in_region` | Get all elements inside an XY bounding box | Additional |
| `find_wires_crossing_symbols` | Find wires that cross through symbol bodies (DRC helper) | Additional |
| `list_floating_labels` | List net labels not connected to any wire | Additional |
| `find_orphaned_wires` | Find wire segments not connected at one or both ends | Additional |
| `snap_to_grid` | Snap an XY coordinate to the nearest schematic grid point | Additional |
### Validation and Synchronization ### Schematic Creation and Export (3)
| Tool | Description | Access |
| ---------------------- | --------------------------- | ------------------ |
| `create_schematic` | Create a new schematic file | Routed (schematic) |
| `export_schematic_svg` | Export schematic to SVG | Routed (schematic) |
| `export_schematic_pdf` | Export schematic to PDF | Routed (schematic) |
### Validation and Synchronization (3)
| Tool | Description | Access | | Tool | Description | Access |
| ------------------------- | ----------------------------------------------------- | ------------------ | | ------------------------- | ----------------------------------------------------- | ------------------ |
@@ -298,30 +322,29 @@ _Source: `src/tools/ui.ts`_
--- ---
## Router Tools (4 tools) ## Router / Discovery Tools (3 tools)
_Source: `src/tools/router.ts`_ _Source: `src/tools/router.ts`_
These meta-tools provide discovery and execution of routed tools: Registriert via `registerRouterTools()` in `src/server.ts`. Ermöglichen Tool-Discovery durch den LLM.
| Tool | Description | | Tool | Description | Access |
| ---------------------- | ------------------------------------ | | ---------------------- | ------------------------------------ | ------ |
| `list_tool_categories` | Browse all available tool categories | | `list_tool_categories` | Browse all available tool categories | Direct |
| `get_category_tools` | View tools in a specific category | | `get_category_tools` | View tools in a specific category | Direct |
| `search_tools` | Find tools by keyword | | `search_tools` | Find tools by keyword | Direct |
| `execute_tool` | Run any routed tool with parameters |
--- ---
## Summary by Access Type ## Summary by Access Type
| Access Type | Count | Description | | Access Type | Count | Description |
| ----------- | ------- | --------------------------------------------------- | | -------------------- | ------- | ---------------------------------------- |
| Direct | 18 | Always visible, no router needed | | Direct | 21 | Always visible |
| Routed | 65 | Discovered via router, invoked via `execute_tool` | | Routed | 72 | Always visible (registered directly) |
| Router | 4 | Meta-tools for discovering and running routed tools | | Additional | 44 | Always visible, registered directly |
| Additional | 35 | Always visible, registered directly | | Router/Discovery | 3 | Tool-Discovery (`router.ts`, registered) |
| **Total** | **122** | | | **Total registered** | **137** | Verifiziert via VS Code MCP Discovery |
## Summary by Category ## Summary by Category
@@ -333,7 +356,7 @@ These meta-tools provide discovery and execution of routed tools:
| Routing | 13 | | Routing | 13 |
| Design Rules / DRC | 8 | | Design Rules / DRC | 8 |
| Export | 8 | | Export | 8 |
| Schematic | 27 | | Schematic | 43 |
| Footprint Libraries | 4 | | Footprint Libraries | 4 |
| Symbol Libraries | 4 | | Symbol Libraries | 4 |
| Footprint Creator | 4 | | Footprint Creator | 4 |
@@ -342,11 +365,11 @@ These meta-tools provide discovery and execution of routed tools:
| JLCPCB Integration | 5 | | JLCPCB Integration | 5 |
| Freerouting | 4 | | Freerouting | 4 |
| UI Management | 2 | | UI Management | 2 |
| Router | 4 | | Router / Discovery | 3 |
| **Total** | **122** | | **Total registered** | **137** |
> **Verified:** VS Code MCP Discovery Log meldet **137** registrierte Tools.
## Token Impact ## Token Impact
**Before Router Pattern:** All 122 tools in context = ~80K+ tokens Alle 137 registrierten Tools sind stets für den LLM sichtbar. Die Discovery-Tools in `router.ts` ermöglichen dem Modell, Tools nach Kategorie oder Stichwort zu durchsuchen.
**With Router Pattern:** 18 direct + 35 additional + 4 router = 57 always-visible tools
**On-Demand:** 65 routed tools loaded only when their category is requested

View File

@@ -391,6 +391,7 @@ class KiCADInterface:
"get_schematic_component": self._handle_get_schematic_component, "get_schematic_component": self._handle_get_schematic_component,
"add_schematic_wire": self._handle_add_schematic_wire, "add_schematic_wire": self._handle_add_schematic_wire,
"add_schematic_net_label": self._handle_add_schematic_net_label, "add_schematic_net_label": self._handle_add_schematic_net_label,
"add_no_connect": self._handle_add_no_connect,
"connect_to_net": self._handle_connect_to_net, "connect_to_net": self._handle_connect_to_net,
"connect_passthrough": self._handle_connect_passthrough, "connect_passthrough": self._handle_connect_passthrough,
"get_schematic_pin_locations": self._handle_get_schematic_pin_locations, "get_schematic_pin_locations": self._handle_get_schematic_pin_locations,
@@ -1996,6 +1997,66 @@ class KiCADInterface:
"errorDetails": traceback.format_exc(), "errorDetails": traceback.format_exc(),
} }
def _handle_add_no_connect(self, params: Dict[str, Any]) -> Dict[str, Any]:
"""Add a no-connect flag (X marker) to an unconnected pin in the schematic."""
logger.info("Adding no-connect flag to schematic")
try:
from pathlib import Path
from commands.pin_locator import PinLocator
from commands.wire_manager import WireManager
schematic_path = params.get("schematicPath")
position = params.get("position")
component_ref = params.get("componentRef")
pin_number = params.get("pinNumber")
if not schematic_path:
return {"success": False, "message": "schematicPath is required"}
# Snap to pin endpoint when componentRef + pinNumber are provided
snapped_to_pin = None
if component_ref and pin_number is not None:
locator = PinLocator()
pin_loc = locator.get_pin_location(
Path(schematic_path), component_ref, str(pin_number)
)
if pin_loc is None:
return {
"success": False,
"message": f"Could not locate pin {pin_number} on {component_ref}",
}
position = pin_loc
snapped_to_pin = {"component": component_ref, "pin": str(pin_number)}
elif position is None:
return {
"success": False,
"message": "Provide either position [x, y] or componentRef + pinNumber",
}
success = WireManager.add_no_connect(Path(schematic_path), position)
if success:
result = {
"success": True,
"message": f"Added no-connect flag at {position}",
"actual_position": position,
}
if snapped_to_pin:
result["snapped_to_pin"] = snapped_to_pin
return result
else:
return {"success": False, "message": "Failed to add no-connect flag"}
except Exception as e:
import traceback
logger.error(f"Error adding no-connect: {e}")
return {
"success": False,
"message": str(e),
"errorDetails": traceback.format_exc(),
}
def _handle_connect_to_net(self, params: Dict[str, Any]) -> Dict[str, Any]: def _handle_connect_to_net(self, params: Dict[str, Any]) -> Dict[str, Any]:
"""Connect a component pin to a named net using wire stub and label, """Connect a component pin to a named net using wire stub and label,
and also assign the net to the corresponding pad on the PCB board so and also assign the net to the corresponding pad on the PCB board so
@@ -2149,9 +2210,7 @@ class KiCADInterface:
f"Assigned net '{net_name}' to pad {component_ref}/{pin_name} on PCB" f"Assigned net '{net_name}' to pad {component_ref}/{pin_name} on PCB"
) )
return True return True
logger.warning( logger.warning(f"Pad '{pin_name}' not found on footprint '{component_ref}'")
f"Pad '{pin_name}' not found on footprint '{component_ref}'"
)
return False return False
logger.warning(f"Footprint '{component_ref}' not found on board") logger.warning(f"Footprint '{component_ref}' not found on board")
@@ -2741,8 +2800,8 @@ class KiCADInterface:
new_mirror_y = old_mirror_y new_mirror_y = old_mirror_y
effective_mirror = "x" if old_mirror_x else ("y" if old_mirror_y else None) effective_mirror = "x" if old_mirror_x else ("y" if old_mirror_y else None)
else: else:
new_mirror_x = (mirror == "x") new_mirror_x = mirror == "x"
new_mirror_y = (mirror == "y") new_mirror_y = mirror == "y"
effective_mirror = mirror effective_mirror = mirror
# Compute pin world positions before and after the transform # Compute pin world positions before and after the transform
@@ -2767,7 +2826,9 @@ class KiCADInterface:
drag_summary = WireDragger.drag_wires(sch_data, old_to_new) drag_summary = WireDragger.drag_wires(sch_data, old_to_new)
# Update the symbol's rotation and mirror token in sexpdata # Update the symbol's rotation and mirror token in sexpdata
WireDragger.update_symbol_rotation_mirror(sch_data, reference, float(angle), effective_mirror) WireDragger.update_symbol_rotation_mirror(
sch_data, reference, float(angle), effective_mirror
)
WireManager.sync_junctions(sch_data) WireManager.sync_junctions(sch_data)

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -214,9 +214,7 @@ export class KiCADMcpServer {
logger.info("Registering KiCAD tools, resources, and prompts..."); logger.info("Registering KiCAD tools, resources, and prompts...");
// Register router tools FIRST (for tool discovery and execution) // Register router tools FIRST (for tool discovery and execution)
// NOTE: Router disabled — causes Claude to hallucinate tool schemas via search_tools/execute_tool. registerRouterTools(this.server, this.callKicadScript.bind(this));
// All tools are registered directly below and are immediately visible to Claude.
// registerRouterTools(this.server, this.callKicadScript.bind(this));
// Register all tools // Register all tools
registerProjectTools(this.server, this.callKicadScript.bind(this)); registerProjectTools(this.server, this.callKicadScript.bind(this));
@@ -248,7 +246,6 @@ export class KiCADMcpServer {
registerFootprintPrompts(this.server); registerFootprintPrompts(this.server);
logger.info("All KiCAD tools, resources, and prompts registered"); logger.info("All KiCAD tools, resources, and prompts registered");
logger.info("Router pattern enabled: 4 router tools + direct tools for discovery");
} }
/** /**

View File

@@ -25,6 +25,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"set_board_size", "set_board_size",
"Set the PCB board dimensions (width and height) in the specified unit.",
{ {
width: z.number().describe("Board width"), width: z.number().describe("Board width"),
height: z.number().describe("Board height"), height: z.number().describe("Board height"),
@@ -54,6 +55,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_layer", "add_layer",
"Add a new copper or technical layer to the PCB stackup.",
{ {
name: z.string().describe("Layer name"), name: z.string().describe("Layer name"),
type: z.enum(["copper", "technical", "user", "signal"]).describe("Layer type"), type: z.enum(["copper", "technical", "user", "signal"]).describe("Layer type"),
@@ -85,6 +87,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"set_active_layer", "set_active_layer",
"Set the currently active PCB layer by name (e.g. F.Cu, B.Cu).",
{ {
layer: z.string().describe("Layer name to set as active"), layer: z.string().describe("Layer name to set as active"),
}, },
@@ -106,42 +109,53 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
// Get Board Info Tool // Get Board Info Tool
// ------------------------------------------------------ // ------------------------------------------------------
server.tool("get_board_info", {}, async () => { server.tool(
logger.debug("Getting board information"); "get_board_info",
const result = await callKicadScript("get_board_info", {}); "Retrieve general information about the current PCB board (dimensions, layer count, DRC status).",
{},
async () => {
logger.debug("Getting board information");
const result = await callKicadScript("get_board_info", {});
return { return {
content: [ content: [
{ {
type: "text", type: "text",
text: JSON.stringify(result), text: JSON.stringify(result),
}, },
], ],
}; };
}); },
);
// ------------------------------------------------------ // ------------------------------------------------------
// Get Layer List Tool // Get Layer List Tool
// ------------------------------------------------------ // ------------------------------------------------------
server.tool("get_layer_list", {}, async () => { server.tool(
logger.debug("Getting layer list"); "get_layer_list",
const result = await callKicadScript("get_layer_list", {}); "Return the list of all layers defined in the current PCB board.",
{},
async () => {
logger.debug("Getting layer list");
const result = await callKicadScript("get_layer_list", {});
return { return {
content: [ content: [
{ {
type: "text", type: "text",
text: JSON.stringify(result), text: JSON.stringify(result),
}, },
], ],
}; };
}); },
);
// ------------------------------------------------------ // ------------------------------------------------------
// Add Board Outline Tool // Add Board Outline Tool
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_board_outline", "add_board_outline",
"Draw the PCB board outline (Edge.Cuts layer) as a rectangle, rounded rectangle, circle or polygon.",
{ {
shape: z shape: z
.enum(["rectangle", "circle", "polygon", "rounded_rectangle"]) .enum(["rectangle", "circle", "polygon", "rounded_rectangle"])
@@ -196,6 +210,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_mounting_hole", "add_mounting_hole",
"Place a mounting hole (NPTH or PTH) at the specified position on the PCB.",
{ {
position: z position: z
.object({ .object({
@@ -231,6 +246,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_board_text", "add_board_text",
"Add a text label to a PCB layer (e.g. silkscreen, fab, courtyard).",
{ {
text: z.string().describe("Text content"), text: z.string().describe("Text content"),
position: z position: z
@@ -274,6 +290,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_zone", "add_zone",
"Create a copper fill zone (pour) on a PCB layer for a specified net.",
{ {
layer: z.string().describe("Layer for the zone"), layer: z.string().describe("Layer for the zone"),
net: z.string().describe("Net name for the zone"), net: z.string().describe("Net name for the zone"),
@@ -321,6 +338,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_board_extents", "get_board_extents",
"Return the bounding box (min/max X and Y) of all objects on the current PCB board.",
{ {
unit: z.enum(["mm", "inch"]).optional().describe("Unit of measurement for the result"), unit: z.enum(["mm", "inch"]).optional().describe("Unit of measurement for the result"),
}, },
@@ -344,6 +362,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_board_2d_view", "get_board_2d_view",
"Render a 2D image of the current PCB board and return it as PNG, JPG or SVG.",
{ {
layers: z.array(z.string()).optional().describe("Optional array of layer names to include"), layers: z.array(z.string()).optional().describe("Optional array of layer names to include"),
width: z.number().optional().describe("Optional width of the image in pixels"), width: z.number().optional().describe("Optional width of the image in pixels"),

View File

@@ -23,6 +23,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"place_component", "place_component",
"Place a footprint component onto the PCB at the specified position. Optionally set reference, value, footprint, rotation and layer.",
{ {
componentId: z componentId: z
.string() .string()
@@ -77,6 +78,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"move_component", "move_component",
"Move a PCB component to a new position. Optionally update rotation or flip to a different copper layer.",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'R5')"), reference: z.string().describe("Reference designator of the component (e.g., 'R5')"),
position: z position: z
@@ -119,6 +121,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"rotate_component", "rotate_component",
"Rotate a PCB component to an absolute angle in degrees.",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'R5')"), reference: z.string().describe("Reference designator of the component (e.g., 'R5')"),
angle: z.number().describe("Rotation angle in degrees (absolute, not relative)"), angle: z.number().describe("Rotation angle in degrees (absolute, not relative)"),
@@ -146,6 +149,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"delete_component", "delete_component",
"Remove a component from the PCB by its reference designator.",
{ {
reference: z reference: z
.string() .string()
@@ -171,6 +175,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"edit_component", "edit_component",
"Edit properties of an existing PCB component (reference, value, footprint).",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'R5')"), reference: z.string().describe("Reference designator of the component (e.g., 'R5')"),
newReference: z.string().optional().describe("Optional new reference designator"), newReference: z.string().optional().describe("Optional new reference designator"),
@@ -202,6 +207,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"find_component", "find_component",
"Search for a PCB component by reference designator or value and return its position and properties.",
{ {
reference: z.string().optional().describe("Reference designator to search for"), reference: z.string().optional().describe("Reference designator to search for"),
value: z.string().optional().describe("Component value to search for"), value: z.string().optional().describe("Component value to search for"),
@@ -231,6 +237,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_component_properties", "get_component_properties",
"Return all properties of a PCB component (position, rotation, layer, value, footprint).",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'R5')"), reference: z.string().describe("Reference designator of the component (e.g., 'R5')"),
}, },
@@ -256,6 +263,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_component_annotation", "add_component_annotation",
"Add a text annotation or comment to a PCB component.",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'R5')"), reference: z.string().describe("Reference designator of the component (e.g., 'R5')"),
annotation: z.string().describe("Annotation or comment text to add"), annotation: z.string().describe("Annotation or comment text to add"),
@@ -288,6 +296,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"group_components", "group_components",
"Group multiple PCB components together by name for easier selection and manipulation.",
{ {
references: z.array(z.string()).describe("Reference designators of components to group"), references: z.array(z.string()).describe("Reference designators of components to group"),
groupName: z.string().describe("Name for the component group"), groupName: z.string().describe("Name for the component group"),
@@ -315,6 +324,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"replace_component", "replace_component",
"Replace an existing PCB component with a different component type, optionally changing footprint and value.",
{ {
reference: z.string().describe("Reference designator of the component to replace"), reference: z.string().describe("Reference designator of the component to replace"),
newComponentId: z.string().describe("ID of the new component to use"), newComponentId: z.string().describe("ID of the new component to use"),
@@ -346,6 +356,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_component_pads", "get_component_pads",
"Return all pads of a PCB component with their positions, net assignments and sizes.",
{ {
reference: z.string().describe("Reference designator of the component (e.g., 'U1')"), reference: z.string().describe("Reference designator of the component (e.g., 'U1')"),
unit: z.enum(["mm", "inch"]).optional().describe("Unit for coordinates (default: mm)"), unit: z.enum(["mm", "inch"]).optional().describe("Unit for coordinates (default: mm)"),
@@ -373,6 +384,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_component_list", "get_component_list",
"Return a list of all components on the PCB, optionally filtered by layer or bounding box region.",
{ {
layer: z.string().optional().describe("Filter by layer (e.g., 'F.Cu', 'B.Cu')"), layer: z.string().optional().describe("Filter by layer (e.g., 'F.Cu', 'B.Cu')"),
boundingBox: z boundingBox: z
@@ -411,6 +423,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_pad_position", "get_pad_position",
"Return the exact XY position of a specific pad on a PCB component. Use this before routing to get accurate start/end coordinates.",
{ {
reference: z.string().describe("Component reference designator (e.g., 'U1')"), reference: z.string().describe("Component reference designator (e.g., 'U1')"),
pad: z.string().describe("Pad number or name (e.g., '1', 'A1')"), pad: z.string().describe("Pad number or name (e.g., '1', 'A1')"),
@@ -440,6 +453,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"place_component_array", "place_component_array",
"Place a rectangular grid array of identical components on the PCB with configurable row/column spacing.",
{ {
componentId: z.string().describe("Component identifier"), componentId: z.string().describe("Component identifier"),
startPosition: z startPosition: z
@@ -500,6 +514,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"align_components", "align_components",
"Align multiple PCB components horizontally, vertically or on a grid with optional spacing.",
{ {
references: z.array(z.string()).describe("Array of component references to align"), references: z.array(z.string()).describe("Array of component references to align"),
alignmentType: z.enum(["horizontal", "vertical", "grid"]).describe("Type of alignment"), alignmentType: z.enum(["horizontal", "vertical", "grid"]).describe("Type of alignment"),
@@ -531,6 +546,7 @@ export function registerComponentTools(server: McpServer, callKicadScript: Comma
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"duplicate_component", "duplicate_component",
"Duplicate an existing PCB component at an offset position, optionally with a new reference designator.",
{ {
reference: z.string().describe("Reference of component to duplicate"), reference: z.string().describe("Reference of component to duplicate"),
offset: z offset: z

View File

@@ -25,6 +25,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"set_design_rules", "set_design_rules",
"Configure PCB design rules: clearance, track width, via dimensions and courtyard requirements.",
{ {
clearance: z.number().optional().describe("Minimum clearance between copper items (mm)"), clearance: z.number().optional().describe("Minimum clearance between copper items (mm)"),
trackWidth: z.number().optional().describe("Default track width (mm)"), trackWidth: z.number().optional().describe("Default track width (mm)"),
@@ -65,25 +66,31 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
// Get Design Rules Tool // Get Design Rules Tool
// ------------------------------------------------------ // ------------------------------------------------------
server.tool("get_design_rules", {}, async () => { server.tool(
logger.debug("Getting design rules"); "get_design_rules",
const result = await callKicadScript("get_design_rules", {}); "Return the current PCB design rules (clearance, track width, via sizes, courtyard settings).",
{},
async () => {
logger.debug("Getting design rules");
const result = await callKicadScript("get_design_rules", {});
return { return {
content: [ content: [
{ {
type: "text", type: "text",
text: JSON.stringify(result), text: JSON.stringify(result),
}, },
], ],
}; };
}); },
);
// ------------------------------------------------------ // ------------------------------------------------------
// Run DRC Tool // Run DRC Tool
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"run_drc", "run_drc",
"Run the KiCAD Design Rule Check (DRC) on the current PCB and return violations. Optionally save the report to a file.",
{ {
reportPath: z.string().optional().describe("Optional path to save the DRC report"), reportPath: z.string().optional().describe("Optional path to save the DRC report"),
}, },
@@ -107,6 +114,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"add_net_class", "add_net_class",
"Create a named net class with specific design rules (clearance, track width, via size) and assign nets to it.",
{ {
name: z.string().describe("Name of the net class"), name: z.string().describe("Name of the net class"),
description: z.string().optional().describe("Optional description of the net class"), description: z.string().optional().describe("Optional description of the net class"),
@@ -170,6 +178,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"assign_net_to_class", "assign_net_to_class",
"Assign a net to an existing net class to apply its specific design rules.",
{ {
net: z.string().describe("Name of the net"), net: z.string().describe("Name of the net"),
netClass: z.string().describe("Name of the net class"), netClass: z.string().describe("Name of the net class"),
@@ -197,6 +206,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"set_layer_constraints", "set_layer_constraints",
"Set per-layer design rule constraints (minimum track width, clearance and via dimensions).",
{ {
layer: z.string().describe("Layer name (e.g., 'F.Cu')"), layer: z.string().describe("Layer name (e.g., 'F.Cu')"),
minTrackWidth: z.number().optional().describe("Minimum track width for this layer (mm)"), minTrackWidth: z.number().optional().describe("Minimum track width for this layer (mm)"),
@@ -230,6 +240,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"check_clearance", "check_clearance",
"Check the actual clearance between two PCB items (track, via, pad, zone or component) and report whether it meets the design rules.",
{ {
item1: z item1: z
.object({ .object({
@@ -289,6 +300,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"get_drc_violations", "get_drc_violations",
"Return the list of current DRC violations on the PCB, optionally filtered by severity (error, warning).",
{ {
severity: z severity: z
.enum(["error", "warning", "all"]) .enum(["error", "warning", "all"])

View File

@@ -25,6 +25,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_gerber", "export_gerber",
"Export PCB Gerber manufacturing files to a directory. Optionally include drill files, map files and choose layer subset.",
{ {
outputDir: z.string().describe("Directory to save Gerber files"), outputDir: z.string().describe("Directory to save Gerber files"),
layers: z layers: z
@@ -73,6 +74,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_pdf", "export_pdf",
"Export the PCB layout as a PDF document, optionally selecting layers, page size and colour mode.",
{ {
outputPath: z.string().describe("Path to save the PDF file"), outputPath: z.string().describe("Path to save the PDF file"),
layers: z layers: z
@@ -112,6 +114,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_svg", "export_svg",
"Export the PCB layout as an SVG vector image, optionally selecting layers and colour mode.",
{ {
outputPath: z.string().describe("Path to save the SVG file"), outputPath: z.string().describe("Path to save the SVG file"),
layers: z layers: z
@@ -146,6 +149,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_3d", "export_3d",
"Export the PCB as a 3D model (STEP, STL, VRML or OBJ) including optional copper, solder mask, silkscreen and component 3D models.",
{ {
outputPath: z.string().describe("Path to save the 3D model file"), outputPath: z.string().describe("Path to save the 3D model file"),
format: z.enum(["STEP", "STL", "VRML", "OBJ"]).describe("3D model format"), format: z.enum(["STEP", "STL", "VRML", "OBJ"]).describe("3D model format"),
@@ -188,6 +192,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_bom", "export_bom",
"Export a Bill of Materials (BOM) from the PCB in CSV, XML, HTML or JSON format.",
{ {
outputPath: z.string().describe("Path to save the BOM file"), outputPath: z.string().describe("Path to save the BOM file"),
format: z.enum(["CSV", "XML", "HTML", "JSON"]).describe("BOM file format"), format: z.enum(["CSV", "XML", "HTML", "JSON"]).describe("BOM file format"),
@@ -255,6 +260,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_position_file", "export_position_file",
"Export a component placement/position file (pick-and-place) for PCB assembly in CSV or ASCII format.",
{ {
outputPath: z.string().describe("Path to save the position file"), outputPath: z.string().describe("Path to save the position file"),
format: z.enum(["CSV", "ASCII"]).optional().describe("File format (default: CSV)"), format: z.enum(["CSV", "ASCII"]).optional().describe("File format (default: CSV)"),
@@ -289,6 +295,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
// ------------------------------------------------------ // ------------------------------------------------------
server.tool( server.tool(
"export_vrml", "export_vrml",
"Export the PCB as a VRML 3D model for use in web viewers or simulation tools.",
{ {
outputPath: z.string().describe("Path to save the VRML file"), outputPath: z.string().describe("Path to save the VRML file"),
includeComponents: z.boolean().optional().describe("Whether to include 3D component models"), includeComponents: z.boolean().optional().describe("Whether to include 3D component models"),

View File

@@ -96,6 +96,7 @@ export const toolCategories: ToolCategory[] = [
"delete_schematic_wire", "delete_schematic_wire",
"add_schematic_net_label", "add_schematic_net_label",
"delete_schematic_net_label", "delete_schematic_net_label",
"add_no_connect",
"connect_to_net", "connect_to_net",
"connect_passthrough", "connect_passthrough",
"get_net_connections", "get_net_connections",

View File

@@ -10,7 +10,6 @@ import { logger } from "../logger.js";
import { import {
getAllCategories, getAllCategories,
getCategory, getCategory,
getToolCategory,
searchTools as registrySearchTools, searchTools as registrySearchTools,
getRegistryStats, getRegistryStats,
} from "./registry.js"; } from "./registry.js";
@@ -18,26 +17,10 @@ import {
// Command function type for KiCAD script calls // Command function type for KiCAD script calls
type CommandFunction = (command: string, params: Record<string, unknown>) => Promise<any>; type CommandFunction = (command: string, params: Record<string, unknown>) => Promise<any>;
// Map to store tool execution handlers
// This will be populated by registerToolHandler()
const toolHandlers = new Map<string, (params: any) => Promise<any>>();
/**
* Register a tool handler for execution via execute_tool
* This should be called by each tool registration function
*/
export function registerToolHandler(
toolName: string,
handler: (params: any) => Promise<any>,
): void {
toolHandlers.set(toolName, handler);
logger.debug(`Registered handler for routed tool: ${toolName}`);
}
/** /**
* Register all router tools with the MCP server * Register all router tools with the MCP server
*/ */
export function registerRouterTools(server: McpServer, callKicadScript: CommandFunction): void { export function registerRouterTools(server: McpServer, _callKicadScript: CommandFunction): void {
logger.info("Registering router tools"); logger.info("Registering router tools");
// ============================================================================ // ============================================================================
@@ -45,6 +28,7 @@ export function registerRouterTools(server: McpServer, callKicadScript: CommandF
// ============================================================================ // ============================================================================
server.tool( server.tool(
"list_tool_categories", "list_tool_categories",
"List all available KiCAD tool categories with their descriptions and tool counts. Use this to discover which tools are available via the router.",
{ {
// No parameters // No parameters
}, },
@@ -82,6 +66,7 @@ export function registerRouterTools(server: McpServer, callKicadScript: CommandF
// ============================================================================ // ============================================================================
server.tool( server.tool(
"get_category_tools", "get_category_tools",
"Return all tools available in a specific category. Use list_tool_categories first to find valid category names.",
{ {
category: z.string().describe("Category name from list_tool_categories"), category: z.string().describe("Category name from list_tool_categories"),
}, },
@@ -133,136 +118,12 @@ export function registerRouterTools(server: McpServer, callKicadScript: CommandF
}, },
); );
// ============================================================================
// execute_tool
// ============================================================================
server.tool(
"execute_tool",
{
tool_name: z.string().describe("Tool name from get_category_tools"),
params: z.record(z.unknown()).optional().describe("Tool parameters (optional)"),
},
async ({ tool_name, params }) => {
logger.info(`Executing routed tool: ${tool_name}`);
// Check if tool exists in registry
const category = getToolCategory(tool_name);
if (!category) {
return {
content: [
{
type: "text",
text: JSON.stringify(
{
error: `Unknown tool: ${tool_name}`,
hint: "Use list_tool_categories and get_category_tools to find available tools",
},
null,
2,
),
},
],
};
}
// Get the handler
const handler = toolHandlers.get(tool_name);
if (!handler) {
// Tool is in registry but handler not registered yet
// This means the tool exists but hasn't been migrated to router pattern yet
// Fall back to calling KiCAD script directly
logger.warn(
`Tool ${tool_name} in registry but no handler registered, falling back to direct call`,
);
try {
const result = await callKicadScript(tool_name, params || {});
return {
content: [
{
type: "text",
text: JSON.stringify(
{
tool: tool_name,
category: category,
result: result,
},
null,
2,
),
},
],
};
} catch (error) {
return {
content: [
{
type: "text",
text: JSON.stringify(
{
error: `Tool execution failed: ${(error as Error).message}`,
tool: tool_name,
category: category,
},
null,
2,
),
},
],
};
}
}
// Execute the tool via its handler
try {
const result = await handler(params || {});
// The handler already returns MCP-formatted response
// Just add metadata
return {
content: [
{
type: "text",
text: JSON.stringify(
{
tool: tool_name,
category: category,
...result,
},
null,
2,
),
},
],
};
} catch (error) {
return {
content: [
{
type: "text",
text: JSON.stringify(
{
error: `Tool execution failed: ${(error as Error).message}`,
tool: tool_name,
category: category,
},
null,
2,
),
},
],
};
}
},
);
// ============================================================================ // ============================================================================
// search_tools // search_tools
// ============================================================================ // ============================================================================
server.tool( server.tool(
"search_tools", "search_tools",
"Search all available KiCAD tools by keyword. Returns matching tool names and their categories.",
{ {
query: z.string().describe("Search term (e.g., 'gerber', 'zone', 'export', 'drc')"), query: z.string().describe("Search term (e.g., 'gerber', 'zone', 'export', 'drc')"),
}, },

View File

@@ -578,6 +578,53 @@ edit_schematic_component and set its value to an empty string.`,
}, },
); );
// Add no-connect flag
server.tool(
"add_no_connect",
"Add a no-connect flag (X marker) to a pin that is intentionally left unconnected. " +
"This suppresses ERC 'Pin not connected' errors for unused pins. " +
"PREFERRED: supply componentRef + pinNumber to snap to the exact pin endpoint. " +
"Alternatively supply position [x, y] in mm matching the pin endpoint exactly.",
{
schematicPath: z.string().describe("Path to the schematic file"),
position: z
.array(z.number())
.length(2)
.optional()
.describe("Position [x, y] in mm. Required when componentRef/pinNumber are not given."),
componentRef: z
.string()
.optional()
.describe("Component reference to snap to (e.g. U1, R1). Use with pinNumber."),
pinNumber: z
.union([z.string(), z.number()])
.optional()
.describe("Pin number or name on componentRef (e.g. '1', 'GND'). Use with componentRef."),
},
async (args: {
schematicPath: string;
position?: number[];
componentRef?: string;
pinNumber?: string | number;
}) => {
const result = await callKicadScript("add_no_connect", args);
if (result.success) {
return {
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
};
} else {
return {
content: [
{
type: "text",
text: `Failed to add no-connect: ${result.message || "Unknown error"}`,
},
],
};
}
},
);
// Connect pin to net // Connect pin to net
server.tool( server.tool(
"connect_to_net", "connect_to_net",