kicad-sch-api 0.1.7__tar.gz → 0.2.0__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.

Potentially problematic release.


This version of kicad-sch-api might be problematic. Click here for more details.

Files changed (74) hide show
  1. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/PKG-INFO +32 -43
  2. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/README.md +30 -36
  3. kicad_sch_api-0.2.0/kicad_sch_api/cli.py +242 -0
  4. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/PKG-INFO +32 -43
  5. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/SOURCES.txt +0 -2
  6. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/entry_points.txt +0 -1
  7. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/requires.txt +0 -6
  8. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/pyproject.toml +2 -11
  9. kicad_sch_api-0.1.7/kicad_sch_api/cli.py +0 -400
  10. kicad_sch_api-0.1.7/kicad_sch_api/mcp/__init__.py +0 -7
  11. kicad_sch_api-0.1.7/kicad_sch_api/mcp/server.py +0 -1511
  12. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/dead-code-analysis.md +0 -0
  13. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/publish-pypi.md +0 -0
  14. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/review-implementation.md +0 -0
  15. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/run-tests.md +0 -0
  16. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/update-and-commit.md +0 -0
  17. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/dev/update-memory-bank.md +0 -0
  18. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/.claude/commands/test/run-reference-tests.md +0 -0
  19. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/LICENSE +0 -0
  20. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/MANIFEST.in +0 -0
  21. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/examples/advanced_usage.py +0 -0
  22. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/examples/basic_usage.py +0 -0
  23. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/examples/mcp_basic_example.py +0 -0
  24. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/examples/mcp_integration.py +0 -0
  25. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/__init__.py +0 -0
  26. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/__init__.py +0 -0
  27. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/components.py +0 -0
  28. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/formatter.py +0 -0
  29. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/ic_manager.py +0 -0
  30. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/junctions.py +0 -0
  31. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/parser.py +0 -0
  32. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/schematic.py +0 -0
  33. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/types.py +0 -0
  34. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/core/wires.py +0 -0
  35. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/discovery/__init__.py +0 -0
  36. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/discovery/search_index.py +0 -0
  37. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/library/__init__.py +0 -0
  38. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/library/cache.py +0 -0
  39. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/py.typed +0 -0
  40. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/utils/__init__.py +0 -0
  41. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api/utils/validation.py +0 -0
  42. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/dependency_links.txt +0 -0
  43. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/kicad_sch_api.egg-info/top_level.txt +0 -0
  44. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/setup.cfg +0 -0
  45. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/README.md +0 -0
  46. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_pro +0 -0
  47. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_sch +0 -0
  48. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_pro +0 -0
  49. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/multi_unit_7400/multi_unit_7400.kicad_sch +0 -0
  50. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_pro +0 -0
  51. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/power_symbols/power_symbols.kicad_sch +0 -0
  52. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_pro +0 -0
  53. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_sch +0 -0
  54. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_pro +0 -0
  55. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/sch_title/sch_title.kicad_sch +0 -0
  56. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_pro +0 -0
  57. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_extended_component/single_extended_component.kicad_sch +0 -0
  58. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_pro +0 -0
  59. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_sch +0 -0
  60. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_hierarchical_sheet/subcircuit1.kicad_sch +0 -0
  61. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_pro +0 -0
  62. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_label/single_label.kicad_sch +0 -0
  63. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_pro +0 -0
  64. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_sch +0 -0
  65. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_pro +0 -0
  66. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_resistor/single_resistor.kicad_sch +0 -0
  67. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_pro +0 -0
  68. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_text/single_text.kicad_sch +0 -0
  69. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_pro +0 -0
  70. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_text_box/single_text_box.kicad_sch +0 -0
  71. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_pro +0 -0
  72. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/single_wire/single_wire.kicad_sch +0 -0
  73. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_pro +0 -0
  74. {kicad_sch_api-0.1.7 → kicad_sch_api-0.2.0}/tests/reference_tests/reference_kicad_projects/two_resistors/two_resistors.kicad_sch +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kicad-sch-api
