KiCad MCP Server

by lamaalrajih
Verified
# KiCad Design Rule Check (DRC) Guide This guide explains how to use the Design Rule Check (DRC) features in the KiCad MCP Server. ## Overview The Design Rule Check (DRC) functionality allows you to: 1. Run DRC checks on your KiCad PCB designs 2. Get detailed reports of violations 3. Track your progress over time as you fix issues 4. Compare current results with previous checks ## KiCad 9.0+ Compatibility **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: 1. **KiCad CLI Method** (Recommended) - Uses the `kicad-cli` command-line tool to run DRC checks without requiring a running instance of KiCad. 2. **IPC API Method** - Connects to a running instance of KiCad through the new IPC API using the `kicad-python` package. The server automatically selects the best available method based on your KiCad installation. ## Prerequisites For optimal DRC functionality with KiCad 9.0+, you should have: - KiCad 9.0 or newer installed - `kicad-cli` available in your system PATH (included with KiCad 9.0+) - For IPC API functionality: the `kicad-python` package installed (`pip install kicad-python`) ## Using DRC Features ### Running a DRC Check To run a DRC check on your KiCad project: 1. In Claude Desktop, select the KiCad MCP server from the tools dropdown 2. Use the `run_drc_check` tool with your project path: ``` Please run a DRC check on my project at /Users/username/Documents/KiCad/my_project/my_project.kicad_pro ``` The tool will: - Automatically select the best available method (CLI or IPC API) - Analyze your PCB design for rule violations - Generate a comprehensive report - Save the results to your DRC history - Compare with previous runs (if available) ### Viewing DRC Reports There are two ways to view DRC information: #### Current DRC Report To view the current DRC status of your project: ``` Show me the DRC report for /Users/username/Documents/KiCad/my_project/my_project.kicad_pro ``` This will load the `kicad://drc/project_path` resource, showing: - Total number of violations - Categorized list of issues - Violation details with locations - Recommendations for fixing common issues #### DRC History To see how your project's DRC status has changed over time: ``` Show me the DRC history for /Users/username/Documents/KiCad/my_project/my_project.kicad_pro ``` This will load the `kicad://drc/history/project_path` resource, showing: - A visual trend of violations over time - Table of all DRC check runs - Comparison between first and most recent checks - Progress indicators ### Getting Help with DRC Issues If you need help understanding or fixing DRC violations, use the "Fix DRC Violations" prompt template: 1. Click on the prompt templates button in Claude Desktop 2. Select "Fix DRC Violations" 3. Fill in the specifics about your DRC issues 4. Claude will provide guidance on resolving the violations ## Understanding DRC Results ### Violation Categories Common DRC violation categories include: | Category | Description | Common Fixes | |----------|-------------|--------------| | Clearance | Items are too close together | Increase spacing, reroute traces | | Track Width | Traces are too narrow | Increase trace width, reconsider current requirements | | Annular Ring | Via rings are too small | Increase via size, adjust PCB manufacturing settings | | Drill Size | Holes are too small | Increase drill diameter, check manufacturing capabilities | | Silkscreen | Silkscreen conflicts with pads | Adjust silkscreen position, resize text | | Courtyard | Component courtyards overlap | Adjust component placement, reduce footprint sizes | ### Progress Tracking The DRC history feature tracks your progress over time, helping you: - Identify if you're making progress (reducing violations) - Spot when new violations are introduced - Focus on resolving the most common issues - Document your design improvements ## Advanced Usage ### Custom Design Rules If your project has specific requirements, you can use the "Custom Design Rules" prompt template to get help creating specialized rules for: - High-voltage circuits - High-current paths - RF design constraints - Specialized manufacturing requirements ### Integrating with KiCad The DRC checks are designed to work alongside KiCad's built-in DRC tool: 1. Run the MCP server's DRC check to get an overview and track progress 2. Use KiCad's built-in DRC for interactive fixes (which highlight the exact location in the editor) 3. Re-run the MCP server's DRC to verify your fixes and update the history ## Troubleshooting ### DRC Check Fails If the DRC check fails to run: 1. Ensure your KiCad project exists at the specified path 2. Verify that the project contains a PCB file (.kicad_pcb) 3. Check your KiCad installation: - For CLI method: Verify `kicad-cli` is in your PATH or in a standard installation location - For IPC API method: Make sure KiCad is running with the API server enabled in Preferences > Plugins 4. Try using the full absolute path to your project file ### Method Selection Issues If you want to force a specific DRC method: 1. **CLI Method**: Ensure `kicad-cli` is available in your PATH 2. **IPC API Method**: - Install the `kicad-python` package - Launch KiCad before running the DRC check - Enable the API server in KiCad preferences If you continue to experience issues, check the server logs for more detailed error information.