Skip to content

Commit 3986398

Browse files
Shane Mattnerclaude
authored andcommitted
Initial implementation of MCP KiCAD Schematic API Server
- Standard MCP server implementation using official MCP SDK - Support for KiCAD schematic creation, loading, and manipulation - Component addition with library search capabilities - Wire connections and basic routing - Hierarchical sheet support - Cross-platform MCP client compatibility - Comprehensive tool set for AI agent integration Tools implemented: - create_schematic: Create new KiCAD schematic files - load_schematic: Load existing schematic files - save_schematic: Save schematics to disk - add_component: Add electronic components - search_components: Search KiCAD symbol libraries - add_wire: Create wire connections - list_components: List all components - get_schematic_info: Get schematic metadata 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
0 parents  commit 3986398

19 files changed

+2608
-0
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2025-08-19
9+
10+
### Added
11+
- Initial release of MCP KiCAD Schematic API server
12+
- Standard MCP server implementation using official MCP SDK
13+
- Support for schematic creation and loading
14+
- Component addition with library search
15+
- Wire connections and basic routing
16+
- Hierarchical sheet support
17+
- Cross-platform MCP client compatibility (Claude Desktop, Claude Code, etc.)
18+
- Comprehensive tool set for KiCAD schematic manipulation
19+
20+
### Features
21+
- `create_schematic` - Create new KiCAD schematic files
22+
- `load_schematic` - Load existing schematic files
23+
- `save_schematic` - Save schematics to disk
24+
- `add_component` - Add electronic components (resistors, capacitors, ICs, etc.)
25+
- `search_components` - Search KiCAD symbol libraries
26+
- `add_wire` - Create wire connections between components
27+
- `list_components` - List all components in current schematic
28+
- `get_schematic_info` - Get schematic metadata and statistics
29+
30+
### Technical
31+
- Built on standard MCP SDK for maximum compatibility
32+
- Depends on `kicad-sch-api` library for core functionality
33+
- Async/await support for responsive AI agent interactions
34+
- Comprehensive error handling and logging
35+
- Type hints and documentation for all tools

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Circuit-Synth
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# MCP KiCAD Schematic API
2+
3+
Model Context Protocol (MCP) server providing KiCAD schematic manipulation tools for AI agents.
4+
5+
## Overview
6+
7+
This MCP server exposes the [`kicad-sch-api`](https://github.com/circuit-synth/kicad-sch-api) library as tools that AI agents can use to create, modify, and analyze KiCAD schematic files.
8+
9+
## Features
10+
11+
- 🔧 **Create Schematics**: Generate new KiCAD schematic files
12+
-**Add Components**: Place resistors, capacitors, ICs, and more
13+
- 🔍 **Search Components**: Find parts in KiCAD symbol libraries
14+
- 🔗 **Add Connections**: Create wires and nets
15+
- 📐 **Hierarchical Design**: Support for hierarchical sheets and labels
16+
- 🎯 **Format Preservation**: Maintains exact KiCAD file format compatibility
17+
18+
## Quick Start
19+
20+
### Installation
21+
22+
```bash
23+
pip install mcp-kicad-sch-api
24+
```
25+
26+
### Configuration
27+
28+
#### Claude Desktop
29+
Add to your `claude_desktop_config.json`:
30+
```json
31+
{
32+
"mcpServers": {
33+
"kicad-sch-api": {
34+
"command": "python",
35+
"args": ["-m", "mcp_kicad_sch_api"],
36+
"env": {}
37+
}
38+
}
39+
}
40+
```
41+
42+
#### Claude Code
43+
```bash
44+
claude mcp add kicad-sch-api --scope user -- python -m mcp_kicad_sch_api
45+
```
46+
47+
#### Other MCP Clients
48+
The server supports standard MCP stdio transport and should work with any MCP-compatible client.
49+
50+
## Usage Examples
51+
52+
Ask your AI agent:
53+
54+
- *"Create a voltage divider circuit with two 10kΩ resistors"*
55+
- *"Add an Arduino Nano to the schematic at position (100, 100)"*
56+
- *"Search for operational amplifiers in the KiCAD libraries"*
57+
- *"Create a hierarchical sheet for the power supply section"*
58+
59+
## Tools Available
60+
61+
| Tool | Description |
62+
|------|-------------|
63+
| `create_schematic` | Create a new KiCAD schematic file |
64+
| `add_component` | Add components (resistors, capacitors, ICs, etc.) |
65+
| `search_components` | Search KiCAD symbol libraries |
66+
| `add_wire` | Create wire connections |
67+
| `add_hierarchical_sheet` | Add hierarchical design sheets |
68+
| `add_sheet_pin` | Add pins to hierarchical sheets |
69+
| `add_hierarchical_label` | Add hierarchical labels |
70+
| `list_components` | List all components in schematic |
71+
| `get_schematic_info` | Get schematic information |
72+
73+
## Requirements
74+
75+
- Python 3.10+
76+
- KiCAD (for symbol libraries)
77+
- [`kicad-sch-api`](https://pypi.org/project/kicad-sch-api/) library
78+
79+
## Development
80+
81+
```bash
82+
git clone https://github.com/circuit-synth/mcp-kicad-sch-api.git
83+
cd mcp-kicad-sch-api
84+
uv sync --dev
85+
uv run python -m mcp_kicad_sch_api
86+
```
87+
88+
## License
89+
90+
MIT License - see [LICENSE](LICENSE) file.
91+
92+
## Related Projects
93+
94+
- [`kicad-sch-api`](https://github.com/circuit-synth/kicad-sch-api) - Core Python library
95+
- [`circuit-synth`](https://github.com/circuit-synth/circuit-synth) - AI-powered circuit design platform
96+
97+
---
98+
99+
🤖 **AI-Powered Circuit Design Made Easy**

pyproject.toml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
[build-system]
2+
requires = ["setuptools>=68.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "mcp-kicad-sch-api"
7+
version = "0.1.0"
8+
description = "Model Context Protocol server for KiCAD schematic manipulation"
9+
readme = "README.md"
10+
license = "MIT"
11+
authors = [
12+
{name = "Circuit-Synth", email = "shane@circuit-synth.com"}
13+
]
14+
maintainers = [
15+
{name = "Circuit-Synth", email = "shane@circuit-synth.com"}
16+
]
17+
keywords = [
18+
"mcp", "kicad", "schematic", "eda", "electronics", "circuit-design",
19+
"ai", "model-context-protocol", "llm", "agent"
20+
]
21+
classifiers = [
22+
"Development Status :: 4 - Beta",
23+
"Intended Audience :: Developers",
24+
"Intended Audience :: Science/Research",
25+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
"Programming Language :: Python :: 3.13",
32+
"Operating System :: OS Independent",
33+
]
34+
requires-python = ">=3.10"
35+
dependencies = [
36+
"mcp>=1.0.0",
37+
"kicad-sch-api>=0.1.7",
38+
"asyncio-mqtt>=0.16.0; python_version<'3.11'"
39+
]
40+
41+
[project.scripts]
42+
mcp-kicad-sch-api = "mcp_kicad_sch_api:main"
43+
44+
[project.optional-dependencies]
45+
dev = [
46+
"pytest>=7.0.0",
47+
"pytest-asyncio>=0.21.0",
48+
"pytest-cov>=4.0.0",
49+
"black>=22.0.0",
50+
"isort>=5.0.0",
51+
"flake8>=4.0.0",
52+
"mypy>=1.0.0",
53+
]
54+
55+
[project.urls]
56+
Homepage = "https://github.com/circuit-synth/mcp-kicad-sch-api"
57+
Documentation = "https://circuit-synth.github.io/mcp-kicad-sch-api/"
58+
Repository = "https://github.com/circuit-synth/mcp-kicad-sch-api.git"
59+
"Bug Reports" = "https://github.com/circuit-synth/mcp-kicad-sch-api/issues"
60+
Changelog = "https://github.com/circuit-synth/mcp-kicad-sch-api/blob/main/CHANGELOG.md"
61+
62+
[tool.setuptools]
63+
include-package-data = true
64+
65+
[tool.setuptools.packages.find]
66+
where = ["src"]
67+
include = ["mcp_kicad_sch_api*"]
68+
69+
[tool.pytest.ini_options]
70+
testpaths = ["tests"]
71+
python_files = ["test_*.py"]
72+
python_classes = ["Test*"]
73+
python_functions = ["test_*"]
74+
asyncio_mode = "auto"
75+
addopts = [
76+
"--verbose",
77+
"--tb=short",
78+
"--strict-markers",
79+
"--cov=mcp_kicad_sch_api",
80+
"--cov-report=term-missing",
81+
"--cov-report=html:htmlcov",
82+
"--cov-fail-under=80",
83+
]
84+
85+
[tool.black]
86+
line-length = 100
87+
target-version = ["py310", "py311", "py312", "py313"]
88+
include = '\.pyi?$'
89+
90+
[tool.isort]
91+
profile = "black"
92+
line_length = 100
93+
multi_line_output = 3
94+
include_trailing_comma = true
95+
force_grid_wrap = 0
96+
use_parentheses = true
97+
ensure_newline_before_comments = true
98+
src_paths = ["src", "tests"]
99+
100+
[tool.mypy]
101+
python_version = "3.10"
102+
warn_return_any = true
103+
warn_unused_configs = true
104+
disallow_untyped_defs = true
105+
disallow_incomplete_defs = true
106+
check_untyped_defs = true
107+
no_implicit_optional = true
108+
warn_redundant_casts = true
109+
warn_unused_ignores = true
110+
warn_no_return = true
111+
warn_unreachable = true
112+
strict_equality = true
113+
114+
[[tool.mypy.overrides]]
115+
module = ["kicad_sch_api.*"]
116+
ignore_missing_imports = true

0 commit comments

Comments
 (0)