3
- Version: 0.1.7
4
- Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
3
+ Version: 0.2.0
4
+ Summary: Professional KiCAD schematic manipulation library with exact format preservation
5
5
  Author-email: Circuit-Synth <shane@circuit-synth.com>
6
6
  Maintainer-email: Circuit-Synth <shane@circuit-synth.com>
7
7
  License-Expression: MIT
@@ -25,8 +25,6 @@ Classifier: Operating System :: OS Independent
25
25
  Requires-Python: >=3.10
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
- Requires-Dist: fastmcp>=2.0.0
29
- Requires-Dist: mcp[cli]>=1.13.0
30
28
  Requires-Dist: sexpdata>=0.0.3
31
29
  Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
32
30
  Provides-Extra: dev
@@ -38,9 +36,6 @@ Requires-Dist: isort>=5.0.0; extra == "dev"
38
36
  Requires-Dist: flake8>=4.0.0; extra == "dev"
39
37
  Requires-Dist: mypy>=1.0.0; extra == "dev"
40
38
  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
39
  Provides-Extra: docs
45
40
  Requires-Dist: sphinx>=5.0.0; extra == "docs"
46
41
  Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
@@ -173,20 +168,28 @@ netlist = sch.generate_netlist()
173
168
  net_info = netlist.analyze_net("VCC")
174
169
  ```
175
170
 
176
- ## 🤖 AI Agent Integration (MCP Server)
171
+ ## 🤖 AI Agent Integration
177
172
 
178
- Use with Claude Code or other AI agents via Model Context Protocol:
173
+ This library serves as the foundational layer for AI agent integration through dedicated MCP (Model Context Protocol) servers.
179
174
 
180
- ### Setup MCP Server
175
+ ### MCP Server Integration
181
176
 
182
177
  ```bash
183
- # Install MCP server
184
- pip install kicad-sch-api[mcp]
178
+ # Install the dedicated MCP server (separate package)
179
+ pip install mcp-kicad-sch-api
185
180
 
186
- # Configure for Claude Code (automatic)
187
- kicad-sch-api --setup-claude-code
181
+ # Configure for Claude Code
182
+ code mcp install mcp-kicad-sch-api
188
183
  ```
189
184
 
185
+ ### Library Design for MCP Compatibility
186
+
187
+ This library is specifically designed to provide:
188
+ - **Stable API**: Consistent interface for MCP servers to build upon
189
+ - **Format Preservation**: Guaranteed exact KiCAD output for reliable automation
190
+ - **Professional Validation**: Component and library validation for quality assurance
191
+ - **Performance**: Optimized for AI agent workloads with caching and bulk operations
192
+
190
193
  ### Usage with AI Agents
191
194
 
192
195
  ```
@@ -196,23 +199,8 @@ kicad-sch-api --setup-claude-code
196
199
  "Generate a hierarchical schematic with power supply subcircuit"
197
200
  ```
198
201
 
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 |
202
+ **Related MCP Servers:**
203
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: Full-featured MCP server built on this library
216
204
 
217
205
  ## 🏗️ Architecture
218
206
 
@@ -223,7 +211,6 @@ kicad_sch_api/
223
211
  ├── core/ # Core schematic manipulation
224
212
  ├── library/ # KiCAD library integration
225
213
  ├── integration/ # KiCAD CLI and tool integration
226
- ├── mcp/ # MCP server for AI agents
227
214
  └── utils/ # Validation and utilities
228
215
  ```
229
216
 
@@ -232,7 +219,7 @@ kicad_sch_api/
232
219
  - **Building Block First**: Designed to be the foundation for other tools
233
220
  - **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
234
221
  - **Professional Quality**: Comprehensive error handling and validation
235
- - **AI-Native**: Built specifically for AI agent integration
222
+ - **MCP Foundation**: Designed as a stable foundation for MCP servers and AI agents
236
223
  - **Performance Optimized**: Fast operations on large schematics
