kicad-sch-api 0.0.1__tar.gz → 0.0.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.

Potentially problematic release.


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

Files changed (63) hide show
  1. kicad_sch_api-0.0.2/.claude/commands/dev/update-memory-bank.md +33 -0
  2. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/PKG-INFO +2 -17
  3. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/README.md +0 -13
  4. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/pyproject.toml +11 -7
  5. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/__init__.py +2 -2
  6. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/components.py +6 -2
  7. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/parser.py +37 -15
  8. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/utils/validation.py +3 -3
  9. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api.egg-info/PKG-INFO +2 -17
  10. kicad_sch_api-0.0.2/python/kicad_sch_api.egg-info/SOURCES.txt +31 -0
  11. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api.egg-info/requires.txt +0 -3
  12. kicad_sch_api-0.0.1/mcp-server/package.json +0 -58
  13. kicad_sch_api-0.0.1/mcp-server/src/index.ts +0 -160
  14. kicad_sch_api-0.0.1/mcp-server/src/python-bridge.ts +0 -242
  15. kicad_sch_api-0.0.1/mcp-server/src/schematic-tools.ts +0 -420
  16. kicad_sch_api-0.0.1/mcp-server/tsconfig.json +0 -31
  17. kicad_sch_api-0.0.1/python/kicad_sch_api/mcp/__init__.py +0 -5
  18. kicad_sch_api-0.0.1/python/kicad_sch_api/mcp/server.py +0 -500
  19. kicad_sch_api-0.0.1/python/kicad_sch_api.egg-info/SOURCES.txt +0 -59
  20. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/README.md +0 -228
  21. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_pro +0 -412
  22. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/blank_schematic/blank_schematic.kicad_sch +0 -5
  23. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_pro +0 -417
  24. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/resistor_divider/resistor_divider.kicad_sch +0 -683
  25. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_pro +0 -421
  26. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_hierarchical_sheet/single_hierarchical_sheet.kicad_sch +0 -56
  27. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_hierarchical_sheet/subcircuit1.kicad_sch +0 -8
  28. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_label/single_label.kicad_pro +0 -417
  29. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_label/single_label.kicad_sch +0 -24
  30. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_pro +0 -417
  31. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_label_hierarchical/single_label_hierarchical.kicad_sch +0 -25
  32. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_resistor/single_resistor.kicad_pro +0 -417
  33. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_resistor/single_resistor.kicad_sch +0 -209
  34. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_text/single_text.kicad_pro +0 -417
  35. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_text/single_text.kicad_sch +0 -24
  36. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_text_box/single_text_box.kicad_pro +0 -417
  37. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_text_box/single_text_box.kicad_sch +0 -34
  38. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_wire/single_wire.kicad_pro +0 -417
  39. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/single_wire/single_wire.kicad_sch +0 -24
  40. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/two_resistors/two_resistors.kicad_pro +0 -417
  41. kicad_sch_api-0.0.1/python/tests/reference_kicad_projects/two_resistors/two_resistors.kicad_sch +0 -279
  42. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/dev/dead-code-analysis.md +0 -0
  43. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/dev/publish-pypi.md +0 -0
  44. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/dev/review-implementation.md +0 -0
  45. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/dev/run-tests.md +0 -0
  46. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/dev/update-and-commit.md +0 -0
  47. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/.claude/commands/test/run-reference-tests.md +0 -0
  48. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/CHANGELOG.md +0 -0
  49. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/CONTRIBUTING.md +0 -0
  50. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/LICENSE +0 -0
  51. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/MANIFEST.in +0 -0
  52. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/__init__.py +0 -0
  53. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/formatter.py +0 -0
  54. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/schematic.py +0 -0
  55. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/core/types.py +0 -0
  56. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/library/__init__.py +0 -0
  57. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/library/cache.py +0 -0
  58. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/py.typed +0 -0
  59. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api/utils/__init__.py +0 -0
  60. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api.egg-info/dependency_links.txt +0 -0
  61. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api.egg-info/entry_points.txt +0 -0
  62. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/python/kicad_sch_api.egg-info/top_level.txt +0 -0
  63. {kicad_sch_api-0.0.1 → kicad_sch_api-0.0.2}/setup.cfg +0 -0
