This massive feature update transforms the KiCad MCP server into a complete EDA automation platform with real-time design capabilities: ## Major New Features ### KiCad IPC API Integration (`utils/ipc_client.py`) - Real-time KiCad communication via kicad-python library - Component placement and manipulation - Live board analysis and statistics - Real-time routing status monitoring - Transaction-based operations with rollback support ### FreeRouting Integration (`utils/freerouting_engine.py`) - Complete automated PCB routing pipeline - DSN export → FreeRouting processing → SES import workflow - Parameter optimization for different routing strategies - Multi-technology support (standard, HDI, RF, automotive) - Routing quality analysis and reporting ### Automated Routing Tools (`tools/routing_tools.py`) - `route_pcb_automatically()` - Complete automated routing - `optimize_component_placement()` - AI-driven placement optimization - `analyze_routing_quality()` - Comprehensive routing analysis - `interactive_routing_session()` - Guided routing assistance - `route_specific_nets()` - Targeted net routing ### Complete Project Automation (`tools/project_automation.py`) - `automate_complete_design()` - End-to-end project automation - `create_outlet_tester_complete()` - Specialized outlet tester creation - `batch_process_projects()` - Multi-project automation pipeline - Seven-stage automation: validation → AI analysis → placement → routing → validation → manufacturing → final analysis ### Enhanced Analysis Tools (`tools/analysis_tools.py`) - `analyze_board_real_time()` - Live board analysis via IPC API - `get_component_details_live()` - Real-time component information - Enhanced `validate_project()` with IPC integration - Live connectivity and routing completion monitoring ## Technical Implementation ### Dependencies Added - `kicad-python>=0.4.0` - Official KiCad IPC API bindings - `requests>=2.31.0` - HTTP client for FreeRouting integration ### Architecture Enhancements - Real-time KiCad session management with automatic cleanup - Transaction-based operations for safe design manipulation - Context managers for reliable resource handling - Comprehensive error handling and recovery ### Integration Points - Seamless CLI + IPC API hybrid approach - FreeRouting autorouter integration via DSN/SES workflow - AI-driven optimization with real-time feedback - Manufacturing-ready file generation pipeline ## Automation Capabilities ### Complete EDA Workflow 1. **Project Setup & Validation** - File integrity and IPC availability 2. **AI Analysis** - Component suggestions and design rule recommendations 3. **Placement Optimization** - Thermal-aware component positioning 4. **Automated Routing** - FreeRouting integration with optimization 5. **Design Validation** - DRC checking and compliance verification 6. **Manufacturing Prep** - Gerber, drill, and assembly file generation 7. **Final Analysis** - Quality scoring and recommendations ### Real-time Capabilities - Live board statistics and connectivity monitoring - Interactive component placement and routing - Real-time design quality scoring - Live optimization opportunity identification ## Usage Examples ```python # Complete project automation automate_complete_design("/path/to/project.kicad_pro", "rf", ["signal_integrity", "thermal"]) # Automated routing with strategy selection route_pcb_automatically("/path/to/project.kicad_pro", "aggressive") # Real-time board analysis analyze_board_real_time("/path/to/project.kicad_pro") # Outlet tester project creation create_outlet_tester_complete("/path/to/new_project.kicad_pro", "gfci", ["voltage_display", "gfci_test"]) ``` This update establishes the foundation for Claude Code to provide complete EDA project automation, from initial design through production-ready manufacturing files, with real-time KiCad integration and automated routing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
238 lines
5.7 KiB
TOML
238 lines
5.7 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "kicad-mcp"
|
|
version = "0.1.0"
|
|
description = "Model Context Protocol (MCP) server for KiCad electronic design automation (EDA) files"
|
|
readme = "README.md"
|
|
license = { text = "MIT" }
|
|
authors = [
|
|
{ name = "KiCad MCP Contributors" }
|
|
]
|
|
maintainers = [
|
|
{ name = "KiCad MCP Contributors" }
|
|
]
|
|
keywords = [
|
|
"kicad",
|
|
"eda",
|
|
"electronics",
|
|
"schematic",
|
|
"pcb",
|
|
"mcp",
|
|
"model-context-protocol",
|
|
"ai",
|
|
"assistant"
|
|
]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Intended Audience :: Developers",
|
|
"Intended Audience :: Manufacturing",
|
|
"License :: OSI Approved :: MIT License",
|
|
"Operating System :: OS Independent",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
"Typing :: Typed"
|
|
]
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
"mcp[cli]>=1.0.0",
|
|
"fastmcp>=2.0.0",
|
|
"pandas>=2.0.0",
|
|
"pyyaml>=6.0.0",
|
|
"defusedxml>=0.7.0", # Secure XML parsing
|
|
"kicad-python>=0.4.0", # KiCad IPC API bindings
|
|
"requests>=2.31.0", # HTTP client for FreeRouting integration
|
|
]
|
|
|
|
[project.urls]
|
|
"Homepage" = "https://github.com/lamaalrajih/kicad-mcp"
|
|
"Bug Tracker" = "https://github.com/lamaalrajih/kicad-mcp/issues"
|
|
"Documentation" = "https://github.com/lamaalrajih/kicad-mcp#readme"
|
|
|
|
[project.scripts]
|
|
kicad-mcp = "kicad_mcp.server:main"
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=7.0.0",
|
|
"pytest-asyncio>=0.23.0",
|
|
"pytest-mock>=3.10.0",
|
|
"pytest-cov>=4.0.0",
|
|
"pytest-xdist>=3.0.0",
|
|
"ruff>=0.1.0",
|
|
"mypy>=1.8.0",
|
|
"pre-commit>=3.0.0",
|
|
"bandit>=1.7.0", # Security linting for pre-commit hooks
|
|
]
|
|
docs = [
|
|
"sphinx>=7.0.0",
|
|
"sphinx-rtd-theme>=1.3.0",
|
|
"myst-parser>=2.0.0",
|
|
]
|
|
security = [
|
|
"bandit>=1.7.0",
|
|
"safety>=3.0.0",
|
|
]
|
|
performance = [
|
|
"memory-profiler>=0.61.0",
|
|
"py-spy>=0.3.0",
|
|
]
|
|
visualization = [
|
|
"cairosvg>=2.7.0", # SVG to PNG conversion
|
|
"Pillow>=10.0.0", # Image processing
|
|
"playwright>=1.40.0", # Browser automation (optional)
|
|
]
|
|
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 100
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
"SIM", # flake8-simplify
|
|
"UP", # pyupgrade
|
|
]
|
|
ignore = [
|
|
"E501", # line too long, handled by ruff format
|
|
"B008", # do not perform function calls in argument defaults
|
|
"C901", # too complex (handled by other tools)
|
|
"B905", # zip() without an explicit strict= parameter
|
|
]
|
|
unfixable = [
|
|
"B", # Avoid trying to fix flake8-bugbear violations
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"tests/**/*.py" = [
|
|
"S101", # Use of assert detected
|
|
"D103", # Missing docstring in public function
|
|
"SLF001", # Private member accessed
|
|
]
|
|
"kicad_mcp/config.py" = [
|
|
"E501", # Long lines in config are ok
|
|
]
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["kicad_mcp"]
|
|
force-sort-within-sections = true
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
skip-magic-trailing-comma = false
|
|
line-ending = "auto"
|
|
|
|
[tool.mypy]
|
|
python_version = "3.11"
|
|
warn_return_any = true
|
|
warn_unused_configs = true
|
|
disallow_untyped_defs = false
|
|
disallow_incomplete_defs = false
|
|
check_untyped_defs = true
|
|
disallow_untyped_decorators = false
|
|
no_implicit_optional = true
|
|
warn_redundant_casts = true
|
|
warn_unused_ignores = true
|
|
warn_no_return = true
|
|
warn_unreachable = true
|
|
strict_equality = true
|
|
show_error_codes = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = [
|
|
"pandas.*",
|
|
"mcp.*",
|
|
"kipy.*", # KiCad Python bindings
|
|
"requests.*",
|
|
]
|
|
ignore_missing_imports = true
|
|
|
|
|
|
[tool.pytest.ini_options]
|
|
minversion = "7.0"
|
|
addopts = [
|
|
"--strict-markers",
|
|
"--strict-config",
|
|
"--cov=kicad_mcp",
|
|
"--cov-report=term-missing",
|
|
"--cov-report=html:htmlcov",
|
|
"--cov-report=xml",
|
|
"--cov-fail-under=80",
|
|
"-ra",
|
|
"--tb=short",
|
|
]
|
|
testpaths = ["tests"]
|
|
python_files = ["test_*.py"]
|
|
python_classes = ["Test*"]
|
|
python_functions = ["test_*"]
|
|
markers = [
|
|
"unit: Unit tests",
|
|
"integration: Integration tests",
|
|
"slow: Tests that take more than a few seconds",
|
|
"requires_kicad: Tests that require KiCad CLI to be installed",
|
|
"performance: Performance benchmarking tests",
|
|
]
|
|
asyncio_mode = "auto"
|
|
filterwarnings = [
|
|
"ignore::DeprecationWarning",
|
|
"ignore::PendingDeprecationWarning",
|
|
"ignore::RuntimeWarning:asyncio",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
source = ["kicad_mcp"]
|
|
branch = true
|
|
omit = [
|
|
"tests/*",
|
|
"kicad_mcp/__init__.py",
|
|
"*/migrations/*",
|
|
"*/venv/*",
|
|
"*/.venv/*",
|
|
]
|
|
|
|
[tool.coverage.report]
|
|
precision = 2
|
|
show_missing = true
|
|
skip_covered = false
|
|
exclude_lines = [
|
|
"pragma: no cover",
|
|
"def __repr__",
|
|
"if self.debug:",
|
|
"if settings.DEBUG",
|
|
"raise AssertionError",
|
|
"raise NotImplementedError",
|
|
"if 0:",
|
|
"if __name__ == .__main__.:",
|
|
"class .*\\bProtocol\\):",
|
|
"@(abc\\.)?abstractmethod",
|
|
]
|
|
|
|
[tool.bandit]
|
|
exclude_dirs = ["tests", "build", "dist"]
|
|
skips = ["B101", "B601", "B404", "B603", "B110", "B112"] # Skip low-severity subprocess and exception handling warnings
|
|
|
|
[tool.bandit.assert_used]
|
|
skips = ["*_test.py", "*/test_*.py"]
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["."]
|
|
include = ["kicad_mcp*"]
|
|
exclude = ["tests*", "docs*"]
|
|
|
|
[tool.setuptools.package-data]
|
|
"kicad_mcp" = ["prompts/*.txt", "resources/**/*.json"]
|