25 Commits

Author SHA1 Message Date
50f17eff35 Fix validate_project tool to handle directory paths and json import error
Some checks failed
CI / Lint and Format (push) Has been cancelled
CI / Test Python 3.11 on macos-latest (push) Has been cancelled
CI / Test Python 3.12 on macos-latest (push) Has been cancelled
CI / Test Python 3.13 on macos-latest (push) Has been cancelled
CI / Test Python 3.10 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.11 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.12 on ubuntu-latest (push) Has been cancelled
CI / Test Python 3.13 on ubuntu-latest (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / Build Package (push) Has been cancelled
- Move json import to module level to fix NameError
- Add directory path handling to automatically find .kicad_pro files
- Improve error messages and validation logic
- Add proper file type validation

Fixes IsADirectoryError and 'json' variable access errors.
2025-08-11 17:54:14 -06:00
bc0f3db97c Implement comprehensive AI/LLM integration for KiCad MCP server
Some checks are pending
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
Add intelligent analysis and recommendation tools for KiCad designs:

## New AI Tools (kicad_mcp/tools/ai_tools.py)
- suggest_components_for_circuit: Smart component suggestions based on circuit analysis
- recommend_design_rules: Automated design rule recommendations for different technologies
- optimize_pcb_layout: PCB layout optimization for signal integrity, thermal, and cost
- analyze_design_completeness: Comprehensive design completeness analysis

## Enhanced Utilities
- component_utils.py: Add ComponentType enum and component classification functions
- pattern_recognition.py: Enhanced circuit pattern analysis and recommendations
- netlist_parser.py: Implement missing parse_netlist_file function for AI tools

## Key Features
- Circuit pattern recognition for power supplies, amplifiers, microcontrollers
- Technology-specific design rules (standard, HDI, RF, automotive)
- Layout optimization suggestions with implementation steps
- Component suggestion system with standard values and examples
- Design completeness scoring with actionable recommendations

## Server Integration
- Register AI tools in FastMCP server
- Integrate with existing KiCad utilities and file parsers
- Error handling and graceful fallbacks for missing data

Fixes ImportError that prevented server startup and enables advanced
AI-powered design assistance for KiCad projects.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 16:15:58 -06:00
995dfd57c1 Add comprehensive advanced KiCad features and fix MCP compatibility issues
- Implement 3D model analysis and mechanical constraints checking
- Add advanced DRC rule customization for HDI, RF, and automotive applications
- Create symbol library management with analysis and validation tools
- Implement PCB layer stack-up analysis with impedance calculations
- Fix Context parameter validation errors causing client failures
- Add enhanced tool annotations with examples for better LLM compatibility
- Include comprehensive test coverage improvements (22.21% coverage)
- Add CLAUDE.md documentation for development guidance

New Advanced Tools:
• 3D model analysis: analyze_3d_models, check_mechanical_constraints
• Advanced DRC: create_drc_rule_set, analyze_pcb_drc_violations
• Symbol management: analyze_symbol_library, validate_symbol_library
• Layer analysis: analyze_pcb_stackup, calculate_trace_impedance

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 15:57:46 -06:00
Lama Al Rajih
0bbb78b0a9
Merge branch 'main' into pr-3-security-input-validation 2025-07-22 20:47:47 -04:00
Lama
74ad42eedf remove files accidentally commited 2025-07-18 11:05:25 -04:00
Lama
9bfc6da76d update pyproject.toml 2025-07-18 11:03:41 -04:00
Lauri Gates
bd08a47a6f feat: add comprehensive security and input validation system
- Add PathValidator class for preventing path traversal attacks
- Add SecureSubprocessRunner for safe command execution
- Replace unsafe XML parsing with defusedxml for security
- Add comprehensive input validation tools for circuit generation
- Include security dependencies (defusedxml, bandit) in pyproject.toml
- Add security scanning job to CI/CD pipeline
- Add comprehensive test coverage for security utilities
- Add timeout constants for safe operation limits
- Add boundary validation for component positioning

This establishes a strong security foundation for the KiCad MCP server
by implementing defense-in-depth security measures across all input
vectors and external process interactions.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-17 21:34:16 +03:00
mannie-exe
639b54d637 fix: migrate to uv; fix pydantic schema error
- add uv.lock for reproducible dependencies
- add .python-version file for python version consistency
- pin dependency versions in pyproject.toml (mcp>=1.11.0, pandas>=2.3.1, pytest>=8.4.1)
- remove type annotations from Image-returning functions to avoid pydantic v2 schema generation errors
  - resolves MCP server startup failure
2025-07-13 21:30:40 -07:00
Lama
e5c87df088 Removed unnecessary IPC drc - defaulting to only using the CLI 2025-04-24 16:07:36 -04:00
Constantin Craciun
5b9d237d7d feat: Fix tools, improve stability, and update docs 2025-04-23 18:37:56 +03:00
Lama
921e087351 logging docs cleanup 2025-03-22 09:23:22 -04:00
Lama
fda329cc8f remove all instances of logger.py (see issue #1) 2025-03-22 09:18:29 -04:00
Lama
3596bae34e fix find_component_connections() in netlist_tools.py 2025-03-22 08:58:57 -04:00
Lama
a3613f273a Fix drc issues - swap out pbnew for kicad cli and ipc 2025-03-21 15:27:36 -04:00
Lama
b1cb48ecf7 fix random import, etc issues 2025-03-21 13:08:15 -04:00
Lama
7343e032c1 Add circuit pattern recognition feature for KiCad schematics
This commit introduces a new circuit pattern recognition system that can
automatically identify common circuit patterns in KiCad schematics, including:

- Power supply circuits (linear regulators, switching converters)
- Amplifier circuits (op-amps, transistor amplifiers)
- Filter circuits (passive and active)
- Oscillator circuits (crystal, RC, IC-based)
- Digital interfaces (I2C, SPI, UART, USB)
- Microcontroller circuits
- Sensor interfaces

The implementation includes:
- Pattern recognition algorithms for common components
- Component value extraction and normalization utilities
- MCP tools for running pattern analysis
- MCP resources for displaying formatted results
- Comprehensive documentation

Users can easily extend the pattern recognition by adding new component
patterns or circuit recognition functions.
2025-03-21 10:43:34 -04:00
Lama
750dd260c4 Add comprehensive netlist extraction functionality
- Implement schematic netlist parser with S-expression parsing
- Create netlist tools for extraction and connection analysis
- Add resources for netlist and component connection reporting
- Include documentation with usage guide and troubleshooting
- Register new tools and resources in server configuration

This enables extracting component connections from KiCad schematics
and analyzing connectivity between components.
2025-03-21 09:31:15 -04:00
Lama
6953e5dc9a Add comprehensive BOM management functionality with analysis, export, and viewing features 2025-03-20 13:54:48 -04:00
Lama
948f9a150a move config.py file to subdir 2025-03-20 11:08:17 -04:00
Lama
9a114bce7b Refactor server to use type-safe lifespan context management
Implement proper context management in the KiCad MCP server:

Add dedicated context.py with typed KiCadAppContext class
Convert tools to access context instead of parameters
Implement caching for thumbnails
Add proper cleanup of resources on shutdown
Improve error handling with cancellation support
2025-03-20 09:58:19 -04:00
Lama
f50a2ce1af Enhance PCB thumbnail generation with robust fallback methods
Implements a more reliable PCB thumbnail generation feature using two methods:
- Primary: pcbnew Python module for high-quality rendering
- Fallback: pcbnew_cli for environments without Python modules

Adds detailed progress reporting and comprehensive error handling.
Includes documentation in docs/thumbnail_guide.md.
2025-03-20 03:16:14 -04:00
Lama
100f64186d Add Design Rule Check (DRC) functionality to KiCad MCP server
This commit implements comprehensive DRC support including:
- DRC check tool integration with both pcbnew Python module and CLI fallback
- Detailed DRC reports as resources with violation categorization
- Historical tracking of DRC results with visual trend analysis
- Comparison between current and previous DRC runs
- New prompt templates for fixing violations and custom design rules
- Full documentation in drc_guide.md

The DRC system helps users track their progress over time, focusing on the
most critical design rule violations as they improve their PCB designs.
2025-03-20 02:41:52 -04:00
Lama
047f9f6af7 add logger + support for other operating systems (lower prio) 2025-03-20 02:25:49 -04:00
Lama
9fa890bf90 a lot 2025-03-20 02:01:30 -04:00
Lama
e4035bdcb1 create new dir structure 2025-03-20 01:47:29 -04:00