Merge pull request #155 from rek/fix/linux-script-path
fix: resolve kicad_interface.py path using import.meta.url (Linux/macOS)
This commit is contained in:
@@ -4,6 +4,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
||||
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
||||
import { spawn, ChildProcess } from "child_process";
|
||||
import { existsSync } from "fs";
|
||||
import { fileURLToPath } from "url";
|
||||
import path from "path";
|
||||
|
||||
// Import all tool definitions for reference
|
||||
@@ -24,8 +25,8 @@ class KiCADServer {
|
||||
|
||||
constructor() {
|
||||
// Set absolute path to the Python KiCAD interface script
|
||||
// Using a hardcoded path to avoid cwd() issues when running from Cline
|
||||
this.kicadScriptPath = "c:/repo/KiCAD-MCP/python/kicad_interface.py";
|
||||
this.kicadScriptPath = process.env.KICAD_SCRIPT_PATH ||
|
||||
path.join(path.dirname(fileURLToPath(import.meta.url)), "../python/kicad_interface.py");
|
||||
|
||||
// Check if script exists
|
||||
if (!existsSync(this.kicadScriptPath)) {
|
||||
|
||||
Reference in New Issue
Block a user