237
224
 
238
225
  ## 🧪 Testing & Quality
@@ -266,26 +253,27 @@ uv run flake8 kicad_sch_api/ tests/
266
253
 
267
254
  ## 🔗 Ecosystem
268
255
 
269
- This library is designed as a building block for specialized tools:
256
+ This library serves as the foundation for specialized tools and MCP servers:
270
257
 
271
258
  ```python
272
259
  # Foundation library
273
260
  import kicad_sch_api as ksa
274
261
 
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
262
+ # MCP servers and specialized libraries built on this foundation:
263
+ # - mcp-kicad-sch-api: Full MCP server for AI agents
264
+ # - kicad_sourcing_tools: Component sourcing extensions
265
+ # - kicad_placement_optimizer: Layout optimization
266
+ # - kicad_dfm_checker: Manufacturing validation
279
267
 
280
268
  # Foundation provides reliable schematic manipulation
281
269
  sch = ksa.load_schematic('project.kicad_sch')
282
270
 
283
- # Specialized tools extend functionality
284
- # sourcing.update_component_sourcing(sch.components)
285
- # placement.optimize_layout(sch)
286
- # dfm.check_manufacturing_rules(sch)
271
+ # All extensions use the same stable API
272
+ # mcp_server.use_schematic(sch) # MCP server integration
273
+ # sourcing.update_sourcing(sch) # Component sourcing
274
+ # placement.optimize_layout(sch) # Layout optimization
287
275
 
288
- # All save through foundation's format preservation
276
+ # Foundation ensures exact format preservation
289
277
  sch.save() # Guaranteed exact KiCAD format
290
278
  ```
291
279
 
@@ -313,6 +301,7 @@ MIT License - see [LICENSE](LICENSE) for details.
313
301
 
314
302
  ## 🔗 Related Projects
315
303
 
304
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: MCP server for AI agents built on this library
316
305
  - **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
317
306
  - **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
318
307
  - **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
@@ -124,20 +124,28 @@ netlist = sch.generate_netlist()
124
124
  net_info = netlist.analyze_net("VCC")
125
125
  ```
126
126
 
127
- ## 🤖 AI Agent Integration (MCP Server)
127
+ ## 🤖 AI Agent Integration
128
128
 
129
- Use with Claude Code or other AI agents via Model Context Protocol:
129
+ This library serves as the foundational layer for AI agent integration through dedicated MCP (Model Context Protocol) servers.
130
130
 
131
- ### Setup MCP Server
131
+ ### MCP Server Integration
132
132
 
133
133
  ```bash
134
- # Install MCP server
135
- pip install kicad-sch-api[mcp]
134
+ # Install the dedicated MCP server (separate package)
135
+ pip install mcp-kicad-sch-api
136
136
 
137
- # Configure for Claude Code (automatic)
138
- kicad-sch-api --setup-claude-code
137
+ # Configure for Claude Code
138
+ code mcp install mcp-kicad-sch-api
139
139
  ```
140
140
 
141
+ ### Library Design for MCP Compatibility
142
+
143
+ This library is specifically designed to provide:
144
+ - **Stable API**: Consistent interface for MCP servers to build upon
145
+ - **Format Preservation**: Guaranteed exact KiCAD output for reliable automation
146
+ - **Professional Validation**: Component and library validation for quality assurance
147
+ - **Performance**: Optimized for AI agent workloads with caching and bulk operations
148
+
141
149
  ### Usage with AI Agents
142
150
 
143
151
  ```
@@ -147,23 +155,8 @@ kicad-sch-api --setup-claude-code
147
155
  "Generate a hierarchical schematic with power supply subcircuit"
