fix: Add macOS support for KiCad bundled Python detection

Adds macOS-specific detection for KiCad's bundled Python, eliminating manual
PYTHONPATH configuration for macOS users.

Changes:
- Detects KiCad bundled Python at standard macOS install path (Python 3.9-3.12)
- Makes KICAD_PYTHON environment variable cross-platform (not just Windows)
- Adds logging for Python detection to aid debugging
- Updates documentation with simplified macOS setup (no PYTHONPATH needed)

Fixes server startup on macOS where existsSync('python3') was failing validation
because it doesn't check PATH.

Based on PR #18 by @hexatriene - applied manually due to merge conflict with
router implementation. Full credit to hexatriene for the solution design and
implementation.

Co-authored-by: hexatriene <106840313+hexatriene@users.noreply.github.com>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
KiCAD MCP Bot
2025-12-28 11:35:59 -05:00
parent 834d05130c
commit 8a1cb46b39
2 changed files with 38 additions and 10 deletions

View File

@@ -46,17 +46,29 @@ This guide shows how to configure the KiCAD MCP Server with various MCP-compatib
"mcpServers": {
"kicad": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/MCP/KiCAD-MCP-Server/dist/index.js"],
"env": {
"PYTHONPATH": "/Applications/KiCad/KiCad.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python3.11/site-packages",
"NODE_ENV": "production"
}
"args": ["/Users/YOUR_USERNAME/MCP/KiCAD-MCP-Server/dist/index.js"]
}
}
}
```
**Note:** Adjust Python version (3.11) and KiCAD path based on your installation.
**Note:** For standard KiCad installations in `/Applications/KiCad/`, the server auto-detects KiCad's bundled Python (versions 3.9-3.12). No `PYTHONPATH` configuration is required.
If KiCad is installed in a non-standard location, you can override the Python path:
```json
{
"mcpServers": {
"kicad": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/MCP/KiCAD-MCP-Server/dist/index.js"],
"env": {
"KICAD_PYTHON": "/custom/path/to/python3"
}
}
}
}
```
### Windows Configuration