feat: Address multiple open issues (#32, #30, #26, #19)

Issue #32 - Unknown command errors:
- Register get_board_extents in command_routes (was implemented but not registered)
- Implement find_component command with pattern matching on reference/value/footprint
- Add schemas for both commands

Issue #30 - PCB routing replication (Phase 1):
- Implement get_component_pads: returns all pads with positions, nets, shapes
- Implement get_pad_position: returns specific pad coordinates and properties
- Implement query_traces: query traces by net, layer, or bounding box
- Add schemas for all new commands

Issue #26 - Schematic workflow:
- Add missing schemas for add_schematic_connection, add_schematic_net_label,
  connect_to_net, get_net_connections, and generate_netlist

Issue #19 - macOS Python path detection:
- Add Python 3.13 to version detection
- Add alternative KiCAD installation paths (user Applications, capitalization variants)
- Add Homebrew Python fallback paths for Apple Silicon and Intel Macs
- Expand platform_helper.py with same improvements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
KiCAD MCP Bot
2026-01-19 19:17:35 -05:00
parent d2723bc292
commit 04db774a2b
6 changed files with 657 additions and 17 deletions

View File

@@ -91,14 +91,32 @@ class PlatformHelper:
paths = [p for p in candidates if p.exists()]
elif PlatformHelper.is_macos():
# macOS: Check application bundle
kicad_app = Path("/Applications/KiCad/KiCad.app")
if kicad_app.exists():
# Check Python framework path
for version in ["3.9", "3.10", "3.11", "3.12"]:
path = kicad_app / "Contents" / "Frameworks" / "Python.framework" / "Versions" / version / "lib" / f"python{version}" / "site-packages"
if path.exists():
paths.append(path)
# macOS: Check multiple KiCAD application bundle locations
kicad_app_paths = [
Path("/Applications/KiCad/KiCad.app"),
Path("/Applications/KiCAD/KiCad.app"), # Alternative capitalization
Path.home() / "Applications" / "KiCad" / "KiCad.app", # User Applications
]
# Check Python framework paths in each KiCAD installation
for kicad_app in kicad_app_paths:
if kicad_app.exists():
for version in ["3.9", "3.10", "3.11", "3.12", "3.13"]:
path = kicad_app / "Contents" / "Frameworks" / "Python.framework" / "Versions" / version / "lib" / f"python{version}" / "site-packages"
if path.exists():
paths.append(path)
# Also check Homebrew Python site-packages (if pcbnew installed via pip)
homebrew_paths = [
Path("/opt/homebrew/lib/python3.12/site-packages"), # Apple Silicon
Path("/opt/homebrew/lib/python3.11/site-packages"),
Path("/usr/local/lib/python3.12/site-packages"), # Intel Mac
Path("/usr/local/lib/python3.11/site-packages"),
]
for hp in homebrew_paths:
pcbnew_path = hp / "pcbnew.py"
if pcbnew_path.exists():
paths.append(hp)
if not paths:
logger.warning(f"No KiCAD Python paths found for {PlatformHelper.get_platform_name()}")
@@ -142,6 +160,8 @@ class PlatformHelper:
elif PlatformHelper.is_macos():
patterns = [
"/Applications/KiCad/KiCad.app/Contents/SharedSupport/symbols/*.kicad_sym",
"/Applications/KiCAD/KiCad.app/Contents/SharedSupport/symbols/*.kicad_sym",
str(Path.home() / "Applications/KiCad/KiCad.app/Contents/SharedSupport/symbols/*.kicad_sym"),
]
# Add user library paths for all platforms