@@ -0,0 +1,33 @@
1
+ # Update Memory Bank (UMB)
2
+
3
+ Update the memory bank with current development context and decisions.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ # Command: /umb
9
+ ```
10
+
11
+ Updates the following memory bank files:
12
+ - `.memory_bank/activeContext.md` - Current session state and focus areas
13
+ - `.memory_bank/decisionLog.md` - New technical decisions and architectural choices
14
+ - `.memory_bank/progress.md` - Milestone updates and current tasks
15
+ - `.memory_bank/productContext.md` - Project overview refinements
16
+
17
+ ## When to Use
18
+
19
+ - After completing major features or milestones
20
+ - When making significant architectural decisions
21
+ - At the end of development sessions
22
+ - Before switching development focus areas
23
+ - After resolving complex technical issues
24
+
25
+ ## What Gets Updated
26
+
27
+ The memory bank captures:
28
+ - **Development Context**: Current focus, active files, session goals
29
+ - **Technical Decisions**: API choices, architecture patterns, trade-offs
30
+ - **Progress Tracking**: Completed tasks, next priorities, metrics
31
+ - **Knowledge Patterns**: Reusable solutions, lessons learned
32
+
33
+ This enables AI assistants to maintain rich context about the library's development patterns and architectural evolution.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kicad-sch-api
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
5
5
  Author-email: Circuit-Synth <info@circuit-synth.com>
6
6
  Maintainer-email: Circuit-Synth <info@circuit-synth.com>
@@ -10,7 +10,7 @@ Project-URL: Documentation, https://circuit-synth.github.io/kicad-sch-api/
10
10
  Project-URL: Repository, https://github.com/circuit-synth/kicad-sch-api.git
11
11
  Project-URL: Bug Reports, https://github.com/circuit-synth/kicad-sch-api/issues
12
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,mcp,automation,pcb
13
+ Keywords: kicad,schematic,eda,electronics,circuit-design,ai,automation,pcb
14
14
  Classifier: Development Status :: 4 - Beta
15
15
  Classifier: Intended Audience :: Developers
16
16
  Classifier: Intended Audience :: Science/Research
@@ -28,8 +28,6 @@ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: sexpdata>=0.0.3
30
30
  Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
31
- Provides-Extra: mcp
32
- Requires-Dist: mcp>=0.1.0; extra == "mcp"
33
31
  Provides-Extra: dev
34
32
  Requires-Dist: pytest>=7.0.0; extra == "dev"
35
33
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
@@ -49,13 +47,11 @@ Dynamic: license-file
49
47
 
50
48
  **Professional KiCAD Schematic Manipulation Library with AI Agent Integration**
51
49
 
52
- A modern, high-performance Python library for programmatic manipulation of KiCAD schematic files (.kicad_sch) with exact format preservation, enhanced component management, and native AI agent support via Model Context Protocol (MCP).
53
50
 
54
51
  ## 🚀 Key Features
55
52
 
56
53
  - **📋 Exact Format Preservation**: Output matches KiCAD's native formatting exactly
57
54
  - **⚡ High Performance**: Optimized for large schematics with symbol caching
58
- - **🤖 AI Agent Integration**: Native MCP server for seamless AI agent interaction
59
55
  - **🔧 Enhanced API**: Intuitive object-oriented interface with bulk operations
60
56
  - **📚 Advanced Library Management**: Multi-source symbol lookup and caching
61
57
  - **✅ Professional Validation**: Comprehensive error collection and reporting
@@ -68,7 +64,6 @@ A modern, high-performance Python library for programmatic manipulation of KiCAD
68
64
  | **Schematic Support** | ✅ Full | ✅ Full | ❌ PCB Only |
69
65
  | **Format Preservation** | ✅ Exact | ❌ Basic | N/A |
70
66
  | **Performance** | ✅ Optimized | ⚠️ Basic | N/A |
71
- | **AI Integration** | ✅ Native MCP | ❌ None | ❌ None |
72
67
  | **Library Management** | ✅ Advanced | ⚠️ Basic | N/A |
73
68
  | **Runtime Dependencies** | ❌ None | ❌ None | ✅ KiCAD Required |
74
69
 
@@ -83,8 +78,6 @@ git clone https://github.com/circuit-synth/kicad-sch-api.git
83
78
  cd kicad-sch-api/python
84
79
  pip install -e .
85
80
 
86
- # For AI agent integration (MCP server)
87
- cd ../mcp-server
88
81
  npm install
89
82
  npm run build
90
83
  ```
