kicad-sch-api 0.1.2__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
Potentially problematic release.
This version of kicad-sch-api might be problematic. Click here for more details.
- kicad_sch_api/mcp/server.py +1 -1
- kicad_sch_api-0.1.3.dist-info/METADATA +322 -0
- {kicad_sch_api-0.1.2.dist-info → kicad_sch_api-0.1.3.dist-info}/RECORD +7 -7
- kicad_sch_api-0.1.2.dist-info/METADATA +0 -326
- {kicad_sch_api-0.1.2.dist-info → kicad_sch_api-0.1.3.dist-info}/WHEEL +0 -0
- {kicad_sch_api-0.1.2.dist-info → kicad_sch_api-0.1.3.dist-info}/entry_points.txt +0 -0
- {kicad_sch_api-0.1.2.dist-info → kicad_sch_api-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {kicad_sch_api-0.1.2.dist-info → kicad_sch_api-0.1.3.dist-info}/top_level.txt +0 -0
kicad_sch_api/mcp/server.py
CHANGED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kicad-sch-api
|
|
3
|
+
Version: 0.1.3
|
|
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 API
|
|
51
|
+
|
|
52
|
+
**Professional Python library for KiCAD schematic file manipulation with exact format preservation**
|
|
53
|
+
|
|
54
|
+
## Overview
|
|
55
|
+
|
|
56
|
+
Create and manipulate KiCAD schematic files programmatically with guaranteed exact format preservation. This library serves as the foundation for EDA automation tools and AI agents that need reliable, professional-grade schematic manipulation capabilities.
|
|
57
|
+
|
|
58
|
+
## 🎯 Core Features
|
|
59
|
+
|
|
60
|
+
- **📋 Exact Format Preservation**: Byte-perfect KiCAD output that matches native formatting
|
|
61
|
+
- **🏗️ Professional Component Management**: Object-oriented collections with search and validation
|
|
62
|
+
- **⚡ High Performance**: Optimized for large schematics with intelligent caching
|
|
63
|
+
- **🔍 Real KiCAD Library Integration**: Access to actual KiCAD symbol libraries and validation
|
|
64
|
+
- **🤖 AI Agent Ready**: MCP server for seamless integration with AI development tools
|
|
65
|
+
- **📚 Hierarchical Design**: Complete support for multi-sheet schematic projects
|
|
66
|
+
|
|
67
|
+
## 🚀 Quick Start
|
|
68
|
+
|
|
69
|
+
### Installation
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Install from PyPI
|
|
73
|
+
pip install kicad-sch-api
|
|
74
|
+
|
|
75
|
+
# Or install from source
|
|
76
|
+
git clone https://github.com/circuit-synth/kicad-sch-api.git
|
|
77
|
+
cd kicad-sch-api/python
|
|
78
|
+
uv pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Basic Usage
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
import kicad_sch_api as ksa
|
|
85
|
+
|
|
86
|
+
# Create a new schematic
|
|
87
|
+
sch = ksa.create_schematic("My Circuit")
|
|
88
|
+
|
|
89
|
+
# Add components with proper validation
|
|
90
|
+
resistor = sch.components.add(
|
|
91
|
+
lib_id="Device:R",
|
|
92
|
+
reference="R1",
|
|
93
|
+
value="10k",
|
|
94
|
+
position=(100.0, 100.0),
|
|
95
|
+
footprint="Resistor_SMD:R_0603_1608Metric",
|
|
96
|
+
datasheet="~",
|
|
97
|
+
description="Resistor"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
capacitor = sch.components.add(
|
|
101
|
+
lib_id="Device:C",
|
|
102
|
+
reference="C1",
|
|
103
|
+
value="100nF",
|
|
104
|
+
position=(150.0, 100.0),
|
|
105
|
+
footprint="Capacitor_SMD:C_0603_1608Metric"
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
# Save with exact format preservation
|
|
109
|
+
sch.save("my_circuit.kicad_sch")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Hierarchical Design
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
# Create main schematic with hierarchical sheet
|
|
116
|
+
main_sch = ksa.create_schematic("Main Board")
|
|
117
|
+
|
|
118
|
+
# Add hierarchical sheet
|
|
119
|
+
power_sheet = main_sch.add_hierarchical_sheet(
|
|
120
|
+
name="Power Supply",
|
|
121
|
+
filename="power.kicad_sch",
|
|
122
|
+
position=(100, 100),
|
|
123
|
+
size=(80, 60)
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Add sheet pins for connectivity
|
|
127
|
+
power_sheet.add_pin("VIN", pin_type="input", position=(0, 10))
|
|
128
|
+
power_sheet.add_pin("VOUT", pin_type="output", position=(80, 10))
|
|
129
|
+
|
|
130
|
+
# Create the sub-schematic
|
|
131
|
+
power_sch = ksa.create_schematic("Power Supply")
|
|
132
|
+
power_sch.add_hierarchical_label("VIN", label_type="input", position=(50, 25))
|
|
133
|
+
power_sch.add_hierarchical_label("VOUT", label_type="output", position=(150, 25))
|
|
134
|
+
|
|
135
|
+
# Save both schematics
|
|
136
|
+
main_sch.save("main.kicad_sch")
|
|
137
|
+
power_sch.save("power.kicad_sch")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 🔧 Advanced Features
|
|
141
|
+
|
|
142
|
+
### Component Search and Management
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
# Search for components
|
|
146
|
+
resistors = sch.components.find(lib_id_pattern='Device:R*')
|
|
147
|
+
power_components = sch.components.filter(reference_pattern=r'U[0-9]+')
|
|
148
|
+
|
|
149
|
+
# Bulk updates
|
|
150
|
+
sch.components.bulk_update(
|
|
151
|
+
criteria={'lib_id': 'Device:R'},
|
|
152
|
+
updates={'properties': {'Tolerance': '1%'}}
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Component validation
|
|
156
|
+
validation_result = sch.components.validate_component(
|
|
157
|
+
'Device:R',
|
|
158
|
+
'Resistor_SMD:R_0603_1608Metric'
|
|
159
|
+
)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### KiCAD Integration
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
# Run electrical rules check using KiCAD CLI
|
|
166
|
+
erc_result = sch.run_erc_check()
|
|
167
|
+
print(f"ERC Status: {erc_result.status}")
|
|
168
|
+
for violation in erc_result.violations:
|
|
169
|
+
print(f"- {violation.type}: {violation.message}")
|
|
170
|
+
|
|
171
|
+
# Generate netlist for connectivity analysis
|
|
172
|
+
netlist = sch.generate_netlist()
|
|
173
|
+
net_info = netlist.analyze_net("VCC")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 🤖 AI Agent Integration (MCP Server)
|
|
177
|
+
|
|
178
|
+
Use with Claude Code or other AI agents via Model Context Protocol:
|
|
179
|
+
|
|
180
|
+
### Setup MCP Server
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Install MCP server
|
|
184
|
+
pip install kicad-sch-api[mcp]
|
|
185
|
+
|
|
186
|
+
# Configure for Claude Code (automatic)
|
|
187
|
+
kicad-sch-api --setup-claude-code
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Usage with AI Agents
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
# Natural language commands to your AI agent:
|
|
194
|
+
"Create a voltage divider with two 10kΩ resistors"
|
|
195
|
+
"Add an ESP32 microcontroller with USB connector"
|
|
196
|
+
"Generate a hierarchical schematic with power supply subcircuit"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The AI agent will use the MCP server to:
|
|
200
|
+
1. Create professional schematics with proper component references
|
|
201
|
+
2. Use hierarchical labels instead of messy wires
|
|
202
|
+
3. Apply KiCAD design best practices automatically
|
|
203
|
+
4. Generate clean, industry-standard layouts
|
|
204
|
+
|
|
205
|
+
### Available MCP Tools
|
|
206
|
+
|
|
207
|
+
| Tool | Description |
|
|
208
|
+
|------|-------------|
|
|
209
|
+
| `create_schematic` | Create new schematic files |
|
|
210
|
+
| `add_component` | Add components with validation |
|
|
211
|
+
| `search_components` | Find components in KiCAD libraries |
|
|
212
|
+
| `add_hierarchical_sheet` | Create multi-sheet designs |
|
|
213
|
+
| `validate_component` | Check component/footprint compatibility |
|
|
214
|
+
| `list_components` | Get all components in schematic |
|
|
215
|
+
| `save_schematic` | Save with exact format preservation |
|
|
216
|
+
|
|
217
|
+
## 🏗️ Architecture
|
|
218
|
+
|
|
219
|
+
### Library Structure
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
kicad_sch_api/
|
|
223
|
+
├── core/ # Core schematic manipulation
|
|
224
|
+
├── library/ # KiCAD library integration
|
|
225
|
+
├── integration/ # KiCAD CLI and tool integration
|
|
226
|
+
├── mcp/ # MCP server for AI agents
|
|
227
|
+
└── utils/ # Validation and utilities
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Design Principles
|
|
231
|
+
|
|
232
|
+
- **Building Block First**: Designed to be the foundation for other tools
|
|
233
|
+
- **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
|
|
234
|
+
- **Professional Quality**: Comprehensive error handling and validation
|
|
235
|
+
- **AI-Native**: Built specifically for AI agent integration
|
|
236
|
+
- **Performance Optimized**: Fast operations on large schematics
|
|
237
|
+
|
|
238
|
+
## 🧪 Testing & Quality
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Run all tests
|
|
242
|
+
uv run pytest tests/ -v
|
|
243
|
+
|
|
244
|
+
# Format preservation tests (critical)
|
|
245
|
+
uv run pytest tests/reference_tests/ -v
|
|
246
|
+
|
|
247
|
+
# Code quality checks
|
|
248
|
+
uv run black kicad_sch_api/ tests/
|
|
249
|
+
uv run mypy kicad_sch_api/
|
|
250
|
+
uv run flake8 kicad_sch_api/ tests/
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 🆚 Why This Library?
|
|
254
|
+
|
|
255
|
+
### vs. Direct KiCAD File Editing
|
|
256
|
+
- **Professional API**: High-level operations vs low-level S-expression manipulation
|
|
257
|
+
- **Guaranteed Format**: Byte-perfect output vs manual formatting
|
|
258
|
+
- **Validation**: Real KiCAD library integration and component validation
|
|
259
|
+
- **Performance**: Optimized collections vs manual iteration
|
|
260
|
+
|
|
261
|
+
### vs. Other Python KiCAD Libraries
|
|
262
|
+
- **Format Preservation**: Exact KiCAD compatibility vs approximate output
|
|
263
|
+
- **Modern Design**: Object-oriented collections vs legacy patterns
|
|
264
|
+
- **AI Integration**: Purpose-built MCP server vs no agent support
|
|
265
|
+
- **Professional Focus**: Production-ready vs exploration tools
|
|
266
|
+
|
|
267
|
+
## 🔗 Ecosystem
|
|
268
|
+
|
|
269
|
+
This library is designed as a building block for specialized tools:
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
# Foundation library
|
|
273
|
+
import kicad_sch_api as ksa
|
|
274
|
+
|
|
275
|
+
# Specialized libraries (examples of what could be built)
|
|
276
|
+
# import kicad_sourcing_tools as sourcing # Component sourcing
|
|
277
|
+
# import kicad_placement_optimizer as placement # Layout optimization
|
|
278
|
+
# import kicad_dfm_checker as dfm # Manufacturing validation
|
|
279
|
+
|
|
280
|
+
# Foundation provides reliable schematic manipulation
|
|
281
|
+
sch = ksa.load_schematic('project.kicad_sch')
|
|
282
|
+
|
|
283
|
+
# Specialized tools extend functionality
|
|
284
|
+
# sourcing.update_component_sourcing(sch.components)
|
|
285
|
+
# placement.optimize_layout(sch)
|
|
286
|
+
# dfm.check_manufacturing_rules(sch)
|
|
287
|
+
|
|
288
|
+
# All save through foundation's format preservation
|
|
289
|
+
sch.save() # Guaranteed exact KiCAD format
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 📖 Documentation
|
|
293
|
+
|
|
294
|
+
- **[API Reference](docs/api.md)**: Complete API documentation
|
|
295
|
+
- **[Examples](examples/)**: Code examples and tutorials
|
|
296
|
+
- **[MCP Integration](docs/mcp.md)**: AI agent integration guide
|
|
297
|
+
- **[Development](docs/development.md)**: Contributing and development setup
|
|
298
|
+
|
|
299
|
+
## 🤝 Contributing
|
|
300
|
+
|
|
301
|
+
We welcome contributions! Key areas:
|
|
302
|
+
|
|
303
|
+
- KiCAD library integration and component validation
|
|
304
|
+
- Performance optimizations for large schematics
|
|
305
|
+
- Additional MCP tools for AI agents
|
|
306
|
+
- Test coverage and format preservation validation
|
|
307
|
+
|
|
308
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
309
|
+
|
|
310
|
+
## 📄 License
|
|
311
|
+
|
|
312
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
313
|
+
|
|
314
|
+
## 🔗 Related Projects
|
|
315
|
+
|
|
316
|
+
- **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
|
|
317
|
+
- **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
|
|
318
|
+
- **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
**Professional KiCAD schematic manipulation for the AI age ⚡**
|
|
@@ -15,12 +15,12 @@ kicad_sch_api/discovery/search_index.py,sha256=Yl3PXRk19mXCDtABM6Bs0ii0HMGiUAmIp
|
|
|
15
15
|
kicad_sch_api/library/__init__.py,sha256=NG9UTdcpn25Bl9tPsYs9ED7bvpaVPVdtLMbnxkQkOnU,250
|
|
16
16
|
kicad_sch_api/library/cache.py,sha256=NPJT-apWH_JfVG1aXJ0gDnfGu8es_2tYiyZr-chcTxY,33511
|
|
17
17
|
kicad_sch_api/mcp/__init__.py,sha256=Jw4gKdn9H-2MVUYBTIAb6s5Tz2mYc9KoQPRsx-voD4s,159
|
|
18
|
-
kicad_sch_api/mcp/server.py,sha256=
|
|
18
|
+
kicad_sch_api/mcp/server.py,sha256=oeY4-EaxdzIeAW6jTNEpg5101QcFwZvNIP1WvIlCsb0,54343
|
|
19
19
|
kicad_sch_api/utils/__init__.py,sha256=1V_yGgI7jro6MUc4Pviux_WIeJ1wmiYFID186SZwWLQ,277
|
|
20
20
|
kicad_sch_api/utils/validation.py,sha256=XlWGRZJb3cOPYpU9sLQQgC_NASwbi6W-LCN7PzUmaPY,15626
|
|
21
|
-
kicad_sch_api-0.1.
|
|
22
|
-
kicad_sch_api-0.1.
|
|
23
|
-
kicad_sch_api-0.1.
|
|
24
|
-
kicad_sch_api-0.1.
|
|
25
|
-
kicad_sch_api-0.1.
|
|
26
|
-
kicad_sch_api-0.1.
|
|
21
|
+
kicad_sch_api-0.1.3.dist-info/licenses/LICENSE,sha256=Em65Nvte1G9MHc0rHqtYuGkCPcshD588itTa358J6gs,1070
|
|
22
|
+
kicad_sch_api-0.1.3.dist-info/METADATA,sha256=RV0C_idQV160XSnrITBeHpVLp-sN_ez8ZwO92845rJk,10566
|
|
23
|
+
kicad_sch_api-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
24
|
+
kicad_sch_api-0.1.3.dist-info/entry_points.txt,sha256=Ibo-83_EdwmiuQwMcOHEzClKgl8MC9syASWtYzeD-os,103
|
|
25
|
+
kicad_sch_api-0.1.3.dist-info/top_level.txt,sha256=n0ex4gOJ1b_fARowcGqRzyOGZcHRhc5LZa6_vVgGxcI,14
|
|
26
|
+
kicad_sch_api-0.1.3.dist-info/RECORD,,
|
|
@@ -1,326 +0,0 @@
|
|
|
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**
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|