Thank you for your interest in contributing to the KiCAD MCP Server! This guide will help you get started with development.
- Development Environment Setup
- Project Structure
- Architecture Overview
- Development Workflow
- Testing
- Code Style
- Pull Request Process
- Roadmap & Planning
- KiCAD 9.0 or higher - Download here
- Node.js v18+ - Download here
- Python 3.10+ - Should come with KiCAD, or install separately
- Git - For version control
# Install KiCAD 9.0 from official PPA
sudo add-apt-repository --yes ppa:kicad/kicad-9.0-releases
sudo apt-get update
sudo apt-get install -y kicad kicad-libraries
# Install Node.js (if not already installed)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# Clone the repository
git clone https://github.com/yourusername/kicad-mcp-server.git
cd kicad-mcp-server
# Install Node.js dependencies
npm install
# Install Python dependencies
pip3 install -r requirements-dev.txt
# Build TypeScript
npm run build
# Run tests
npm test
pytest# Install KiCAD 9.0 from https://www.kicad.org/download/windows/
# Install Node.js from https://nodejs.org/
# Clone the repository
git clone https://github.com/yourusername/kicad-mcp-server.git
cd kicad-mcp-server
# Install Node.js dependencies
npm install
# Install Python dependencies
pip install -r requirements-dev.txt
# Build TypeScript
npm run build
# Run tests
npm test
pytest# Install KiCAD 9.0 from https://www.kicad.org/download/macos/
# Install Node.js via Homebrew
brew install node
# Clone the repository
git clone https://github.com/yourusername/kicad-mcp-server.git
cd kicad-mcp-server
# Install Node.js dependencies
npm install
# Install Python dependencies
pip3 install -r requirements-dev.txt
# Build TypeScript
npm run build
# Run tests
npm test
pytestkicad-mcp-server/
├── .github/
│ └── workflows/ # CI/CD pipelines
├── config/ # Configuration examples
│ ├── linux-config.example.json
│ ├── windows-config.example.json
│ └── macos-config.example.json
├── docs/ # Documentation
├── python/ # Python interface layer
│ ├── commands/ # KiCAD command handlers
│ ├── integrations/ # External API integrations (JLCPCB, Digikey)
│ ├── utils/ # Utility modules
│ └── kicad_interface.py # Main Python entry point
├── src/ # TypeScript MCP server
│ ├── tools/ # MCP tool implementations
│ ├── resources/ # MCP resource implementations
│ ├── prompts/ # MCP prompt implementations
│ └── server.ts # Main server
├── tests/ # Test suite
│ ├── unit/
│ ├── integration/
│ └── fixtures/
├── dist/ # Compiled JavaScript (generated)
├── node_modules/ # Node dependencies (generated)
├── package.json # Node.js configuration
├── tsconfig.json # TypeScript configuration
├── pytest.ini # Pytest configuration
├── requirements.txt # Python production dependencies
└── requirements-dev.txt # Python dev dependencies
The KiCAD MCP Server is organized into several key components:
- TypeScript MCP Server (
src/) - Handles MCP protocol communication and tool routing - Python KiCAD Interface (
python/) - Interfaces with KiCAD's Python API (pcbnew) - Tool Router - Organizes 122+ tools into 8 discoverable categories
- Resource System - Provides dynamic project/board state information
- Prompt System - Offers context-aware design prompts
Current Tool Count: 122+ tools across 8 categories (direct + routed)
For detailed architecture information, see docs/ROUTER_ARCHITECTURE.md.
git checkout -b feature/your-feature-name- Edit TypeScript files in
src/ - Edit Python files in
python/ - Add tests for new features
# Build TypeScript
npm run build
# Run TypeScript linter
npm run lint
# Run Python formatter
black python/
# Run Python type checker
mypy python/
# Run all tests
npm test
pytest
# Run specific test file
pytest tests/test_platform_helper.py -v
# Run with coverage
pytest --cov=python --cov-report=htmlgit add .
git commit -m "feat: Add your feature description"Commit Message Convention:
feat:- New featurefix:- Bug fixdocs:- Documentation changestest:- Adding/updating testsrefactor:- Code refactoringchore:- Maintenance tasks
git push origin feature/your-feature-nameThen create a Pull Request on GitHub.
# All tests
pytest
# Unit tests only
pytest -m unit
# Integration tests (requires KiCAD installed)
pytest -m integration
# Platform-specific tests
pytest -m linux # Linux tests only
pytest -m windows # Windows tests only
# With coverage report
pytest --cov=python --cov-report=term-missing
# Verbose output
pytest -v
# Stop on first failure
pytest -xTests should be placed in tests/ directory:
# tests/test_my_feature.py
import pytest
@pytest.mark.unit
def test_my_feature():
"""Test description"""
# Arrange
expected = "result"
# Act
result = my_function()
# Assert
assert result == expected
@pytest.mark.integration
@pytest.mark.linux
def test_linux_integration():
"""Integration test for Linux"""
# This test will only run on Linux in CI
passWe use Black for code formatting and MyPy for type checking.
# Format all Python files
black python/
# Check types
mypy python/
# Run linter
pylint python/Python Style Guidelines:
- Use type hints for all function signatures
- Use pathlib.Path for file paths (not os.path)
- Use descriptive variable names
- Add docstrings to all public functions/classes
- Follow PEP 8
Example:
from pathlib import Path
from typing import List, Optional
def find_kicad_libraries(search_path: Path) -> List[Path]:
"""
Find all KiCAD symbol libraries in the given path.
Args:
search_path: Directory to search for .kicad_sym files
Returns:
List of paths to found library files
Raises:
ValueError: If search_path doesn't exist
"""
if not search_path.exists():
raise ValueError(f"Search path does not exist: {search_path}")
return list(search_path.glob("**/*.kicad_sym"))We use ESLint and Prettier for TypeScript.
# Format TypeScript files
npx prettier --write "src/**/*.ts"
# Run linter
npx eslint src/TypeScript Style Guidelines:
- Use interfaces for data structures
- Use async/await for asynchronous code
- Use descriptive variable names
- Add JSDoc comments to exported functions
- Update Documentation - If you change functionality, update docs
- Add Tests - All new features should have tests
- Run CI Locally - Ensure all tests pass before pushing
- Create PR - Use a clear, descriptive title
- Request Review - Tag relevant maintainers
- Address Feedback - Make requested changes
- Merge - Maintainer will merge when approved
- Code follows style guidelines
- All tests pass locally
- New tests added for new features
- Documentation updated
- Commit messages follow convention
- No merge conflicts
- CI/CD pipeline passes
We track work using GitHub Projects and Issues:
- GitHub Projects - High-level roadmap and sprints
- GitHub Issues - Specific bugs and features
- GitHub Discussions - Design discussions and proposals
- ✅ Linux compatibility fixes
- ✅ Platform-agnostic path handling
- ✅ CI/CD pipeline setup
- 🔄 Migrate to KiCAD IPC API
- ⏳ Add JLCPCB integration
- ⏳ Add Digikey integration
See docs/REBUILD_PLAN.md for the complete 12-week roadmap.
- GitHub Discussions - Ask questions, propose ideas
- GitHub Issues - Report bugs, request features
- Discord - Real-time chat (link TBD)
By contributing, you agree that your contributions will be licensed under the MIT License.
Your contributions make this project better for everyone. We appreciate your time and effort!