@@ -141,15 +134,12 @@ stats = sch.get_performance_stats()
141
134
  print(f"Cache hit rate: {stats['symbol_cache']['hit_rate_percent']}%")
142
135
  ```
143
136
 
144
- ### AI Agent Integration (MCP)
145
137
 
146
- Configure in Claude Desktop or compatible MCP client:
147
138
 
148
139
  ```json
149
140
  {
150
141
  "kicad-sch": {
151
142
  "command": "node",
152
- "args": ["/path/to/kicad-sch-api/mcp-server/dist/index.js"],
153
143
  "env": {
154
144
  "PYTHON_PATH": "python3",
155
145
  "KICAD_SCH_API_PATH": "/path/to/kicad-sch-api/python"
@@ -165,7 +155,6 @@ User: "Create a voltage divider circuit with two 10k resistors"
165
155
 
166
156
  Claude: I'll create a voltage divider circuit for you.
167
157
 
168
- [Agent automatically uses MCP tools to:]
169
158
  1. Create new schematic
170
159
  2. Add R1 (10k resistor) at (100, 100)
171
160
  3. Add R2 (10k resistor) at (100, 150)
@@ -187,8 +176,6 @@ The library consists of two main components:
187
176
  - **Symbol Caching**: High-performance library symbol management
188
177
  - **Comprehensive Validation**: Error collection and professional reporting
189
178
 
190
- ### MCP Server (AI Integration)
191
- - **TypeScript MCP Server**: Implements Anthropic's MCP specification
192
179
  - **Python Bridge**: Reliable subprocess communication
193
180
  - **Comprehensive Tools**: 15+ tools for complete schematic manipulation
194
181
  - **Professional Error Handling**: Detailed error context for AI agents
@@ -200,8 +187,6 @@ The library consists of two main components:
200
187
  cd python
201
188
  python -m pytest tests/ -v --cov=kicad_sch_api
202
189
 
203
- # MCP server tests
204
- cd mcp-server
205
190
  npm test
206
191
 
207
192
  # Format preservation tests
@@ -2,13 +2,11 @@
2
2
 
3
3
  **Professional KiCAD Schematic Manipulation Library with AI Agent Integration**
4
4
 
5
- A modern, high-performance Python library for programmatic manipulation of KiCAD schematic files (.kicad_sch) with exact format preservation, enhanced component management, and native AI agent support via Model Context Protocol (MCP).
6
5
 
7
6
  ## 🚀 Key Features
8
7
 
9
8
  - **📋 Exact Format Preservation**: Output matches KiCAD's native formatting exactly
10
9
  - **⚡ High Performance**: Optimized for large schematics with symbol caching
11
- - **🤖 AI Agent Integration**: Native MCP server for seamless AI agent interaction
12
10
  - **🔧 Enhanced API**: Intuitive object-oriented interface with bulk operations
13
11
  - **📚 Advanced Library Management**: Multi-source symbol lookup and caching
14
12
  - **✅ Professional Validation**: Comprehensive error collection and reporting
@@ -21,7 +19,6 @@ A modern, high-performance Python library for programmatic manipulation of KiCAD
21
19
  | **Schematic Support** | ✅ Full | ✅ Full | ❌ PCB Only |
22
20
  | **Format Preservation** | ✅ Exact | ❌ Basic | N/A |
23
21
  | **Performance** | ✅ Optimized | ⚠️ Basic | N/A |
24
- | **AI Integration** | ✅ Native MCP | ❌ None | ❌ None |
25
22
  | **Library Management** | ✅ Advanced | ⚠️ Basic | N/A |
26
23
  | **Runtime Dependencies** | ❌ None | ❌ None | ✅ KiCAD Required |
27
24
 
@@ -36,8 +33,6 @@ git clone https://github.com/circuit-synth/kicad-sch-api.git
36
33
  cd kicad-sch-api/python
37
34
  pip install -e .
38
35
 
39
- # For AI agent integration (MCP server)
40
- cd ../mcp-server
41
36
  npm install
42
37
  npm run build
43
38
  ```
@@ -94,15 +89,12 @@ stats = sch.get_performance_stats()
94
89
  print(f"Cache hit rate: {stats['symbol_cache']['hit_rate_percent']}%")
95
90
  ```
96
91
 
97
- ### AI Agent Integration (MCP)
98
92
 
99
- Configure in Claude Desktop or compatible MCP client:
100
93
 
101
94
  ```json
102
95
  {
103
96
  "kicad-sch": {
104
97
  "command": "node",
105
- "args": ["/path/to/kicad-sch-api/mcp-server/dist/index.js"],
106
98
  "env": {
107
99
  "PYTHON_PATH": "python3",
108
100
  "KICAD_SCH_API_PATH": "/path/to/kicad-sch-api/python"
@@ -118,7 +110,6 @@ User: "Create a voltage divider circuit with two 10k resistors"
118
110
 
119
111
  Claude: I'll create a voltage divider circuit for you.
120
112
 
121
- [Agent automatically uses MCP tools to:]
122
113
  1. Create new schematic
123
114
  2. Add R1 (10k resistor) at (100, 100)
124
115
  3. Add R2 (10k resistor) at (100, 150)
@@ -140,8 +131,6 @@ The library consists of two main components:
140
131
  - **Symbol Caching**: High-performance library symbol management
141
132
  - **Comprehensive Validation**: Error collection and professional reporting
142
133
 
143
- ### MCP Server (AI Integration)
144
- - **TypeScript MCP Server**: Implements Anthropic's MCP specification
145
134
  - **Python Bridge**: Reliable subprocess communication
146
135
  - **Comprehensive Tools**: 15+ tools for complete schematic manipulation
147
136
  - **Professional Error Handling**: Detailed error context for AI agents
@@ -153,8 +142,6 @@ The library consists of two main components:
153
142
  cd python
154
143
  python -m pytest tests/ -v --cov=kicad_sch_api
155
144
 
156
- # MCP server tests
157
- cd mcp-server
158
145
  npm test
159
146
 
160
147
  # Format preservation tests
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kicad-sch-api"
7
- version = "0.0.1"
7
+ version = "0.0.2"
8
8
  description = "Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -16,7 +16,7 @@ maintainers = [
16
16
  ]
17
17
  keywords = [
18
18
  "kicad", "schematic", "eda", "electronics", "circuit-design",
19
- "ai", "mcp", "automation", "pcb"
19
+ "ai", "automation", "pcb"
20
20
  ]
21
21
  classifiers = [
22
22
  "Development Status :: 4 - Beta",
@@ -39,9 +39,6 @@ dependencies = [
39
39
  ]
40
40
 
41
41
  [project.optional-dependencies]
42
- mcp = [
43
- "mcp>=0.1.0",
44
- ]
45
42
  dev = [
46
43
  "pytest>=7.0.0",
47
44
  "pytest-cov>=4.0.0",
@@ -81,7 +78,7 @@ exclude = ["tests*"]
81
78
  kicad_sch_api = ["py.typed"]
82
79
 
83
80
  [tool.pytest.ini_options]
84
- testpaths = ["python/tests"]
81
+ testpaths = ["tests"]
85
82
  python_files = ["test_*.py"]
86
83
  python_classes = ["Test*"]
87
84
  python_functions = ["test_*"]
@@ -179,4 +176,11 @@ exclude_lines = [
179
176
  "if __name__ == .__main__.:",
180
177
  "class .*\\bProtocol\\):",
181
178
  "@(abc\\.)?abstractmethod",
182
- ]
179
+ ]
180
+
181
+ [dependency-groups]
182
+ dev = [
183
+ "build>=1.3.0",
184
+ "pytest-cov>=6.2.1",
185
+ "twine>=6.1.0",
186
+ ]
@@ -42,7 +42,7 @@ Advanced Usage:
42
42
  print(f"Found {len(issues)} validation issues")
43
43
  """
44
44
 
45
- __version__ = "0.0.1"
45
+ __version__ = "0.0.2"
46
46
  __author__ = "Circuit-Synth"
47
47
  __email__ = "info@circuit-synth.com"
48
48
 
@@ -54,7 +54,7 @@ from .library.cache import SymbolLibraryCache, get_symbol_cache
54
54
  from .utils.validation import ValidationError, ValidationIssue
55
55
 
56
56
  # Version info
57
- VERSION_INFO = (0, 0, 1)
57
+ VERSION_INFO = (0, 0, 2)
58
58
 
59
59
  # Public API
60
60
  __all__ = [
@@ -471,9 +471,13 @@ class ComponentCollection:
471
471
  matching = self.filter(**criteria)
472
472
 
473
473
  for component in matching:
474
- # Update basic properties
474
+ # Update basic properties and handle special cases
475
475
  for key, value in updates.items():
476
- if hasattr(component, key):
476
+ if key == 'properties' and isinstance(value, dict):
477
+ # Handle properties dictionary specially
478
+ for prop_name, prop_value in value.items():
479
+ component.set_property(prop_name, str(prop_value))
480
+ elif hasattr(component, key) and key not in ['properties']:
477
481
  setattr(component, key, value)
478
482
  else:
479
483
  # Add as custom property
@@ -200,7 +200,7 @@ class SExpressionParser:
200
200
  element_type = str(item[0]) if isinstance(item[0], sexpdata.Symbol) else None
201
201
 
202
202
  if element_type == "version":
203
- schematic_data["version"] = item[1] if len(item) > 1 else None
203
+ schematic_data["version"] = str(item[1]) if len(item) > 1 else None
204
204
  elif element_type == "generator":
205
205
  schematic_data["generator"] = item[1] if len(item) > 1 else None
206
206
  elif element_type == "uuid":
@@ -244,9 +244,9 @@ class SExpressionParser:
244
244
  if schematic_data.get("title_block"):
245
245
  sexp_data.append(self._title_block_to_sexp(schematic_data["title_block"]))
246
246
 
247
- # Add lib_symbols
248
- if schematic_data.get("lib_symbols"):
249
- sexp_data.append(self._lib_symbols_to_sexp(schematic_data["lib_symbols"]))
247
+ # Add lib_symbols (always include for KiCAD compatibility)
248
+ lib_symbols = schematic_data.get("lib_symbols", {})
249
+ sexp_data.append(self._lib_symbols_to_sexp(lib_symbols))
250
250
 
251
251
  # Add components
252
252
  for component in schematic_data.get("components", []):
@@ -264,6 +264,11 @@ class SExpressionParser:
264
264
  for label in schematic_data.get("labels", []):
265
265
  sexp_data.append(self._label_to_sexp(label))
266
266
 
267
+ # Add symbol_instances (required by KiCAD)
268
+ symbol_instances = schematic_data.get("symbol_instances", [])
269
+ if symbol_instances or schematic_data.get("components"):
270
+ sexp_data.append([sexpdata.Symbol("symbol_instances")])
271
+
267
272
  return sexp_data
268
273
 
269
274
  def _parse_title_block(self, item: List[Any]) -> Dict[str, Any]:
@@ -321,7 +326,11 @@ class SExpressionParser:
321
326
  elif prop_name == "Footprint":
322
327
  symbol_data["footprint"] = prop_data.get("value")
323
328
  else:
324
- symbol_data["properties"][prop_name] = prop_data.get("value")
329
+ # Unescape quotes in property values when loading
330
+ prop_value = prop_data.get("value")
331
+ if prop_value:
332
+ prop_value = str(prop_value).replace('\\"', '"')
333
+ symbol_data["properties"][prop_name] = prop_value
325
334
  elif element_type == "in_bom":
326
335
  symbol_data["in_bom"] = sub_item[1] == "yes" if len(sub_item) > 1 else True
327
336
  elif element_type == "on_board":
@@ -379,13 +388,15 @@ class SExpressionParser:
379
388
  if symbol_data.get("lib_id"):
380
389
  sexp.append([sexpdata.Symbol("lib_id"), symbol_data["lib_id"]])
381
390
 
382
- # Add position and rotation
391
+ # Add position and rotation (preserve original format)
383
392
  pos = symbol_data.get("position", Point(0, 0))
384
393
  rotation = symbol_data.get("rotation", 0)
385
- if rotation != 0:
386
- sexp.append([sexpdata.Symbol("at"), pos.x, pos.y, rotation])
387
- else:
388
- sexp.append([sexpdata.Symbol("at"), pos.x, pos.y])
394
+ # Format numbers as integers if they are whole numbers
395
+ x = int(pos.x) if pos.x == int(pos.x) else pos.x
396
+ y = int(pos.y) if pos.y == int(pos.y) else pos.y
397
+ r = int(rotation) if rotation == int(rotation) else rotation
398
+ # Always include rotation for format consistency with KiCAD
399
+ sexp.append([sexpdata.Symbol("at"), x, y, r])
389
400
 
390
401
  if symbol_data.get("uuid"):
391
402
  sexp.append([sexpdata.Symbol("uuid"), symbol_data["uuid"]])
@@ -395,11 +406,14 @@ class SExpressionParser:
395
406
  sexp.append([sexpdata.Symbol("property"), "Reference", symbol_data["reference"]])
396
407
  if symbol_data.get("value"):
397
408
  sexp.append([sexpdata.Symbol("property"), "Value", symbol_data["value"]])
398
- if symbol_data.get("footprint"):
399
- sexp.append([sexpdata.Symbol("property"), "Footprint", symbol_data["footprint"]])
409
+ footprint = symbol_data.get("footprint")
410
+ if footprint is not None: # Include empty strings but not None
411
+ sexp.append([sexpdata.Symbol("property"), "Footprint", footprint])
400
412
 
401
413
  for prop_name, prop_value in symbol_data.get("properties", {}).items():
402
- sexp.append([sexpdata.Symbol("property"), prop_name, prop_value])
414
+ # Escape quotes in property values for proper S-expression format
415
+ escaped_value = str(prop_value).replace('"', '\\"')
416
+ sexp.append([sexpdata.Symbol("property"), prop_name, escaped_value])
403
417
 
404
418
  # Add BOM and board settings
405
419
  sexp.append([sexpdata.Symbol("in_bom"), "yes" if symbol_data.get("in_bom", True) else "no"])
@@ -426,8 +440,16 @@ class SExpressionParser:
426
440
 
427
441
  def _lib_symbols_to_sexp(self, lib_symbols: Dict[str, Any]) -> List[Any]:
428
442
  """Convert lib_symbols to S-expression."""
429
- # Implementation for lib_symbols conversion
430
- return [sexpdata.Symbol("lib_symbols")]
443
+ sexp = [sexpdata.Symbol("lib_symbols")]
444
+
445
+ # Add each symbol definition
446
+ for symbol_name, symbol_def in lib_symbols.items():
447
+ if isinstance(symbol_def, dict):
448
+ symbol_sexp = [sexpdata.Symbol("symbol"), symbol_name]
449
+ # Add symbol definition details (for now, basic structure)
450
+ sexp.append(symbol_sexp)
451
+
452
+ return sexp
431
453
 
432
454
  def get_validation_issues(self) -> List[ValidationIssue]:
433
455
  """Get list of validation issues from last parse operation."""
@@ -87,7 +87,7 @@ class SchematicValidator:
87
87
  """
88
88
  self.strict = strict
89
89
  self.issues = []
90
- self._valid_reference_pattern = re.compile(r"^[A-Z]+[0-9]*$")
90
+ self._valid_reference_pattern = re.compile(r"^(#[A-Z]+[0-9]+|[A-Z]+[0-9]*)$")
91
91
  self._valid_lib_id_pattern = re.compile(r"^[^:]+:[^:]+$")
92
92
 
93
93
  def validate_schematic_data(self, schematic_data: Dict[str, Any]) -> List[ValidationIssue]:
@@ -133,7 +133,7 @@ class SchematicValidator:
133
133
  Validate component reference format.
134
134
 
135
135
  Args:
136
- reference: Reference to validate (e.g., "R1", "U5")
136
+ reference: Reference to validate (e.g., "R1", "U5", "#PWR01")
137
137
 
138
138
  Returns:
139
139
  True if reference is valid
@@ -231,7 +231,7 @@ class SchematicValidator:
231
231
  message=f"{context}: Invalid reference format: {reference}",
232
232
  level=ValidationLevel.ERROR,
233
233
  context={"reference": reference},
234
- suggestion="Reference should match pattern: [A-Z]+[0-9]*",
234
+ suggestion="Reference should match pattern: [A-Z]+[0-9]* or #[A-Z]+[0-9]* (for power symbols)",
235
235
  )
236
236
  )
237
237
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kicad-sch-api
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: Professional KiCAD schematic manipulation library with exact format preservation and AI agent integration
5
5
  Author-email: Circuit-Synth <info@circuit-synth.com>
6
6
  Maintainer-email: Circuit-Synth <info@circuit-synth.com>
@@ -10,7 +10,7 @@ Project-URL: Documentation, https://circuit-synth.github.io/kicad-sch-api/
10
10
  Project-URL: Repository, https://github.com/circuit-synth/kicad-sch-api.git
11
11
  Project-URL: Bug Reports, https://github.com/circuit-synth/kicad-sch-api/issues
12
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,mcp,automation,pcb
13
+ Keywords: kicad,schematic,eda,electronics,circuit-design,ai,automation,pcb
14
14
  Classifier: Development Status :: 4 - Beta
15
15
  Classifier: Intended Audience :: Developers
16
16
  Classifier: Intended Audience :: Science/Research
@@ -28,8 +28,6 @@ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: sexpdata>=0.0.3
30
30
  Requires-Dist: typing-extensions>=4.0.0; python_version < "3.11"
31
- Provides-Extra: mcp
32
- Requires-Dist: mcp>=0.1.0; extra == "mcp"
33
31
  Provides-Extra: dev
34
32
  Requires-Dist: pytest>=7.0.0; extra == "dev"
35
33
  Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
@@ -49,13 +47,11 @@ Dynamic: license-file
49
47
 
50
48
  **Professional KiCAD Schematic Manipulation Library with AI Agent Integration**
51
49
 
52
- A modern, high-performance Python library for programmatic manipulation of KiCAD schematic files (.kicad_sch) with exact format preservation, enhanced component management, and native AI agent support via Model Context Protocol (MCP).
53
50
 
54
51
  ## 🚀 Key Features
55
52
 
56
53
  - **📋 Exact Format Preservation**: Output matches KiCAD's native formatting exactly
57
54
  - **⚡ High Performance**: Optimized for large schematics with symbol caching
58
- - **🤖 AI Agent Integration**: Native MCP server for seamless AI agent interaction
59
55
  - **🔧 Enhanced API**: Intuitive object-oriented interface with bulk operations
60
56
  - **📚 Advanced Library Management**: Multi-source symbol lookup and caching
61
57
  - **✅ Professional Validation**: Comprehensive error collection and reporting
@@ -68,7 +64,6 @@ A modern, high-performance Python library for programmatic manipulation of KiCAD
68
64
  | **Schematic Support** | ✅ Full | ✅ Full | ❌ PCB Only |
69
65
  | **Format Preservation** | ✅ Exact | ❌ Basic | N/A |
70
66
  | **Performance** | ✅ Optimized | ⚠️ Basic | N/A |
71
- | **AI Integration** | ✅ Native MCP | ❌ None | ❌ None |
72
67
  | **Library Management** | ✅ Advanced | ⚠️ Basic | N/A |
73
68
  | **Runtime Dependencies** | ❌ None | ❌ None | ✅ KiCAD Required |
74
69
 
@@ -83,8 +78,6 @@ git clone https://github.com/circuit-synth/kicad-sch-api.git
83
78
  cd kicad-sch-api/python
84
79
  pip install -e .
85
80
 
86
- # For AI agent integration (MCP server)
87
- cd ../mcp-server
88
81
  npm install
89
82
  npm run build
90
83
  ```
@@ -141,15 +134,12 @@ stats = sch.get_performance_stats()
141
134
  print(f"Cache hit rate: {stats['symbol_cache']['hit_rate_percent']}%")
142
135
  ```
143
136
 
144
- ### AI Agent Integration (MCP)
145
137
 
146
- Configure in Claude Desktop or compatible MCP client:
147
138
 
148
139
  ```json
149
140
  {
150
141
  "kicad-sch": {
151
142
  "command": "node",
152
- "args": ["/path/to/kicad-sch-api/mcp-server/dist/index.js"],
153
143
  "env": {
154
144
  "PYTHON_PATH": "python3",
155
145
  "KICAD_SCH_API_PATH": "/path/to/kicad-sch-api/python"
@@ -165,7 +155,6 @@ User: "Create a voltage divider circuit with two 10k resistors"
165
155
 
166
156
  Claude: I'll create a voltage divider circuit for you.
167
157
 
168
- [Agent automatically uses MCP tools to:]
169
158
  1. Create new schematic
170
159
  2. Add R1 (10k resistor) at (100, 100)
171
160
  3. Add R2 (10k resistor) at (100, 150)
@@ -187,8 +176,6 @@ The library consists of two main components:
187
176
  - **Symbol Caching**: High-performance library symbol management
188
177
  - **Comprehensive Validation**: Error collection and professional reporting
189
178
 
190
- ### MCP Server (AI Integration)
191
- - **TypeScript MCP Server**: Implements Anthropic's MCP specification
192
179
  - **Python Bridge**: Reliable subprocess communication
193
180
  - **Comprehensive Tools**: 15+ tools for complete schematic manipulation
194
181
  - **Professional Error Handling**: Detailed error context for AI agents
@@ -200,8 +187,6 @@ The library consists of two main components:
200
187
  cd python
201
188
  python -m pytest tests/ -v --cov=kicad_sch_api
202
189
 
203
- # MCP server tests
204
- cd mcp-server
205
190
  npm test
206
191
 
207
192
  # Format preservation tests
@@ -0,0 +1,31 @@
1
+ CHANGELOG.md
2
+ CONTRIBUTING.md
3
+ LICENSE
4
+ MANIFEST.in
5
+ README.md
6
+ pyproject.toml
7
+ .claude/commands/dev/dead-code-analysis.md
8
+ .claude/commands/dev/publish-pypi.md
9
+ .claude/commands/dev/review-implementation.md
10
+ .claude/commands/dev/run-tests.md
11
+ .claude/commands/dev/update-and-commit.md
12
+ .claude/commands/dev/update-memory-bank.md
13
+ .claude/commands/test/run-reference-tests.md
14
+ python/kicad_sch_api/__init__.py
15
+ python/kicad_sch_api/py.typed
16
+ python/kicad_sch_api.egg-info/PKG-INFO
17
+ python/kicad_sch_api.egg-info/SOURCES.txt
18
+ python/kicad_sch_api.egg-info/dependency_links.txt
19
+ python/kicad_sch_api.egg-info/entry_points.txt
20
+ python/kicad_sch_api.egg-info/requires.txt
21
+ python/kicad_sch_api.egg-info/top_level.txt
22
+ python/kicad_sch_api/core/__init__.py
23
+ python/kicad_sch_api/core/components.py
24
+ python/kicad_sch_api/core/formatter.py
25
+ python/kicad_sch_api/core/parser.py
26
+ python/kicad_sch_api/core/schematic.py
27
+ python/kicad_sch_api/core/types.py
28
+ python/kicad_sch_api/library/__init__.py
29
+ python/kicad_sch_api/library/cache.py
30
+ python/kicad_sch_api/utils/__init__.py
31
+ python/kicad_sch_api/utils/validation.py
@@ -17,6 +17,3 @@ pre-commit>=3.0.0
17
17
  sphinx>=5.0.0
18
18
  sphinx-rtd-theme>=1.0.0
19
19
  myst-parser>=0.18.0
20
-
21
- [mcp]
22
- mcp>=0.1.0
@@ -1,58 +0,0 @@
1
- {
2
- "name": "kicad-sch-api-mcp-server",
3
- "version": "1.0.0",
4
- "description": "Model Context Protocol server for KiCAD schematic manipulation via kicad-sch-api",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "tsc",
8
- "dev": "tsc --watch",
9
- "start": "node dist/index.js",
10
- "test": "jest",
11
- "lint": "eslint src/**/*.ts",
12
- "format": "prettier --write src/**/*.ts"
13
- },
14
- "keywords": [
15
- "kicad",
16
- "schematic",
17
- "mcp",
18
- "ai",
19
- "claude",
20
- "eda",
21
- "electronics",
22
- "circuit-design"
23
- ],
24
- "author": "Circuit-Synth",
25
- "license": "MIT",
26
- "repository": {
27
- "type": "git",
28
- "url": "https://github.com/circuit-synth/kicad-sch-api.git",
29
- "directory": "mcp-server"
30
- },
31
- "bugs": {
32
- "url": "https://github.com/circuit-synth/kicad-sch-api/issues"
33
- },
34
- "homepage": "https://github.com/circuit-synth/kicad-sch-api#readme",
35
- "dependencies": {
36
- "@modelcontextprotocol/sdk": "^0.6.0",
37
- "uuid": "^10.0.0",
38
- "zod": "^3.23.0"
39
- },
40
- "devDependencies": {
41
- "@types/node": "^20.0.0",
42
- "@types/uuid": "^10.0.0",
43
- "@typescript-eslint/eslint-plugin": "^7.0.0",
44
- "@typescript-eslint/parser": "^7.0.0",
45
- "eslint": "^8.0.0",
46
- "jest": "^29.0.0",
47
- "prettier": "^3.0.0",
48
- "typescript": "^5.0.0"
49
- },
50
- "engines": {
51
- "node": ">=18.0.0"
52
- },
53
- "files": [
54
- "dist/**/*",
55
- "README.md",
56
- "LICENSE"
57
- ]
58
- }