148
156
  ```
149
157
 
150
- The AI agent will use the MCP server to:
151
- 1. Create professional schematics with proper component references
152
- 2. Use hierarchical labels instead of messy wires
153
- 3. Apply KiCAD design best practices automatically
154
- 4. Generate clean, industry-standard layouts
155
-
156
- ### Available MCP Tools
157
-
158
- | Tool | Description |
159
- |------|-------------|
160
- | `create_schematic` | Create new schematic files |
161
- | `add_component` | Add components with validation |
162
- | `search_components` | Find components in KiCAD libraries |
163
- | `add_hierarchical_sheet` | Create multi-sheet designs |
164
- | `validate_component` | Check component/footprint compatibility |
165
- | `list_components` | Get all components in schematic |
166
- | `save_schematic` | Save with exact format preservation |
158
+ **Related MCP Servers:**
159
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: Full-featured MCP server built on this library
167
160
 
168
161
  ## 🏗️ Architecture
169
162
 
@@ -174,7 +167,6 @@ kicad_sch_api/
174
167
  ├── core/ # Core schematic manipulation
175
168
  ├── library/ # KiCAD library integration
176
169
  ├── integration/ # KiCAD CLI and tool integration
177
- ├── mcp/ # MCP server for AI agents
178
170
  └── utils/ # Validation and utilities
179
171
  ```
180
172
 
@@ -183,7 +175,7 @@ kicad_sch_api/
183
175
  - **Building Block First**: Designed to be the foundation for other tools
184
176
  - **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
185
177
  - **Professional Quality**: Comprehensive error handling and validation
186
- - **AI-Native**: Built specifically for AI agent integration
178
+ - **MCP Foundation**: Designed as a stable foundation for MCP servers and AI agents
187
179
  - **Performance Optimized**: Fast operations on large schematics
188
180
 
189
181
  ## 🧪 Testing & Quality
@@ -217,26 +209,27 @@ uv run flake8 kicad_sch_api/ tests/
217
209
 
218
210
  ## 🔗 Ecosystem
219
211
 
220
- This library is designed as a building block for specialized tools:
212
+ This library serves as the foundation for specialized tools and MCP servers:
221
213
 
222
214
  ```python
223
215
  # Foundation library
224
216
  import kicad_sch_api as ksa
225
217
 
226
- # Specialized libraries (examples of what could be built)
227
- # import kicad_sourcing_tools as sourcing # Component sourcing
228
- # import kicad_placement_optimizer as placement # Layout optimization
229
- # import kicad_dfm_checker as dfm # Manufacturing validation
218
+ # MCP servers and specialized libraries built on this foundation:
219
+ # - mcp-kicad-sch-api: Full MCP server for AI agents
220
+ # - kicad_sourcing_tools: Component sourcing extensions
221
+ # - kicad_placement_optimizer: Layout optimization
222
+ # - kicad_dfm_checker: Manufacturing validation
230
223
 
231
224
  # Foundation provides reliable schematic manipulation
232
225
  sch = ksa.load_schematic('project.kicad_sch')
233
226
 
234
- # Specialized tools extend functionality
235
- # sourcing.update_component_sourcing(sch.components)
236
- # placement.optimize_layout(sch)
237
- # dfm.check_manufacturing_rules(sch)
227
+ # All extensions use the same stable API
228
+ # mcp_server.use_schematic(sch) # MCP server integration
229
+ # sourcing.update_sourcing(sch) # Component sourcing
230
+ # placement.optimize_layout(sch) # Layout optimization
238
231
 
239
- # All save through foundation's format preservation
232
+ # Foundation ensures exact format preservation
240
233
  sch.save() # Guaranteed exact KiCAD format
241
234
  ```
242
235
 
@@ -264,6 +257,7 @@ MIT License - see [LICENSE](LICENSE) for details.
264
257
 
265
258
  ## 🔗 Related Projects
266
259
 
260
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: MCP server for AI agents built on this library
267
261
  - **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
268
262
  - **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
269
263
  - **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
