kicad-sch-api 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kicad_sch_api-0.1.2/PKG-INFO +326 -0
- kicad_sch_api-0.1.2/README.md +277 -0
- kicad_sch_api-0.1.2/examples/mcp_basic_example.py +41 -0
- kicad_sch_api-0.1.2/kicad_sch_api/cli.py +345 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/formatter.py +3 -1
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/parser.py +16 -5
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/schematic.py +35 -8
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/types.py +1 -1
- kicad_sch_api-0.1.2/kicad_sch_api/discovery/__init__.py +10 -0
- kicad_sch_api-0.1.2/kicad_sch_api/discovery/search_index.py +421 -0
- kicad_sch_api-0.1.2/kicad_sch_api/mcp/__init__.py +7 -0
- kicad_sch_api-0.1.2/kicad_sch_api/mcp/server.py +1509 -0
- kicad_sch_api-0.1.2/kicad_sch_api.egg-info/PKG-INFO +326 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api.egg-info/SOURCES.txt +8 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api.egg-info/entry_points.txt +1 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api.egg-info/requires.txt +6 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/pyproject.toml +10 -3
- kicad_sch_api-0.1.2/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_pro +417 -0
- kicad_sch_api-0.1.2/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_sch +23 -0
- kicad_sch_api-0.1.0/PKG-INFO +0 -207
- kicad_sch_api-0.1.0/README.md +0 -163
- kicad_sch_api-0.1.0/kicad_sch_api.egg-info/PKG-INFO +0 -207
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/dead-code-analysis.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/publish-pypi.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/review-implementation.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/run-tests.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/update-and-commit.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/dev/update-memory-bank.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/.claude/commands/test/run-reference-tests.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/LICENSE +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/MANIFEST.in +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/examples/advanced_usage.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/examples/basic_usage.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/examples/mcp_integration.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/__init__.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/__init__.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/components.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/ic_manager.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/junctions.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/core/wires.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/library/__init__.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/library/cache.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/py.typed +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/utils/__init__.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api/utils/validation.py +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api.egg-info/dependency_links.txt +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/kicad_sch_api.egg-info/top_level.txt +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/setup.cfg +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/README.md +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/subcircuit1.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_sch +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_pro +0 -0
- {kicad_sch_api-0.1.0 → kicad_sch_api-0.1.2}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_sch +0 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kicad-sch-api
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
|
|
5
|
+
Author-email: Circuit-Synth <shane@circuit-synth.com>
|
|
6
|
+
Maintainer-email: Circuit-Synth <shane@circuit-synth.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/circuit-synth/kicad-sch-api
|
|
9
|
+
Project-URL: Documentation, https://circuit-synth.github.io/kicad-sch-api/
|
|
10
|
+
Project-URL: Repository, https://github.com/circuit-synth/kicad-sch-api.git
|
|
11
|
+
Project-URL: Bug Reports, https://github.com/circuit-synth/kicad-sch-api/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/circuit-synth/kicad-sch-api/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: kicad,schematic,eda,electronics,circuit-design,ai,automation,pcb
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: fastmcp>=2.0.0
|
|
29
|
+
Requires-Dist: mcp[cli]>=1.13.0
|
|
30
|
+
Requires-Dist: sexpdata>=0.0.3
|
|
31
|
+
Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-xdist>=3.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
41
|
+
Provides-Extra: mcp
|
|
42
|
+
Requires-Dist: mcp[cli]>=1.0.0; extra == "mcp"
|
|
43
|
+
Requires-Dist: fastmcp>=2.0.0; extra == "mcp"
|
|
44
|
+
Provides-Extra: docs
|
|
45
|
+
Requires-Dist: sphinx>=5.0.0; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
|
47
|
+
Requires-Dist: myst-parser>=0.18.0; extra == "docs"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# KiCAD Schematic MCP Server
|
|
51
|
+
|
|
52
|
+
**Professional KiCAD Schematic Manipulation with Claude Code Integration**
|
|
53
|
+
|
|
54
|
+
Transform natural language into professional KiCAD schematics using AI. This MCP (Model Context Protocol) server provides Claude Code with powerful tools for creating, editing, and managing KiCAD schematic files with exact format preservation.
|
|
55
|
+
|
|
56
|
+
## 🚀 Quick Start - One Command Installation
|
|
57
|
+
|
|
58
|
+
**For macOS/Linux:**
|
|
59
|
+
```bash
|
|
60
|
+
curl -fsSL https://raw.githubusercontent.com/circuit-synth/kicad-sch-api/main/install.sh | bash
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**For Windows (PowerShell):**
|
|
64
|
+
```powershell
|
|
65
|
+
iwr -useb https://raw.githubusercontent.com/circuit-synth/kicad-sch-api/main/install.ps1 | iex
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**⏱️ Installation time: 2 minutes | Setup time: 30 seconds | Ready to design! 🚀**
|
|
69
|
+
|
|
70
|
+
## 📋 Prerequisites
|
|
71
|
+
|
|
72
|
+
- **KiCAD 8.0+** installed (for component symbol libraries)
|
|
73
|
+
- **Claude Code** installed ([download here](https://claude.ai/code))
|
|
74
|
+
- **Python 3.8+** (automatically handled by installation script)
|
|
75
|
+
|
|
76
|
+
## ✨ What You Get
|
|
77
|
+
|
|
78
|
+
After installation, use natural language in Claude Code to:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
"Create a voltage divider with two 10kΩ resistors"
|
|
82
|
+
"Add an ESP32 microcontroller with USB connector"
|
|
83
|
+
"Generate a hierarchical schematic with power supply subcircuit"
|
|
84
|
+
"Export component list with manufacturer part numbers"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 🎯 Key Features
|
|
88
|
+
|
|
89
|
+
- **🤖 AI-Native**: Built specifically for Claude Code integration
|
|
90
|
+
- **📋 Exact Format Preservation**: Output matches KiCAD's native formatting exactly
|
|
91
|
+
- **⚡ High Performance**: Optimized for large schematics with intelligent caching
|
|
92
|
+
- **🏗️ Hierarchical Design**: Full support for complex multi-sheet schematics
|
|
93
|
+
- **📚 Component Discovery**: Intelligent search across 13,000+ KiCAD symbols
|
|
94
|
+
- **🔍 Advanced Analysis**: Component filtering, area selection, and validation
|
|
95
|
+
- **✅ Professional Quality**: Comprehensive error handling and reporting
|
|
96
|
+
|
|
97
|
+
## 🆚 vs. Existing Solutions
|
|
98
|
+
|
|
99
|
+
| Feature | kicad-sch-api | Other Solutions | KiCAD Native |
|
|
100
|
+
|---------|---------------|-----------------|--------------|
|
|
101
|
+
| **AI Integration** | ✅ Claude Code | ❌ None | ❌ None |
|
|
102
|
+
| **Format Preservation** | ✅ Exact | ⚠️ Basic | ✅ Native |
|
|
103
|
+
| **Component Discovery** | ✅ 13,000+ | ⚠️ Limited | ⚠️ Manual |
|
|
104
|
+
| **Hierarchical Support** | ✅ Complete | ⚠️ Varies | ✅ Native |
|
|
105
|
+
| **Performance** | ✅ Optimized | ⚠️ Basic | ⚠️ GUI Only |
|
|
106
|
+
| **Automation** | ✅ Full API | ❌ None | ⚠️ Limited |
|
|
107
|
+
|
|
108
|
+
## 📦 Installation Options
|
|
109
|
+
|
|
110
|
+
Choose the method that works best for you:
|
|
111
|
+
|
|
112
|
+
### 🚀 Option 1: One-Click Setup (Recommended)
|
|
113
|
+
|
|
114
|
+
The installation script automatically:
|
|
115
|
+
- ✅ Installs the MCP server via pip
|
|
116
|
+
- ✅ Configures Claude Code MCP settings
|
|
117
|
+
- ✅ Tests the connection
|
|
118
|
+
- ✅ Displays usage examples
|
|
119
|
+
|
|
120
|
+
### 🐳 Option 2: Docker Container
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Pull and run the container
|
|
124
|
+
docker run -d --name kicad-mcp -p 3000:3000 circuitsynth/kicad-sch-api:latest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 🛠️ Option 3: From Source (Developers)
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
git clone https://github.com/circuit-synth/kicad-sch-api.git
|
|
131
|
+
cd kicad-sch-api
|
|
132
|
+
pip install -e .
|
|
133
|
+
kicad-sch-api --setup-claude-code
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 📦 Option 4: PyPI Package (Coming Soon)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
pip install kicad-sch-api
|
|
140
|
+
kicad-sch-api --setup-claude-code
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## 🎯 Quick Start Examples
|
|
144
|
+
|
|
145
|
+
### Basic Circuit Creation
|
|
146
|
+
|
|
147
|
+
Ask Claude Code:
|
|
148
|
+
```
|
|
149
|
+
Create a simple LED circuit with a 220Ω current limiting resistor
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Claude Code will:
|
|
153
|
+
1. Create a new schematic file
|
|
154
|
+
2. Add LED component from Device library
|
|
155
|
+
3. Add 220Ω resistor with proper footprint
|
|
156
|
+
4. Connect components with wires
|
|
157
|
+
5. Add power supply connections
|
|
158
|
+
6. Save with exact KiCAD formatting
|
|
159
|
+
|
|
160
|
+
### Advanced Hierarchical Design
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Design a microcontroller board with separate power supply and USB interface subcircuits
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Claude Code will:
|
|
167
|
+
1. Create main schematic with hierarchical sheets
|
|
168
|
+
2. Generate power supply subcircuit with regulators
|
|
169
|
+
3. Create USB interface subcircuit with connectors
|
|
170
|
+
4. Add inter-sheet connections and labels
|
|
171
|
+
5. Export complete project with proper hierarchy
|
|
172
|
+
|
|
173
|
+
### Component Discovery and Analysis
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
Find all operational amplifiers in the project and update their footprints to SOIC-8
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Claude Code will:
|
|
180
|
+
1. Search through all schematic sheets
|
|
181
|
+
2. Identify op-amp components by symbol library
|
|
182
|
+
3. Update footprint properties systematically
|
|
183
|
+
4. Generate change report with before/after comparison
|
|
184
|
+
|
|
185
|
+
## 🔧 Available Tools
|
|
186
|
+
|
|
187
|
+
The MCP server provides Claude Code with comprehensive schematic manipulation capabilities:
|
|
188
|
+
|
|
189
|
+
| Tool Category | Available Tools |
|
|
190
|
+
|---------------|-----------------|
|
|
191
|
+
| **Creation** | `create_schematic`, `add_component`, `add_wire`, `add_label` |
|
|
192
|
+
| **Hierarchical** | `add_hierarchical_sheet`, `add_sheet_pin`, `add_hierarchical_label` |
|
|
193
|
+
| **Discovery** | `search_components`, `list_available_symbols`, `get_component_info` |
|
|
194
|
+
| **Analysis** | `list_components`, `get_connections`, `validate_schematic` |
|
|
195
|
+
| **Export** | `save_schematic`, `export_netlist`, `generate_bom` |
|
|
196
|
+
|
|
197
|
+
## ⚙️ Configuration
|
|
198
|
+
|
|
199
|
+
### Automatic Configuration (Recommended)
|
|
200
|
+
```bash
|
|
201
|
+
kicad-sch-api --setup-claude-code
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Manual Configuration
|
|
205
|
+
Add to your Claude Code MCP settings:
|
|
206
|
+
|
|
207
|
+
**File Location:**
|
|
208
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
209
|
+
- **Windows:** `%APPDATA%/Claude/claude_desktop_config.json`
|
|
210
|
+
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"mcpServers": {
|
|
215
|
+
"kicad-sch-api": {
|
|
216
|
+
"command": "kicad-sch-mcp",
|
|
217
|
+
"args": [],
|
|
218
|
+
"env": {}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## ✅ Verification
|
|
225
|
+
|
|
226
|
+
### Test Installation
|
|
227
|
+
```bash
|
|
228
|
+
kicad-sch-api --test
|
|
229
|
+
kicad-sch-api --demo
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### In Claude Code
|
|
233
|
+
Ask Claude Code:
|
|
234
|
+
```
|
|
235
|
+
Test the KiCAD MCP server by creating a simple resistor circuit
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
If successful, you'll see Claude Code using the kicad-sch-api tools to create schematics.
|
|
239
|
+
|
|
240
|
+
## 🏗️ Architecture
|
|
241
|
+
|
|
242
|
+
### Core Python Library
|
|
243
|
+
- **Enhanced Object Model**: Intuitive API with fast component collections
|
|
244
|
+
- **Exact Format Preservation**: S-expression writer that matches KiCAD output
|
|
245
|
+
- **Symbol Caching**: High-performance library symbol management
|
|
246
|
+
- **Comprehensive Validation**: Error collection and professional reporting
|
|
247
|
+
|
|
248
|
+
### MCP Server Integration
|
|
249
|
+
- **Claude Code Tools**: 15+ tools for complete schematic manipulation
|
|
250
|
+
- **Professional Error Handling**: Detailed error context for AI agents
|
|
251
|
+
- **Component Discovery**: SQLite-indexed search across KiCAD libraries
|
|
252
|
+
- **Hierarchical Support**: Full multi-sheet schematic capabilities
|
|
253
|
+
|
|
254
|
+
## 🧪 Testing & Quality
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Test the MCP server
|
|
258
|
+
kicad-sch-mcp --test
|
|
259
|
+
|
|
260
|
+
# Run comprehensive tests
|
|
261
|
+
uv run pytest tests/ -v
|
|
262
|
+
|
|
263
|
+
# Format preservation tests (critical)
|
|
264
|
+
uv run pytest tests/test_format_preservation.py -v
|
|
265
|
+
uv run pytest tests/test_exact_file_diff.py -v
|
|
266
|
+
|
|
267
|
+
# Code quality checks
|
|
268
|
+
uv run black kicad_sch_api/ tests/
|
|
269
|
+
uv run mypy kicad_sch_api/
|
|
270
|
+
uv run flake8 kicad_sch_api/ tests/
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## 🔧 Troubleshooting
|
|
274
|
+
|
|
275
|
+
### Common Issues
|
|
276
|
+
|
|
277
|
+
**"Command not found: kicad-sch-mcp"**
|
|
278
|
+
```bash
|
|
279
|
+
# Check installation status
|
|
280
|
+
kicad-sch-api --status
|
|
281
|
+
|
|
282
|
+
# Add to PATH permanently
|
|
283
|
+
export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
**"Component libraries not found"**
|
|
287
|
+
```bash
|
|
288
|
+
# Initialize component cache
|
|
289
|
+
kicad-sch-api --init-cache
|
|
290
|
+
|
|
291
|
+
# Check KiCAD installation
|
|
292
|
+
kicad-sch-api --check-kicad
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**"MCP server not responding"**
|
|
296
|
+
```bash
|
|
297
|
+
# View server logs
|
|
298
|
+
kicad-sch-api --logs
|
|
299
|
+
|
|
300
|
+
# Test server startup
|
|
301
|
+
kicad-sch-mcp --debug
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
## 🤝 Contributing
|
|
305
|
+
|
|
306
|
+
We welcome contributions! See [INSTALLATION.md](INSTALLATION.md) for setup details and [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
307
|
+
|
|
308
|
+
Key areas for contribution:
|
|
309
|
+
- Additional KiCAD symbol library support
|
|
310
|
+
- Enhanced component discovery algorithms
|
|
311
|
+
- Performance optimizations for large schematics
|
|
312
|
+
- New MCP tools and capabilities
|
|
313
|
+
|
|
314
|
+
## 📄 License
|
|
315
|
+
|
|
316
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
317
|
+
|
|
318
|
+
## 🔗 Related Projects
|
|
319
|
+
|
|
320
|
+
- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: Comprehensive circuit design automation
|
|
321
|
+
- **[Claude Code](https://claude.ai/code)**: AI-powered development environment
|
|
322
|
+
- **[MCP](https://modelcontextprotocol.io/)**: Model Context Protocol for AI tool integration
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
**Transform ideas into schematics with AI ⚡ Built with ❤️ by the Circuit-Synth team**
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# KiCAD Schematic MCP Server
|
|
2
|
+
|
|
3
|
+
**Professional KiCAD Schematic Manipulation with Claude Code Integration**
|
|
4
|
+
|
|
5
|
+
Transform natural language into professional KiCAD schematics using AI. This MCP (Model Context Protocol) server provides Claude Code with powerful tools for creating, editing, and managing KiCAD schematic files with exact format preservation.
|
|
6
|
+
|
|
7
|
+
## 🚀 Quick Start - One Command Installation
|
|
8
|
+
|
|
9
|
+
**For macOS/Linux:**
|
|
10
|
+
```bash
|
|
11
|
+
curl -fsSL https://raw.githubusercontent.com/circuit-synth/kicad-sch-api/main/install.sh | bash
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**For Windows (PowerShell):**
|
|
15
|
+
```powershell
|
|
16
|
+
iwr -useb https://raw.githubusercontent.com/circuit-synth/kicad-sch-api/main/install.ps1 | iex
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**⏱️ Installation time: 2 minutes | Setup time: 30 seconds | Ready to design! 🚀**
|
|
20
|
+
|
|
21
|
+
## 📋 Prerequisites
|
|
22
|
+
|
|
23
|
+
- **KiCAD 8.0+** installed (for component symbol libraries)
|
|
24
|
+
- **Claude Code** installed ([download here](https://claude.ai/code))
|
|
25
|
+
- **Python 3.8+** (automatically handled by installation script)
|
|
26
|
+
|
|
27
|
+
## ✨ What You Get
|
|
28
|
+
|
|
29
|
+
After installation, use natural language in Claude Code to:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
"Create a voltage divider with two 10kΩ resistors"
|
|
33
|
+
"Add an ESP32 microcontroller with USB connector"
|
|
34
|
+
"Generate a hierarchical schematic with power supply subcircuit"
|
|
35
|
+
"Export component list with manufacturer part numbers"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 🎯 Key Features
|
|
39
|
+
|
|
40
|
+
- **🤖 AI-Native**: Built specifically for Claude Code integration
|
|
41
|
+
- **📋 Exact Format Preservation**: Output matches KiCAD's native formatting exactly
|
|
42
|
+
- **⚡ High Performance**: Optimized for large schematics with intelligent caching
|
|
43
|
+
- **🏗️ Hierarchical Design**: Full support for complex multi-sheet schematics
|
|
44
|
+
- **📚 Component Discovery**: Intelligent search across 13,000+ KiCAD symbols
|
|
45
|
+
- **🔍 Advanced Analysis**: Component filtering, area selection, and validation
|
|
46
|
+
- **✅ Professional Quality**: Comprehensive error handling and reporting
|
|
47
|
+
|
|
48
|
+
## 🆚 vs. Existing Solutions
|
|
49
|
+
|
|
50
|
+
| Feature | kicad-sch-api | Other Solutions | KiCAD Native |
|
|
51
|
+
|---------|---------------|-----------------|--------------|
|
|
52
|
+
| **AI Integration** | ✅ Claude Code | ❌ None | ❌ None |
|
|
53
|
+
| **Format Preservation** | ✅ Exact | ⚠️ Basic | ✅ Native |
|
|
54
|
+
| **Component Discovery** | ✅ 13,000+ | ⚠️ Limited | ⚠️ Manual |
|
|
55
|
+
| **Hierarchical Support** | ✅ Complete | ⚠️ Varies | ✅ Native |
|
|
56
|
+
| **Performance** | ✅ Optimized | ⚠️ Basic | ⚠️ GUI Only |
|
|
57
|
+
| **Automation** | ✅ Full API | ❌ None | ⚠️ Limited |
|
|
58
|
+
|
|
59
|
+
## 📦 Installation Options
|
|
60
|
+
|
|
61
|
+
Choose the method that works best for you:
|
|
62
|
+
|
|
63
|
+
### 🚀 Option 1: One-Click Setup (Recommended)
|
|
64
|
+
|
|
65
|
+
The installation script automatically:
|
|
66
|
+
- ✅ Installs the MCP server via pip
|
|
67
|
+
- ✅ Configures Claude Code MCP settings
|
|
68
|
+
- ✅ Tests the connection
|
|
69
|
+
- ✅ Displays usage examples
|
|
70
|
+
|
|
71
|
+
### 🐳 Option 2: Docker Container
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Pull and run the container
|
|
75
|
+
docker run -d --name kicad-mcp -p 3000:3000 circuitsynth/kicad-sch-api:latest
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 🛠️ Option 3: From Source (Developers)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/circuit-synth/kicad-sch-api.git
|
|
82
|
+
cd kicad-sch-api
|
|
83
|
+
pip install -e .
|
|
84
|
+
kicad-sch-api --setup-claude-code
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 📦 Option 4: PyPI Package (Coming Soon)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install kicad-sch-api
|
|
91
|
+
kicad-sch-api --setup-claude-code
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 🎯 Quick Start Examples
|
|
95
|
+
|
|
96
|
+
### Basic Circuit Creation
|
|
97
|
+
|
|
98
|
+
Ask Claude Code:
|
|
99
|
+
```
|
|
100
|
+
Create a simple LED circuit with a 220Ω current limiting resistor
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Claude Code will:
|
|
104
|
+
1. Create a new schematic file
|
|
105
|
+
2. Add LED component from Device library
|
|
106
|
+
3. Add 220Ω resistor with proper footprint
|
|
107
|
+
4. Connect components with wires
|
|
108
|
+
5. Add power supply connections
|
|
109
|
+
6. Save with exact KiCAD formatting
|
|
110
|
+
|
|
111
|
+
### Advanced Hierarchical Design
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Design a microcontroller board with separate power supply and USB interface subcircuits
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Claude Code will:
|
|
118
|
+
1. Create main schematic with hierarchical sheets
|
|
119
|
+
2. Generate power supply subcircuit with regulators
|
|
120
|
+
3. Create USB interface subcircuit with connectors
|
|
121
|
+
4. Add inter-sheet connections and labels
|
|
122
|
+
5. Export complete project with proper hierarchy
|
|
123
|
+
|
|
124
|
+
### Component Discovery and Analysis
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
Find all operational amplifiers in the project and update their footprints to SOIC-8
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Claude Code will:
|
|
131
|
+
1. Search through all schematic sheets
|
|
132
|
+
2. Identify op-amp components by symbol library
|
|
133
|
+
3. Update footprint properties systematically
|
|
134
|
+
4. Generate change report with before/after comparison
|
|
135
|
+
|
|
136
|
+
## 🔧 Available Tools
|
|
137
|
+
|
|
138
|
+
The MCP server provides Claude Code with comprehensive schematic manipulation capabilities:
|
|
139
|
+
|
|
140
|
+
| Tool Category | Available Tools |
|
|
141
|
+
|---------------|-----------------|
|
|
142
|
+
| **Creation** | `create_schematic`, `add_component`, `add_wire`, `add_label` |
|
|
143
|
+
| **Hierarchical** | `add_hierarchical_sheet`, `add_sheet_pin`, `add_hierarchical_label` |
|
|
144
|
+
| **Discovery** | `search_components`, `list_available_symbols`, `get_component_info` |
|
|
145
|
+
| **Analysis** | `list_components`, `get_connections`, `validate_schematic` |
|
|
146
|
+
| **Export** | `save_schematic`, `export_netlist`, `generate_bom` |
|
|
147
|
+
|
|
148
|
+
## ⚙️ Configuration
|
|
149
|
+
|
|
150
|
+
### Automatic Configuration (Recommended)
|
|
151
|
+
```bash
|
|
152
|
+
kicad-sch-api --setup-claude-code
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Manual Configuration
|
|
156
|
+
Add to your Claude Code MCP settings:
|
|
157
|
+
|
|
158
|
+
**File Location:**
|
|
159
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
160
|
+
- **Windows:** `%APPDATA%/Claude/claude_desktop_config.json`
|
|
161
|
+
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"kicad-sch-api": {
|
|
167
|
+
"command": "kicad-sch-mcp",
|
|
168
|
+
"args": [],
|
|
169
|
+
"env": {}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## ✅ Verification
|
|
176
|
+
|
|
177
|
+
### Test Installation
|
|
178
|
+
```bash
|
|
179
|
+
kicad-sch-api --test
|
|
180
|
+
kicad-sch-api --demo
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### In Claude Code
|
|
184
|
+
Ask Claude Code:
|
|
185
|
+
```
|
|
186
|
+
Test the KiCAD MCP server by creating a simple resistor circuit
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
If successful, you'll see Claude Code using the kicad-sch-api tools to create schematics.
|
|
190
|
+
|
|
191
|
+
## 🏗️ Architecture
|
|
192
|
+
|
|
193
|
+
### Core Python Library
|
|
194
|
+
- **Enhanced Object Model**: Intuitive API with fast component collections
|
|
195
|
+
- **Exact Format Preservation**: S-expression writer that matches KiCAD output
|
|
196
|
+
- **Symbol Caching**: High-performance library symbol management
|
|
197
|
+
- **Comprehensive Validation**: Error collection and professional reporting
|
|
198
|
+
|
|
199
|
+
### MCP Server Integration
|
|
200
|
+
- **Claude Code Tools**: 15+ tools for complete schematic manipulation
|
|
201
|
+
- **Professional Error Handling**: Detailed error context for AI agents
|
|
202
|
+
- **Component Discovery**: SQLite-indexed search across KiCAD libraries
|
|
203
|
+
- **Hierarchical Support**: Full multi-sheet schematic capabilities
|
|
204
|
+
|
|
205
|
+
## 🧪 Testing & Quality
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Test the MCP server
|
|
209
|
+
kicad-sch-mcp --test
|
|
210
|
+
|
|
211
|
+
# Run comprehensive tests
|
|
212
|
+
uv run pytest tests/ -v
|
|
213
|
+
|
|
214
|
+
# Format preservation tests (critical)
|
|
215
|
+
uv run pytest tests/test_format_preservation.py -v
|
|
216
|
+
uv run pytest tests/test_exact_file_diff.py -v
|
|
217
|
+
|
|
218
|
+
# Code quality checks
|
|
219
|
+
uv run black kicad_sch_api/ tests/
|
|
220
|
+
uv run mypy kicad_sch_api/
|
|
221
|
+
uv run flake8 kicad_sch_api/ tests/
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 🔧 Troubleshooting
|
|
225
|
+
|
|
226
|
+
### Common Issues
|
|
227
|
+
|
|
228
|
+
**"Command not found: kicad-sch-mcp"**
|
|
229
|
+
```bash
|
|
230
|
+
# Check installation status
|
|
231
|
+
kicad-sch-api --status
|
|
232
|
+
|
|
233
|
+
# Add to PATH permanently
|
|
234
|
+
export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**"Component libraries not found"**
|
|
238
|
+
```bash
|
|
239
|
+
# Initialize component cache
|
|
240
|
+
kicad-sch-api --init-cache
|
|
241
|
+
|
|
242
|
+
# Check KiCAD installation
|
|
243
|
+
kicad-sch-api --check-kicad
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**"MCP server not responding"**
|
|
247
|
+
```bash
|
|
248
|
+
# View server logs
|
|
249
|
+
kicad-sch-api --logs
|
|
250
|
+
|
|
251
|
+
# Test server startup
|
|
252
|
+
kicad-sch-mcp --debug
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## 🤝 Contributing
|
|
256
|
+
|
|
257
|
+
We welcome contributions! See [INSTALLATION.md](INSTALLATION.md) for setup details and [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
258
|
+
|
|
259
|
+
Key areas for contribution:
|
|
260
|
+
- Additional KiCAD symbol library support
|
|
261
|
+
- Enhanced component discovery algorithms
|
|
262
|
+
- Performance optimizations for large schematics
|
|
263
|
+
- New MCP tools and capabilities
|
|
264
|
+
|
|
265
|
+
## 📄 License
|
|
266
|
+
|
|
267
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
268
|
+
|
|
269
|
+
## 🔗 Related Projects
|
|
270
|
+
|
|
271
|
+
- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: Comprehensive circuit design automation
|
|
272
|
+
- **[Claude Code](https://claude.ai/code)**: AI-powered development environment
|
|
273
|
+
- **[MCP](https://modelcontextprotocol.io/)**: Model Context Protocol for AI tool integration
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
**Transform ideas into schematics with AI ⚡ Built with ❤️ by the Circuit-Synth team**
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Basic MCP Server Usage Example
|
|
4
|
+
|
|
5
|
+
Shows how to use the KiCAD Schematic MCP server for AI-driven circuit creation.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
"""Example of operations available through MCP server."""
|
|
10
|
+
|
|
11
|
+
print("KiCAD Schematic MCP Server - Basic Usage")
|
|
12
|
+
print("=" * 50)
|
|
13
|
+
|
|
14
|
+
print("\n1. Create a new schematic:")
|
|
15
|
+
print(" create_schematic(name='My Circuit')")
|
|
16
|
+
|
|
17
|
+
print("\n2. Add components:")
|
|
18
|
+
print(" add_component(lib_id='Device:R', reference='R1', value='10k', position=(100, 100))")
|
|
19
|
+
print(" add_component(lib_id='Device:C', reference='C1', value='0.1uF', position=(150, 100))")
|
|
20
|
+
|
|
21
|
+
print("\n3. Add wire connections:")
|
|
22
|
+
print(" add_wire(start_pos=(100, 90), end_pos=(150, 90))")
|
|
23
|
+
|
|
24
|
+
print("\n4. List components:")
|
|
25
|
+
print(" list_components()")
|
|
26
|
+
|
|
27
|
+
print("\n5. Get schematic info:")
|
|
28
|
+
print(" get_schematic_info()")
|
|
29
|
+
|
|
30
|
+
print("\n6. Save schematic:")
|
|
31
|
+
print(" save_schematic(file_path='my_circuit.kicad_sch')")
|
|
32
|
+
|
|
33
|
+
print("\n7. Load existing schematic:")
|
|
34
|
+
print(" load_schematic(file_path='existing_circuit.kicad_sch')")
|
|
35
|
+
|
|
36
|
+
print("\nAI Usage Example:")
|
|
37
|
+
print("'Create a new schematic called Power Supply, add a voltage regulator")
|
|
38
|
+
print("and some decoupling capacitors, then save it as power_supply.kicad_sch'")
|
|
39
|
+
|
|
40
|
+
if __name__ == "__main__":
|
|
41
|
+
main()
|