Skip to content

Commit e5c87df

Browse files
committed
Removed unnecessary IPC drc - defaulting to only using the CLI
1 parent a95c0a4 commit e5c87df

File tree

6 files changed

+5
-252
lines changed

6 files changed

+5
-252
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,8 @@ The KiCad MCP Server provides several key features, each with detailed documenta
152152
- **BOM Management**: Analyze and export Bills of Materials
153153
- *Example:* "Generate a BOM for my smart watch project" → Creates a detailed bill of materials
154154

155-
- **Design Rule Checking**: Run DRC checks and track your progress over time
155+
- **Design Rule Checking**: Run DRC checks using the KiCad CLI and track your progress over time
156156
- *Example:* "Run DRC on my power supply board and compare to last week" → Shows progress in fixing violations
157-
- *KiCad 9.0+ Compatible:* Uses the new KiCad CLI or IPC API automatically
158157

159158
- **PCB Visualization**: Generate visual representations of your PCB layouts
160159
- *Example:* "Show me a thumbnail of my audio amplifier PCB" → Displays a visual render of the board

docs/drc_guide.md

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,14 @@ The Design Rule Check (DRC) functionality allows you to:
1111
3. Track your progress over time as you fix issues
1212
4. Compare current results with previous checks
1313

14-
## KiCad 9.0+ Compatibility
15-
16-
**Important Update**: With KiCad 9.0+, the DRC functionality has been reimplemented to work with the new KiCad APIs. The server now supports two methods for running DRC:
17-
18-
1. **KiCad CLI Method** (Recommended) - Uses the `kicad-cli` command-line tool to run DRC checks without requiring a running instance of KiCad.
19-
20-
2. **IPC API Method** - Connects to a running instance of KiCad through the new IPC API using the `kicad-python` package.
21-
22-
The server automatically selects the best available method based on your KiCad installation.
14+
It does this all by using the `kicad-cli` command-line tool to run DRC checks without requiring a running instance of KiCad.
2315

2416
## Prerequisites
2517

2618
For optimal DRC functionality with KiCad 9.0+, you should have:
2719

2820
- KiCad 9.0 or newer installed
2921
- `kicad-cli` available in your system PATH (included with KiCad 9.0+)
30-
- For IPC API functionality: the `kicad-python` package installed (`pip install kicad-python`)
3122

3223
## Using DRC Features
3324

@@ -43,7 +34,7 @@ Please run a DRC check on my project at /Users/username/Documents/KiCad/my_proje
4334
```
4435

4536
The tool will:
46-
- Automatically select the best available method (CLI or IPC API)
37+
- Use the kicad CLI to run the DRC check
4738
- Analyze your PCB design for rule violations
4839
- Generate a comprehensive report
4940
- Save the results to your DRC history
@@ -141,19 +132,7 @@ If the DRC check fails to run:
141132

142133
1. Ensure your KiCad project exists at the specified path
143134
2. Verify that the project contains a PCB file (.kicad_pcb)
144-
3. Check your KiCad installation:
145-
- For CLI method: Verify `kicad-cli` is in your PATH or in a standard installation location
146-
- For IPC API method: Make sure KiCad is running with the API server enabled in Preferences > Plugins
135+
3. Check your KiCad installation: Verify `kicad-cli` is in your PATH or in a standard installation location
147136
4. Try using the full absolute path to your project file
148137

149-
### Method Selection Issues
150-
151-
If you want to force a specific DRC method:
152-
153-
1. **CLI Method**: Ensure `kicad-cli` is available in your PATH
154-
2. **IPC API Method**:
155-
- Install the `kicad-python` package
156-
- Launch KiCad before running the DRC check
157-
- Enable the API server in KiCad preferences
158-
159138
If you continue to experience issues, check the server logs for more detailed error information.

kicad_mcp/tools/drc_impl/ipc_drc.py

Lines changed: 0 additions & 160 deletions
This file was deleted.

kicad_mcp/tools/drc_tools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from kicad_mcp.utils.file_utils import get_project_files
1010
from kicad_mcp.utils.drc_history import save_drc_result, get_drc_history, compare_with_previous
11-
from kicad_mcp.utils.kicad_api_detection import get_best_api_approach
1211

1312
# Import implementations
1413
from kicad_mcp.tools.drc_impl.cli_drc import run_drc_via_cli

kicad_mcp/utils/kicad_api_detection.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -68,64 +68,3 @@ def check_for_cli_api() -> bool:
6868
except Exception as e:
6969
print(f"Error checking for KiCad CLI API: {str(e)}")
7070
return False
71-
72-
73-
def check_for_ipc_api() -> bool:
74-
"""Check if KiCad IPC API (kicad-python) is available.
75-
76-
Returns:
77-
True if KiCad IPC API is available, False otherwise
78-
"""
79-
try:
80-
# Try to import the kipy module
81-
import kipy
82-
print("KiCad IPC API (kicad-python) is available")
83-
return True
84-
except ImportError:
85-
print("KiCad IPC API (kicad-python) is not available")
86-
return False
87-
except Exception as e:
88-
print(f"Error checking for KiCad IPC API: {str(e)}")
89-
return False
90-
91-
92-
def check_ipc_api_environment() -> Tuple[bool, Optional[str]]:
93-
"""Check if we're running in a KiCad IPC plugin environment.
94-
95-
Returns:
96-
Tuple of (is_plugin, socket_path)
97-
"""
98-
# Check for environment variables that would indicate we're a plugin
99-
is_plugin = os.environ.get("KICAD_PLUGIN_ENV") is not None
100-
101-
# Check for socket path in environment
102-
socket_path = os.environ.get("KICAD_SOCKET_PATH")
103-
104-
if is_plugin:
105-
print("Running as a KiCad plugin")
106-
elif socket_path:
107-
print(f"KiCad IPC socket path found: {socket_path}")
108-
109-
return (is_plugin, socket_path)
110-
111-
112-
def get_best_api_approach() -> Literal["cli", "ipc", "none"]:
113-
"""Determine the best available KiCad API approach.
114-
115-
Returns:
116-
String indicating which API approach to use:
117-
- "cli": Use KiCad command-line interface
118-
- "ipc": Use KiCad IPC API (kicad-python)
119-
- "none": No API available
120-
"""
121-
# Check for IPC API first (preferred if available)
122-
if check_for_ipc_api():
123-
return "ipc"
124-
125-
# Check for CLI API next
126-
if check_for_cli_api():
127-
return "cli"
128-
129-
# No API available
130-
print("No KiCad API available")
131-
return "none"

requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
mcp[cli]
2-
httpx
3-
pytest
42
pandas
5-
kicad-python
63

74
# Development/Testing
8-
pytest-asyncio
5+
pytest

0 commit comments

Comments
 (0)