@@ -0,0 +1,242 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ KiCAD Schematic API - Command Line Interface
4
+
5
+ Provides helpful commands for testing and usage of the library.
6
+ """
7
+
8
+ import sys
9
+ import subprocess
10
+ import argparse
11
+ from pathlib import Path
12
+
13
+
14
+ def test_installation() -> bool:
15
+ """Test that the library is working correctly."""
16
+ print("🧪 Testing KiCAD Schematic API Library...")
17
+
18
+ try:
19
+ # Test basic import
20
+ import kicad_sch_api
21
+ version = getattr(kicad_sch_api, '__version__', 'unknown')
22
+ print(f"✅ Library imports successfully: v{version}")
23
+
24
+ # Test core functionality
25
+ import kicad_sch_api as ksa
26
+ sch = ksa.create_schematic("test")
27
+ print("✅ Can create schematic")
28
+
29
+ # Test component addition
30
+ sch.components.add(
31
+ lib_id="Device:R",
32
+ reference="R1",
33
+ value="10k",
34
+ position=(100, 100)
35
+ )
36
+ print("✅ Can add components")
37
+
38
+ # Test library access
39
+ from kicad_sch_api.library.cache import get_symbol_cache
40
+ cache = get_symbol_cache()
41
+ stats = cache.get_performance_stats()
42
+ print(f"✅ Symbol cache available: {stats['total_symbols_cached']} symbols")
43
+
44
+ print("🎉 All tests passed!")
45
+ return True
46
+
47
+ except Exception as e:
48
+ print(f"❌ Test failed: {e}")
49
+ return False
50
+
51
+
52
+ def show_status() -> bool:
53
+ """Show current installation status."""
54
+ print("📊 KiCAD Schematic API Library Status")
55
+ print("=" * 40)
56
+
57
+ # Check installation
58
+ try:
59
+ import kicad_sch_api
60
+ version = getattr(kicad_sch_api, '__version__', 'unknown')
61
+ print(f"✅ Library installed: v{version}")
62
+ except ImportError:
63
+ print("❌ Library not installed")
64
+ return False
65
+
66
+ # Check KiCAD libraries
67
+ try:
68
+ from kicad_sch_api.library.cache import get_symbol_cache
69
+ cache = get_symbol_cache()
70
+ stats = cache.get_performance_stats()
71
+ print(f"✅ KiCAD libraries: {len(cache._lib_stats)} libraries, {stats['total_symbols_cached']} symbols")
72
+ except Exception as e:
73
+ print(f"⚠️ KiCAD library access: {e}")
74
+
75
+ return True
76
+
77
+
78
+ def create_demo() -> bool:
79
+ """Create a demo schematic to test functionality."""
80
+ print("🎨 Creating demo schematic...")
81
+
82
+ try:
83
+ import kicad_sch_api as ksa
84
+
85
+ # Create demo schematic
86
+ sch = ksa.create_schematic("Demo_Circuit")
87
+
88
+ # Add components
89
+ resistor = sch.components.add('Device:R', reference='R1', value='10k', position=(100, 100))
90
+ capacitor = sch.components.add('Device:C', reference='C1', value='100nF', position=(150, 100))
91
+ led = sch.components.add('Device:LED', reference='D1', value='LED', position=(200, 100))
92
+
93
+ # Save schematic
94
+ sch.save("demo_circuit.kicad_sch")
95
+
96
+ print("✅ Demo schematic created: demo_circuit.kicad_sch")
97
+ print("📁 Contains: resistor, capacitor, and LED")
98
+ print("🔗 Try opening in KiCAD: kicad demo_circuit.kicad_sch")
99
+
100
+ return True
101
+
102
+ except Exception as e:
103
+ print(f"❌ Demo creation failed: {e}")
104
+ return False
105
+
106
+
107
+ def init_cache() -> bool:
108
+ """Initialize the component discovery cache."""
109
+ print("🔄 Initializing component discovery cache...")
110
+
111
+ try:
112
+ from kicad_sch_api.discovery.search_index import ensure_index_built
113
+ component_count = ensure_index_built()
114
+ print(f"✅ Component cache initialized: {component_count} components indexed")
115
+ return True
116
+ except Exception as e:
117
+ print(f"❌ Cache initialization failed: {e}")
118
+ return False
119
+
120
+
121
+ def check_kicad() -> bool:
122
+ """Check KiCAD installation and library access."""
123
+ print("🔍 Checking KiCAD installation...")
124
+
125
+ try:
126
+ # Check if KiCAD command is available
127
+ result = subprocess.run(['kicad', '--version'],
128
+ capture_output=True, timeout=10)
129
+ if result.returncode == 0:
130
+ version_output = result.stdout.decode().strip()
131
+ print(f"✅ KiCAD found: {version_output}")
132
+ else:
133
+ print("⚠️ KiCAD command found but version check failed")
134
+ except (subprocess.TimeoutExpired, FileNotFoundError):
135
+ print("❌ KiCAD command not found in PATH")
136
+ print(" Please ensure KiCAD is installed and accessible")
137
+
138
+ # Check library directories
139
+ try:
140
+ from kicad_sch_api.library.cache import get_symbol_cache
141
+ cache = get_symbol_cache()
142
+
143
+ print("📚 KiCAD Library Status:")
144
+ for lib_name, lib_stats in cache._lib_stats.items():
145
+ print(f" • {lib_name}: {lib_stats.symbol_count} symbols")
146
+
147
+ return True
148
+ except Exception as e:
149
+ print(f"❌ Library access failed: {e}")
150
+ return False
151
+
152
+
153
+ def show_mcp_info() -> None:
154
+ """Show information about MCP server integration."""
155
+ print("🤖 MCP Server Integration")
156
+ print("=" * 25)
157
+ print()
158
+ print("This library serves as a foundation for MCP servers.")
159
+ print("For AI agent integration, install the dedicated MCP server:")
160
+ print()
161
+ print(" pip install mcp-kicad-sch-api")
162
+ print(" code mcp install mcp-kicad-sch-api")
163
+ print()
164
+ print("Related projects:")
165
+ print(" • mcp-kicad-sch-api: https://github.com/circuit-synth/mcp-kicad-sch-api")
166
+ print(" • Claude Code: https://claude.ai/code")
167
+
168
+
169
+ def main():
170
+ """Main CLI entry point."""
171
+ parser = argparse.ArgumentParser(
172
+ description="KiCAD Schematic API - Command Line Interface",
173
+ formatter_class=argparse.RawDescriptionHelpFormatter,
174
+ epilog="""
175
+ Examples:
176
+ kicad-sch-api --test # Test library installation
177
+ kicad-sch-api --demo # Create demo schematic
178
+ kicad-sch-api --status # Show library status
179
+ """
180
+ )
181
+
182
+ # Main options
183
+ parser.add_argument('--test', action='store_true',
184
+ help='Test that the library is working')
185
+ parser.add_argument('--status', action='store_true',
186
+ help='Show library installation status')
187
+ parser.add_argument('--demo', action='store_true',
188
+ help='Create a demo schematic')
189
+ parser.add_argument('--init-cache', action='store_true',
190
+ help='Initialize component discovery cache')
191
+ parser.add_argument('--check-kicad', action='store_true',
192
+ help='Check KiCAD installation and libraries')
193
+ parser.add_argument('--mcp-info', action='store_true',
194
+ help='Show MCP server integration information')
195
+
196
+ args = parser.parse_args()
197
+
198
+ # If no arguments provided, show help
199
+ if not any(vars(args).values()):
200
+ print("🚀 KiCAD Schematic API - Command Line Interface")
201
+ print()
202
+ print("This is a pure Python library for KiCAD schematic manipulation.")
203
+ print()
204
+ print("🧪 Test the installation:")
205
+ print(" kicad-sch-api --test")
206
+ print()
207
+ print("🎨 Create a demo schematic:")
208
+ print(" kicad-sch-api --demo")
209
+ print()
210
+ print("🤖 For AI agent integration:")
211
+ print(" kicad-sch-api --mcp-info")
212
+ print()
213
+ print("🆘 For all options:")
214
+ print(" kicad-sch-api --help")
215
+ return
216
+
217
+ # Execute requested actions
218
+ success = True
219
+
220
+ if args.test:
221
+ success &= test_installation()
222
+
223
+ if args.status:
224
+ success &= show_status()
225
+
226
+ if args.demo:
227
+ success &= create_demo()
228
+
229
+ if args.init_cache:
230
+ success &= init_cache()
231
+
232
+ if args.check_kicad:
233
+ success &= check_kicad()
234
+
235
+ if args.mcp_info:
236
+ show_mcp_info()
237
+
238
+ sys.exit(0 if success else 1)
239
+
240
+
241
+ if __name__ == "__main__":
242
+ main()
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kicad-sch-api
3
- Version: 0.1.7
4
- Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
3
+ Version: 0.2.0
4
+ Summary: Professional KiCAD schematic manipulation library with exact format preservation
5
5
  Author-email: Circuit-Synth <shane@circuit-synth.com>
6
6
  Maintainer-email: Circuit-Synth <shane@circuit-synth.com>
7
7
  License-Expression: MIT
@@ -25,8 +25,6 @@ Classifier: Operating System :: OS Independent
25
25
  Requires-Python: >=3.10
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
- Requires-Dist: fastmcp>=2.0.0
29
- Requires-Dist: mcp[cli]>=1.13.0
30
28
  Requires-Dist: sexpdata>=0.0.3
31
29
  Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
32
30
  Provides-Extra: dev
@@ -38,9 +36,6 @@ Requires-Dist: isort>=5.0.0; extra == "dev"
38
36
  Requires-Dist: flake8>=4.0.0; extra == "dev"
39
37
  Requires-Dist: mypy>=1.0.0; extra == "dev"
40
38
  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
39
  Provides-Extra: docs
45
40
  Requires-Dist: sphinx>=5.0.0; extra == "docs"
46
41
  Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
@@ -173,20 +168,28 @@ netlist = sch.generate_netlist()
173
168
  net_info = netlist.analyze_net("VCC")
174
169
  ```
175
170
 
176
- ## 🤖 AI Agent Integration (MCP Server)
171
+ ## 🤖 AI Agent Integration
177
172
 
178
- Use with Claude Code or other AI agents via Model Context Protocol:
173
+ This library serves as the foundational layer for AI agent integration through dedicated MCP (Model Context Protocol) servers.
179
174
 
180
- ### Setup MCP Server
175
+ ### MCP Server Integration
181
176
 
182
177
  ```bash
183
- # Install MCP server
184
- pip install kicad-sch-api[mcp]
178
+ # Install the dedicated MCP server (separate package)
179
+ pip install mcp-kicad-sch-api
185
180
 
186
- # Configure for Claude Code (automatic)
187
- kicad-sch-api --setup-claude-code
181
+ # Configure for Claude Code
182
+ code mcp install mcp-kicad-sch-api
188
183
  ```
189
184
 
185
+ ### Library Design for MCP Compatibility
186
+
187
+ This library is specifically designed to provide:
188
+ - **Stable API**: Consistent interface for MCP servers to build upon
189
+ - **Format Preservation**: Guaranteed exact KiCAD output for reliable automation
190
+ - **Professional Validation**: Component and library validation for quality assurance
191
+ - **Performance**: Optimized for AI agent workloads with caching and bulk operations
192
+
190
193
  ### Usage with AI Agents
191
194
 
192
195
  ```
@@ -196,23 +199,8 @@ kicad-sch-api --setup-claude-code
196
199
  "Generate a hierarchical schematic with power supply subcircuit"
197
200
  ```
198
201
 
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 |
202
+ **Related MCP Servers:**
203
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: Full-featured MCP server built on this library
216
204
 
217
205
  ## 🏗️ Architecture
218
206
 
@@ -223,7 +211,6 @@ kicad_sch_api/
223
211
  ├── core/ # Core schematic manipulation
224
212
  ├── library/ # KiCAD library integration
225
213
  ├── integration/ # KiCAD CLI and tool integration
226
- ├── mcp/ # MCP server for AI agents
227
214
  └── utils/ # Validation and utilities
228
215
  ```
229
216
 
@@ -232,7 +219,7 @@ kicad_sch_api/
232
219
  - **Building Block First**: Designed to be the foundation for other tools
233
220
  - **Exact Format Preservation**: Guaranteed byte-perfect KiCAD output
234
221
  - **Professional Quality**: Comprehensive error handling and validation
235
- - **AI-Native**: Built specifically for AI agent integration
222
+ - **MCP Foundation**: Designed as a stable foundation for MCP servers and AI agents
236
223
  - **Performance Optimized**: Fast operations on large schematics
237
224
 
238
225
  ## 🧪 Testing & Quality
@@ -266,26 +253,27 @@ uv run flake8 kicad_sch_api/ tests/
266
253
 
267
254
  ## 🔗 Ecosystem
268
255
 
269
- This library is designed as a building block for specialized tools:
256
+ This library serves as the foundation for specialized tools and MCP servers:
270
257
 
271
258
  ```python
272
259
  # Foundation library
273
260
  import kicad_sch_api as ksa
274
261
 
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
262
+ # MCP servers and specialized libraries built on this foundation:
263
+ # - mcp-kicad-sch-api: Full MCP server for AI agents
264
+ # - kicad_sourcing_tools: Component sourcing extensions
265
+ # - kicad_placement_optimizer: Layout optimization
266
+ # - kicad_dfm_checker: Manufacturing validation
279
267
 
280
268
  # Foundation provides reliable schematic manipulation
281
269
  sch = ksa.load_schematic('project.kicad_sch')
282
270
 
283
- # Specialized tools extend functionality
284
- # sourcing.update_component_sourcing(sch.components)
285
- # placement.optimize_layout(sch)
286
- # dfm.check_manufacturing_rules(sch)
271
+ # All extensions use the same stable API
272
+ # mcp_server.use_schematic(sch) # MCP server integration
273
+ # sourcing.update_sourcing(sch) # Component sourcing
274
+ # placement.optimize_layout(sch) # Layout optimization
287
275
 
288
- # All save through foundation's format preservation
276
+ # Foundation ensures exact format preservation
289
277
  sch.save() # Guaranteed exact KiCAD format
290
278
  ```
291
279
 
@@ -313,6 +301,7 @@ MIT License - see [LICENSE](LICENSE) for details.
313
301
 
314
302
  ## 🔗 Related Projects
315
303
 
304
+ - **[mcp-kicad-sch-api](https://github.com/circuit-synth/mcp-kicad-sch-api)**: MCP server for AI agents built on this library
316
305
  - **[circuit-synth](https://github.com/circuit-synth/circuit-synth)**: High-level circuit design automation using this library
317
306
  - **[Claude Code](https://claude.ai/code)**: AI development environment with MCP support
318
307
  - **[KiCAD](https://kicad.org/)**: Open source electronics design automation suite
@@ -35,8 +35,6 @@ kicad_sch_api/discovery/__init__.py
35
35
  kicad_sch_api/discovery/search_index.py
36
36
  kicad_sch_api/library/__init__.py
37
37
  kicad_sch_api/library/cache.py
38
- kicad_sch_api/mcp/__init__.py
39
- kicad_sch_api/mcp/server.py
40
38
  kicad_sch_api/utils/__init__.py
41
39
  kicad_sch_api/utils/validation.py
42
40
  tests/reference_tests/reference_kicad_projects/README.md