kcaa 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kcaa-0.2.6 → kcaa-0.2.7}/PKG-INFO +47 -11
- {kcaa-0.2.6 → kcaa-0.2.7}/README.md +46 -10
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/server.py +6 -0
- kcaa-0.2.7/kcaa/tools/erc_tools.py +183 -0
- kcaa-0.2.7/kcaa/tools/no_connect_tools.py +221 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_library_tools.py +247 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/placement_helpers.py +4 -2
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/symbol_edit_tools.py +1325 -11
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/symbol_tools.py +129 -22
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/config.py +21 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/footprint_database.py +10 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/footprint_index_manager.py +25 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/fp_lib_table_utils.py +71 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pcb_library_utils.py +12 -7
- kcaa-0.2.7/kcaa/utils/sym_lib_table_utils.py +205 -0
- kcaa-0.2.7/kcaa/utils/symbol_database.py +806 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/symbol_index_manager.py +188 -30
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/symbol_index_reader.py +47 -14
- kcaa-0.2.7/kcaa/utils/symbol_library_utils.py +542 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/pyproject.toml +1 -1
- kcaa-0.2.6/kcaa/utils/symbol_database.py +0 -507
- {kcaa-0.2.6 → kcaa-0.2.7}/.gitignore +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/LICENSE +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/README_CN.md +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/context.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/prompts/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/prompts/bom_prompts.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/prompts/drc_prompt.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/prompts/pattern_prompts.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/prompts/templates.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/bom_resources.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/drc_resources.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/files.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/netlist_resources.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/pattern_resources.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/resources/projects.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/a_star.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/grid_a_star.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/path_postprocess.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/router.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/via_check.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/visibility_graph.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/router/world_model.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/analysis_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/bom_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/drc_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/export_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/kipy_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/netlist_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pattern_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_edit_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_group_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_placement_helpers.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_placement_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_query_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_routing_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/pcb_zone_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/project_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/render_board_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/schematic_group_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/sheet_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/skill_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/validation_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/version_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/tools/wire_edit_tools.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/__init__.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/boundary_validator.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/component_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/file_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/ipc_drc.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/kicad_api_detection.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/kicad_cli.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/kicad_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/kipy_reload.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/net_settings.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/netlist_parser.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/path_validator.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pattern_recognition.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pcb_board_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pcb_design_rules.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pcb_footprint_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/pcb_sexp_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/schematic_sexp_utils.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/secure_subprocess.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/skip_compat.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/skip_helpers.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/symbol_extractor.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/symbol_geometry.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/temp_dir_manager.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kcaa/utils/version_manager.py +0 -0
- {kcaa-0.2.6 → kcaa-0.2.7}/kicad_plugin/README.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: kcaa
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.7
|
|
4
4
|
Summary: Model Context Protocol (MCP) server for KiCad electronic design automation (EDA) files
|
|
5
5
|
Project-URL: Homepage, https://github.com/paul356/KiCad-AI-Assistant
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/paul356/KiCad-AI-Assistant/issues
|
|
@@ -52,7 +52,7 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
52
52
|
- [Table of Contents](#table-of-contents)
|
|
53
53
|
- [Prerequisites](#prerequisites)
|
|
54
54
|
- [Installation](#installation)
|
|
55
|
-
- [1. Clone the repository](#1-clone-the-repository)
|
|
55
|
+
- [1. Clone the repository (optional)](#1-clone-the-repository-optional)
|
|
56
56
|
- [2. Install the plugin](#2-install-the-plugin)
|
|
57
57
|
- [3. Create the plugin virtual environment](#3-create-the-plugin-virtual-environment)
|
|
58
58
|
- [4. Load the plugin in KiCad](#4-load-the-plugin-in-kicad)
|
|
@@ -71,8 +71,8 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
71
71
|
- [PCB Placement](#pcb-placement)
|
|
72
72
|
- [PCB Groups](#pcb-groups)
|
|
73
73
|
- [PCB Zones](#pcb-zones)
|
|
74
|
-
- [DRC
|
|
75
|
-
- [Versioning
|
|
74
|
+
- [DRC \& Design Rules](#drc--design-rules)
|
|
75
|
+
- [Versioning \& Export](#versioning--export)
|
|
76
76
|
- [Skill System](#skill-system)
|
|
77
77
|
- [KiCad IPC](#kicad-ipc)
|
|
78
78
|
- [Project Structure](#project-structure)
|
|
@@ -85,7 +85,7 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
85
85
|
- KiCad 10.0 or higher
|
|
86
86
|
- [`uv`](https://github.com/astral-sh/uv) — manages the Python virtual environment and installs the correct Python version automatically
|
|
87
87
|
- `curl -Lsf https://astral.sh/uv/install.sh | sh`
|
|
88
|
-
- An API key for OpenAI, Anthropic, or a compatible LLM provider
|
|
88
|
+
- An API key for OpenAI, Anthropic, Amazon Bedrock, or a compatible LLM provider (Ollama needs none)
|
|
89
89
|
|
|
90
90
|
## Installation
|
|
91
91
|
|
|
@@ -94,8 +94,8 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
94
94
|
Only needed if you want to build the plugin from source or contribute to the project. Skip this step if you're downloading the pre-built plugin from the Releases page.
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
git clone https://github.com/paul356/
|
|
98
|
-
cd
|
|
97
|
+
git clone https://github.com/paul356/KiCad-AI-Assistant.git
|
|
98
|
+
cd KiCad-AI-Assistant
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
### 2. Install the plugin
|
|
@@ -109,6 +109,13 @@ mkdir -p "$KICAD_PLUGIN_DIR"
|
|
|
109
109
|
unzip kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
**macOS:**
|
|
113
|
+
```bash
|
|
114
|
+
KICAD_PLUGIN_DIR=~/Documents/KiCad/10.0/scripting/plugins
|
|
115
|
+
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
116
|
+
unzip kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
117
|
+
```
|
|
118
|
+
|
|
112
119
|
**Windows (PowerShell):**
|
|
113
120
|
```powershell
|
|
114
121
|
$KICAD_PLUGIN_DIR = "$env:USERPROFILE\Documents\KiCad\10.0\scripting\plugins"
|
|
@@ -126,6 +133,11 @@ make dist-plugin # produces dist/kicad_ai_assistant.zip
|
|
|
126
133
|
KICAD_PLUGIN_DIR=~/.local/share/kicad/10.0/scripting/plugins
|
|
127
134
|
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
128
135
|
unzip dist/kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
136
|
+
|
|
137
|
+
# macOS:
|
|
138
|
+
KICAD_PLUGIN_DIR=~/Documents/KiCad/10.0/scripting/plugins
|
|
139
|
+
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
140
|
+
unzip dist/kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
129
141
|
```
|
|
130
142
|
|
|
131
143
|
### 3. Create the plugin virtual environment
|
|
@@ -138,6 +150,12 @@ cd ~/.local/share/kicad/10.0/scripting/plugins/kicad_ai_assistant
|
|
|
138
150
|
./setup_plugin.sh
|
|
139
151
|
```
|
|
140
152
|
|
|
153
|
+
**macOS:**
|
|
154
|
+
```bash
|
|
155
|
+
cd ~/Documents/KiCad/10.0/scripting/plugins/kicad_ai_assistant
|
|
156
|
+
./setup_plugin.sh
|
|
157
|
+
```
|
|
158
|
+
|
|
141
159
|
**Windows (PowerShell):**
|
|
142
160
|
```powershell
|
|
143
161
|
cd "$env:USERPROFILE\Documents\KiCad\10.0\scripting\plugins\kicad_ai_assistant"
|
|
@@ -170,15 +188,28 @@ All settings can be changed through **Options → Settings** in the plugin panel
|
|
|
170
188
|
|
|
171
189
|
| Setting | Description | Default |
|
|
172
190
|
|---------|-------------|---------|
|
|
173
|
-
| `llm_provider` | LLM provider: `openai`, `anthropic`, or `
|
|
174
|
-
| `llm_api_key` | Your LLM API key (stored with owner-only permissions) | *(empty)* |
|
|
175
|
-
| `llm_model` | Model name | `gpt-4o` |
|
|
176
|
-
| `llm_base_url` | Custom endpoint URL (
|
|
191
|
+
| `llm_provider` | LLM provider: `openai`, `anthropic`, `ollama`, or `bedrock` | `openai` |
|
|
192
|
+
| `llm_api_key` | Your LLM API key (stored with owner-only permissions). For `bedrock`, a Bedrock API key used as a bearer token | *(empty)* |
|
|
193
|
+
| `llm_model` | Model name. For `bedrock`, a Bedrock model or inference-profile id — newer Claude models need the cross-region profile form, e.g. `us.anthropic.claude-opus-5-5` (swap `us.` for your region) | `gpt-4o` |
|
|
194
|
+
| `llm_base_url` | Custom endpoint URL (overrides the provider default) | *(provider default)* |
|
|
195
|
+
| `llm_aws_region` | AWS region for the Bedrock endpoint (also used for SigV4 signing) | `us-east-1` |
|
|
196
|
+
| `llm_aws_access_key_id` | AWS access key id — set this (plus the secret) to use SigV4 instead of a Bedrock API key | *(empty)* |
|
|
197
|
+
| `llm_aws_secret_access_key` | AWS secret access key for SigV4 auth | *(empty)* |
|
|
198
|
+
| `llm_aws_session_token` | Optional STS session token for temporary AWS credentials | *(empty)* |
|
|
177
199
|
| `server_port` | Fixed port for the built-in MCP server (`0` = auto) | `0` |
|
|
178
200
|
| `show_tool_log` | Show tool-call log panel by default | `true` |
|
|
179
201
|
| `llm_context_tokens` | Total context window size in tokens | `128000` |
|
|
180
202
|
| `llm_compact_threshold` | Trigger context compaction at this usage fraction | `0.70` |
|
|
181
203
|
|
|
204
|
+
### Amazon Bedrock
|
|
205
|
+
|
|
206
|
+
Bedrock requests go to the native Bedrock Runtime `InvokeModel` API (not the OpenAI-compatible endpoint, which only serves non-Claude models), using the Anthropic Messages format. Authentication is chosen automatically:
|
|
207
|
+
|
|
208
|
+
- **Bedrock API key** — leave the AWS credential fields blank and put the key in `llm_api_key`; it is sent as a bearer token.
|
|
209
|
+
- **AWS SigV4** — set `llm_aws_access_key_id` + `llm_aws_secret_access_key` (and optionally `llm_aws_session_token`); requests are signed with SigV4 for the configured `llm_aws_region`.
|
|
210
|
+
|
|
211
|
+
Use a model id enabled in your account/region — the cross-region inference-profile ids work well, e.g. `us.anthropic.claude-opus-5-5` or a versioned id like `us.anthropic.claude-sonnet-4-5-20250929-v1:0`. List yours with `aws bedrock list-inference-profiles --region <region>`. Responses are streamed to the chat panel in a single block, since Bedrock's streaming uses a binary framing the plugin's transport does not decode.
|
|
212
|
+
|
|
182
213
|
## Standalone MCP Server
|
|
183
214
|
|
|
184
215
|
You can also run `kcaa` as a standalone MCP server without the KiCad plugin. This is useful for integrating with other MCP clients (e.g., Claude Desktop, Cursor).
|
|
@@ -241,6 +272,7 @@ kcaa
|
|
|
241
272
|
| Tool | Description |
|
|
242
273
|
|------|-------------|
|
|
243
274
|
| `add_symbol_to_schematic` | Place a symbol on the schematic |
|
|
275
|
+
| `create_symbol` | Define a new symbol into a symbol library (definition only — no schematic placement) |
|
|
244
276
|
| `place_symbol_relative` | Place a symbol relative to an existing component |
|
|
245
277
|
| `remove_symbol_from_schematic` | Remove placed symbol by reference |
|
|
246
278
|
| `move_component` | Move and/or rotate a placed component |
|
|
@@ -256,6 +288,9 @@ kcaa
|
|
|
256
288
|
| `add_label_to_schematic` | Add a local net label |
|
|
257
289
|
| `list_labels_in_schematic` | List all local net labels |
|
|
258
290
|
| `delete_label_from_schematic` | Delete net labels |
|
|
291
|
+
| `add_no_connect` | Add a no-connect flag at a pin coordinate |
|
|
292
|
+
| `list_no_connects` | List all no-connect flags |
|
|
293
|
+
| `remove_no_connect` | Remove no-connect flag(s) by coordinate |
|
|
259
294
|
| `get_schematic_sheet_info` | Get drawing area, paper size, and grid |
|
|
260
295
|
| `find_free_area` | Find candidate areas for placing a block |
|
|
261
296
|
|
|
@@ -265,6 +300,7 @@ kcaa
|
|
|
265
300
|
|------|-------------|
|
|
266
301
|
| `extract_schematic_netlist` | Extract netlist from a schematic |
|
|
267
302
|
| `find_component_connections` | Find all connections for a component |
|
|
303
|
+
| `run_erc` | Run Electrical Rules Check (headless `kicad-cli`) and return violations |
|
|
268
304
|
| `identify_circuit_patterns` | Identify common circuit patterns |
|
|
269
305
|
| `validate_project` | Basic validation of a KiCad project |
|
|
270
306
|
| `validate_project_boundaries` | Validate component boundaries |
|
|
@@ -12,7 +12,7 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
12
12
|
- [Table of Contents](#table-of-contents)
|
|
13
13
|
- [Prerequisites](#prerequisites)
|
|
14
14
|
- [Installation](#installation)
|
|
15
|
-
- [1. Clone the repository](#1-clone-the-repository)
|
|
15
|
+
- [1. Clone the repository (optional)](#1-clone-the-repository-optional)
|
|
16
16
|
- [2. Install the plugin](#2-install-the-plugin)
|
|
17
17
|
- [3. Create the plugin virtual environment](#3-create-the-plugin-virtual-environment)
|
|
18
18
|
- [4. Load the plugin in KiCad](#4-load-the-plugin-in-kicad)
|
|
@@ -31,8 +31,8 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
31
31
|
- [PCB Placement](#pcb-placement)
|
|
32
32
|
- [PCB Groups](#pcb-groups)
|
|
33
33
|
- [PCB Zones](#pcb-zones)
|
|
34
|
-
- [DRC
|
|
35
|
-
- [Versioning
|
|
34
|
+
- [DRC \& Design Rules](#drc--design-rules)
|
|
35
|
+
- [Versioning \& Export](#versioning--export)
|
|
36
36
|
- [Skill System](#skill-system)
|
|
37
37
|
- [KiCad IPC](#kicad-ipc)
|
|
38
38
|
- [Project Structure](#project-structure)
|
|
@@ -45,7 +45,7 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
45
45
|
- KiCad 10.0 or higher
|
|
46
46
|
- [`uv`](https://github.com/astral-sh/uv) — manages the Python virtual environment and installs the correct Python version automatically
|
|
47
47
|
- `curl -Lsf https://astral.sh/uv/install.sh | sh`
|
|
48
|
-
- An API key for OpenAI, Anthropic, or a compatible LLM provider
|
|
48
|
+
- An API key for OpenAI, Anthropic, Amazon Bedrock, or a compatible LLM provider (Ollama needs none)
|
|
49
49
|
|
|
50
50
|
## Installation
|
|
51
51
|
|
|
@@ -54,8 +54,8 @@ Tested on **KiCad 10.0 / Linux & Windows**.
|
|
|
54
54
|
Only needed if you want to build the plugin from source or contribute to the project. Skip this step if you're downloading the pre-built plugin from the Releases page.
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
|
-
git clone https://github.com/paul356/
|
|
58
|
-
cd
|
|
57
|
+
git clone https://github.com/paul356/KiCad-AI-Assistant.git
|
|
58
|
+
cd KiCad-AI-Assistant
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
### 2. Install the plugin
|
|
@@ -69,6 +69,13 @@ mkdir -p "$KICAD_PLUGIN_DIR"
|
|
|
69
69
|
unzip kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
**macOS:**
|
|
73
|
+
```bash
|
|
74
|
+
KICAD_PLUGIN_DIR=~/Documents/KiCad/10.0/scripting/plugins
|
|
75
|
+
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
76
|
+
unzip kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
77
|
+
```
|
|
78
|
+
|
|
72
79
|
**Windows (PowerShell):**
|
|
73
80
|
```powershell
|
|
74
81
|
$KICAD_PLUGIN_DIR = "$env:USERPROFILE\Documents\KiCad\10.0\scripting\plugins"
|
|
@@ -86,6 +93,11 @@ make dist-plugin # produces dist/kicad_ai_assistant.zip
|
|
|
86
93
|
KICAD_PLUGIN_DIR=~/.local/share/kicad/10.0/scripting/plugins
|
|
87
94
|
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
88
95
|
unzip dist/kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
96
|
+
|
|
97
|
+
# macOS:
|
|
98
|
+
KICAD_PLUGIN_DIR=~/Documents/KiCad/10.0/scripting/plugins
|
|
99
|
+
mkdir -p "$KICAD_PLUGIN_DIR"
|
|
100
|
+
unzip dist/kicad_ai_assistant.zip -d "$KICAD_PLUGIN_DIR"
|
|
89
101
|
```
|
|
90
102
|
|
|
91
103
|
### 3. Create the plugin virtual environment
|
|
@@ -98,6 +110,12 @@ cd ~/.local/share/kicad/10.0/scripting/plugins/kicad_ai_assistant
|
|
|
98
110
|
./setup_plugin.sh
|
|
99
111
|
```
|
|
100
112
|
|
|
113
|
+
**macOS:**
|
|
114
|
+
```bash
|
|
115
|
+
cd ~/Documents/KiCad/10.0/scripting/plugins/kicad_ai_assistant
|
|
116
|
+
./setup_plugin.sh
|
|
117
|
+
```
|
|
118
|
+
|
|
101
119
|
**Windows (PowerShell):**
|
|
102
120
|
```powershell
|
|
103
121
|
cd "$env:USERPROFILE\Documents\KiCad\10.0\scripting\plugins\kicad_ai_assistant"
|
|
@@ -130,15 +148,28 @@ All settings can be changed through **Options → Settings** in the plugin panel
|
|
|
130
148
|
|
|
131
149
|
| Setting | Description | Default |
|
|
132
150
|
|---------|-------------|---------|
|
|
133
|
-
| `llm_provider` | LLM provider: `openai`, `anthropic`, or `
|
|
134
|
-
| `llm_api_key` | Your LLM API key (stored with owner-only permissions) | *(empty)* |
|
|
135
|
-
| `llm_model` | Model name | `gpt-4o` |
|
|
136
|
-
| `llm_base_url` | Custom endpoint URL (
|
|
151
|
+
| `llm_provider` | LLM provider: `openai`, `anthropic`, `ollama`, or `bedrock` | `openai` |
|
|
152
|
+
| `llm_api_key` | Your LLM API key (stored with owner-only permissions). For `bedrock`, a Bedrock API key used as a bearer token | *(empty)* |
|
|
153
|
+
| `llm_model` | Model name. For `bedrock`, a Bedrock model or inference-profile id — newer Claude models need the cross-region profile form, e.g. `us.anthropic.claude-opus-5-5` (swap `us.` for your region) | `gpt-4o` |
|
|
154
|
+
| `llm_base_url` | Custom endpoint URL (overrides the provider default) | *(provider default)* |
|
|
155
|
+
| `llm_aws_region` | AWS region for the Bedrock endpoint (also used for SigV4 signing) | `us-east-1` |
|
|
156
|
+
| `llm_aws_access_key_id` | AWS access key id — set this (plus the secret) to use SigV4 instead of a Bedrock API key | *(empty)* |
|
|
157
|
+
| `llm_aws_secret_access_key` | AWS secret access key for SigV4 auth | *(empty)* |
|
|
158
|
+
| `llm_aws_session_token` | Optional STS session token for temporary AWS credentials | *(empty)* |
|
|
137
159
|
| `server_port` | Fixed port for the built-in MCP server (`0` = auto) | `0` |
|
|
138
160
|
| `show_tool_log` | Show tool-call log panel by default | `true` |
|
|
139
161
|
| `llm_context_tokens` | Total context window size in tokens | `128000` |
|
|
140
162
|
| `llm_compact_threshold` | Trigger context compaction at this usage fraction | `0.70` |
|
|
141
163
|
|
|
164
|
+
### Amazon Bedrock
|
|
165
|
+
|
|
166
|
+
Bedrock requests go to the native Bedrock Runtime `InvokeModel` API (not the OpenAI-compatible endpoint, which only serves non-Claude models), using the Anthropic Messages format. Authentication is chosen automatically:
|
|
167
|
+
|
|
168
|
+
- **Bedrock API key** — leave the AWS credential fields blank and put the key in `llm_api_key`; it is sent as a bearer token.
|
|
169
|
+
- **AWS SigV4** — set `llm_aws_access_key_id` + `llm_aws_secret_access_key` (and optionally `llm_aws_session_token`); requests are signed with SigV4 for the configured `llm_aws_region`.
|
|
170
|
+
|
|
171
|
+
Use a model id enabled in your account/region — the cross-region inference-profile ids work well, e.g. `us.anthropic.claude-opus-5-5` or a versioned id like `us.anthropic.claude-sonnet-4-5-20250929-v1:0`. List yours with `aws bedrock list-inference-profiles --region <region>`. Responses are streamed to the chat panel in a single block, since Bedrock's streaming uses a binary framing the plugin's transport does not decode.
|
|
172
|
+
|
|
142
173
|
## Standalone MCP Server
|
|
143
174
|
|
|
144
175
|
You can also run `kcaa` as a standalone MCP server without the KiCad plugin. This is useful for integrating with other MCP clients (e.g., Claude Desktop, Cursor).
|
|
@@ -201,6 +232,7 @@ kcaa
|
|
|
201
232
|
| Tool | Description |
|
|
202
233
|
|------|-------------|
|
|
203
234
|
| `add_symbol_to_schematic` | Place a symbol on the schematic |
|
|
235
|
+
| `create_symbol` | Define a new symbol into a symbol library (definition only — no schematic placement) |
|
|
204
236
|
| `place_symbol_relative` | Place a symbol relative to an existing component |
|
|
205
237
|
| `remove_symbol_from_schematic` | Remove placed symbol by reference |
|
|
206
238
|
| `move_component` | Move and/or rotate a placed component |
|
|
@@ -216,6 +248,9 @@ kcaa
|
|
|
216
248
|
| `add_label_to_schematic` | Add a local net label |
|
|
217
249
|
| `list_labels_in_schematic` | List all local net labels |
|
|
218
250
|
| `delete_label_from_schematic` | Delete net labels |
|
|
251
|
+
| `add_no_connect` | Add a no-connect flag at a pin coordinate |
|
|
252
|
+
| `list_no_connects` | List all no-connect flags |
|
|
253
|
+
| `remove_no_connect` | Remove no-connect flag(s) by coordinate |
|
|
219
254
|
| `get_schematic_sheet_info` | Get drawing area, paper size, and grid |
|
|
220
255
|
| `find_free_area` | Find candidate areas for placing a block |
|
|
221
256
|
|
|
@@ -225,6 +260,7 @@ kcaa
|
|
|
225
260
|
|------|-------------|
|
|
226
261
|
| `extract_schematic_netlist` | Extract netlist from a schematic |
|
|
227
262
|
| `find_component_connections` | Find all connections for a component |
|
|
263
|
+
| `run_erc` | Run Electrical Rules Check (headless `kicad-cli`) and return violations |
|
|
228
264
|
| `identify_circuit_patterns` | Identify common circuit patterns |
|
|
229
265
|
| `validate_project` | Basic validation of a KiCad project |
|
|
230
266
|
| `validate_project_boundaries` | Validate component boundaries |
|
|
@@ -28,10 +28,12 @@ from fastmcp import FastMCP
|
|
|
28
28
|
# loading kicad-cli-dependent modules when running in plugin mode.
|
|
29
29
|
from kcaa.context import kicad_lifespan
|
|
30
30
|
from kcaa.tools.drc_tools import register_drc_tools
|
|
31
|
+
from kcaa.tools.erc_tools import register_erc_tools
|
|
31
32
|
from kcaa.tools.kipy_tools import register_kipy_tools
|
|
32
33
|
|
|
33
34
|
# Plugin profile tools — always imported (skip-based, no kicad-cli dependency)
|
|
34
35
|
from kcaa.tools.netlist_tools import register_netlist_tools
|
|
36
|
+
from kcaa.tools.no_connect_tools import register_no_connect_tools
|
|
35
37
|
from kcaa.tools.pcb_edit_tools import register_pcb_edit_tools
|
|
36
38
|
from kcaa.tools.pcb_group_tools import register_pcb_group_tools
|
|
37
39
|
from kcaa.tools.pcb_library_tools import register_pcb_library_tools
|
|
@@ -123,6 +125,7 @@ def _register_plugin_profile(mcp: FastMCP) -> None:
|
|
|
123
125
|
register_symbol_edit_tools(mcp)
|
|
124
126
|
register_sheet_tools(mcp)
|
|
125
127
|
register_wire_edit_tools(mcp)
|
|
128
|
+
register_no_connect_tools(mcp)
|
|
126
129
|
register_pcb_library_tools(mcp)
|
|
127
130
|
register_pcb_query_tools(mcp)
|
|
128
131
|
register_pcb_placement_tools(mcp)
|
|
@@ -136,6 +139,7 @@ def _register_plugin_profile(mcp: FastMCP) -> None:
|
|
|
136
139
|
register_render_board_tools(mcp)
|
|
137
140
|
register_kipy_tools(mcp)
|
|
138
141
|
register_drc_tools(mcp)
|
|
142
|
+
register_erc_tools(mcp)
|
|
139
143
|
register_skill_tools(mcp)
|
|
140
144
|
register_version_tools(mcp)
|
|
141
145
|
|
|
@@ -179,6 +183,7 @@ def _register_full_profile(mcp: FastMCP) -> None:
|
|
|
179
183
|
register_export_tools(mcp)
|
|
180
184
|
register_render_board_tools(mcp)
|
|
181
185
|
register_drc_tools(mcp)
|
|
186
|
+
register_erc_tools(mcp)
|
|
182
187
|
register_bom_tools(mcp)
|
|
183
188
|
register_netlist_tools(mcp)
|
|
184
189
|
register_pattern_tools(mcp)
|
|
@@ -186,6 +191,7 @@ def _register_full_profile(mcp: FastMCP) -> None:
|
|
|
186
191
|
register_symbol_edit_tools(mcp)
|
|
187
192
|
register_sheet_tools(mcp)
|
|
188
193
|
register_wire_edit_tools(mcp)
|
|
194
|
+
register_no_connect_tools(mcp)
|
|
189
195
|
register_pcb_library_tools(mcp)
|
|
190
196
|
register_pcb_query_tools(mcp)
|
|
191
197
|
register_pcb_placement_tools(mcp)
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""Electrical Rules Check (ERC) tools for the KiCad MCP server.
|
|
2
|
+
|
|
3
|
+
Runs KiCad's schematic ERC headlessly via ``kicad-cli sch erc`` and returns
|
|
4
|
+
the violations as structured data the assistant can read and act on (unlike
|
|
5
|
+
the PCB DRC tool, which only opens a dialog over the IPC API). Requires
|
|
6
|
+
``kicad-cli`` on PATH or ``KICAD_CLI_PATH`` set; it does not use the KiCad
|
|
7
|
+
IPC socket.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import logging
|
|
12
|
+
import os
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from fastmcp import Context, FastMCP
|
|
16
|
+
|
|
17
|
+
from kcaa.utils.kicad_cli import KiCadCLIError
|
|
18
|
+
from kcaa.utils.secure_subprocess import create_temp_file, run_kicad_command_async
|
|
19
|
+
|
|
20
|
+
log = logging.getLogger(__name__)
|
|
21
|
+
|
|
22
|
+
# severity keyword -> kicad-cli flags. "default" uses KiCad's own default
|
|
23
|
+
# (errors + warnings); "all" additionally includes excluded violations.
|
|
24
|
+
_SEVERITY_FLAGS: dict[str, list[str]] = {
|
|
25
|
+
"default": ["--severity-error", "--severity-warning"],
|
|
26
|
+
"all": ["--severity-all"],
|
|
27
|
+
"error": ["--severity-error"],
|
|
28
|
+
"warning": ["--severity-warning"],
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _flatten_violations(report: dict[str, Any]) -> list[dict[str, Any]]:
|
|
33
|
+
"""Flatten the per-sheet violations of a kicad-cli ERC JSON report."""
|
|
34
|
+
violations: list[dict[str, Any]] = []
|
|
35
|
+
for sheet in report.get("sheets", []) or []:
|
|
36
|
+
sheet_path = sheet.get("path", "/")
|
|
37
|
+
for v in sheet.get("violations", []) or []:
|
|
38
|
+
items = []
|
|
39
|
+
for it in v.get("items", []) or []:
|
|
40
|
+
pos = it.get("pos") or {}
|
|
41
|
+
items.append(
|
|
42
|
+
{
|
|
43
|
+
"description": it.get("description", ""),
|
|
44
|
+
"x": pos.get("x"),
|
|
45
|
+
"y": pos.get("y"),
|
|
46
|
+
"uuid": it.get("uuid", ""),
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
violations.append(
|
|
50
|
+
{
|
|
51
|
+
"type": v.get("type", ""),
|
|
52
|
+
"severity": v.get("severity", ""),
|
|
53
|
+
# An excluded marker keeps its underlying severity in the
|
|
54
|
+
# JSON; the excluded state is a separate boolean field
|
|
55
|
+
# (with an optional comment in KiCad 9/10).
|
|
56
|
+
"excluded": bool(v.get("excluded", False)),
|
|
57
|
+
"comment": v.get("comment", ""),
|
|
58
|
+
"description": v.get("description", ""),
|
|
59
|
+
"sheet": sheet_path,
|
|
60
|
+
"items": items,
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
return violations
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def register_erc_tools(mcp: FastMCP) -> None:
|
|
67
|
+
"""Register ERC tools against *mcp*."""
|
|
68
|
+
|
|
69
|
+
@mcp.tool()
|
|
70
|
+
async def run_erc(
|
|
71
|
+
schematic_path: str,
|
|
72
|
+
severity: str = "default",
|
|
73
|
+
ctx: Context | None = None,
|
|
74
|
+
) -> dict[str, Any]:
|
|
75
|
+
"""Run KiCad's Electrical Rules Check (ERC) on a schematic.
|
|
76
|
+
|
|
77
|
+
Runs ``kicad-cli sch erc`` headlessly (no GUI, no IPC socket needed)
|
|
78
|
+
and returns the violations as structured data. The check follows the
|
|
79
|
+
full sheet hierarchy from *schematic_path*.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
schematic_path: Absolute path to the root .kicad_sch file.
|
|
83
|
+
severity: Which violations to report:
|
|
84
|
+
"default" (errors + warnings), "all" (also excluded),
|
|
85
|
+
"error" (errors only), or "warning" (warnings only).
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
dict with keys: success (bool), violation_count (int),
|
|
89
|
+
error_count, warning_count, exclusion_count, violations (list of
|
|
90
|
+
{type, severity, description, sheet, items:[{description, x, y,
|
|
91
|
+
uuid}]}), kicad_version, source, coordinate_units. On failure:
|
|
92
|
+
{success: False, error: str}.
|
|
93
|
+
"""
|
|
94
|
+
if not schematic_path.endswith(".kicad_sch"):
|
|
95
|
+
return {"success": False, "error": f"Not a .kicad_sch file: {schematic_path!r}"}
|
|
96
|
+
if not os.path.isfile(schematic_path):
|
|
97
|
+
return {"success": False, "error": f"Schematic file not found: {schematic_path!r}"}
|
|
98
|
+
flags = _SEVERITY_FLAGS.get(severity)
|
|
99
|
+
if flags is None:
|
|
100
|
+
return {
|
|
101
|
+
"success": False,
|
|
102
|
+
"error": f"severity must be one of {sorted(_SEVERITY_FLAGS)} (got {severity!r})",
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if ctx is not None:
|
|
106
|
+
ctx.info(f"Running ERC on {os.path.basename(schematic_path)}")
|
|
107
|
+
await ctx.report_progress(10, 100)
|
|
108
|
+
|
|
109
|
+
out_path = create_temp_file(suffix=".json", prefix="kcaa_erc_")
|
|
110
|
+
# Deliberately omit --exit-code-violations so a schematic with
|
|
111
|
+
# violations still exits 0; a nonzero code then signals a real failure.
|
|
112
|
+
command = [
|
|
113
|
+
"sch",
|
|
114
|
+
"erc",
|
|
115
|
+
schematic_path,
|
|
116
|
+
"--format",
|
|
117
|
+
"json",
|
|
118
|
+
"--output",
|
|
119
|
+
out_path,
|
|
120
|
+
*flags,
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
try:
|
|
124
|
+
try:
|
|
125
|
+
result = await run_kicad_command_async(
|
|
126
|
+
command,
|
|
127
|
+
input_files=[schematic_path],
|
|
128
|
+
output_files=[out_path],
|
|
129
|
+
timeout=120.0,
|
|
130
|
+
)
|
|
131
|
+
except KiCadCLIError as exc:
|
|
132
|
+
return {"success": False, "error": str(exc)}
|
|
133
|
+
except Exception as exc: # noqa: BLE001 — surface CLI/subprocess failures
|
|
134
|
+
return {"success": False, "error": f"Failed to run ERC: {exc}"}
|
|
135
|
+
|
|
136
|
+
if result.returncode != 0:
|
|
137
|
+
stderr = (result.stderr or "").strip()
|
|
138
|
+
return {
|
|
139
|
+
"success": False,
|
|
140
|
+
"error": f"kicad-cli ERC failed (exit {result.returncode}): {stderr[:300]}",
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
with open(out_path, encoding="utf-8") as f:
|
|
145
|
+
report = json.load(f)
|
|
146
|
+
except (OSError, json.JSONDecodeError) as exc:
|
|
147
|
+
return {"success": False, "error": f"Could not read ERC report: {exc}"}
|
|
148
|
+
finally:
|
|
149
|
+
# Always clean up the temp report, including on the error returns above.
|
|
150
|
+
try:
|
|
151
|
+
os.unlink(out_path)
|
|
152
|
+
except OSError:
|
|
153
|
+
pass
|
|
154
|
+
|
|
155
|
+
violations = _flatten_violations(report)
|
|
156
|
+
# Excluded markers keep their underlying severity but must not count as
|
|
157
|
+
# live errors/warnings; they are tallied separately. (With the default
|
|
158
|
+
# severity mask KiCad omits excluded items entirely; they only appear
|
|
159
|
+
# under severity="all".)
|
|
160
|
+
error_count = sum(1 for v in violations if v["severity"] == "error" and not v["excluded"])
|
|
161
|
+
warning_count = sum(
|
|
162
|
+
1 for v in violations if v["severity"] == "warning" and not v["excluded"]
|
|
163
|
+
)
|
|
164
|
+
exclusion_count = sum(1 for v in violations if v["excluded"])
|
|
165
|
+
|
|
166
|
+
if ctx is not None:
|
|
167
|
+
await ctx.report_progress(100, 100)
|
|
168
|
+
ctx.info(
|
|
169
|
+
f"ERC complete: {error_count} error(s), {warning_count} warning(s), "
|
|
170
|
+
f"{exclusion_count} excluded"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
return {
|
|
174
|
+
"success": True,
|
|
175
|
+
"violation_count": len(violations),
|
|
176
|
+
"error_count": error_count,
|
|
177
|
+
"warning_count": warning_count,
|
|
178
|
+
"exclusion_count": exclusion_count,
|
|
179
|
+
"violations": violations,
|
|
180
|
+
"kicad_version": report.get("kicad_version"),
|
|
181
|
+
"source": report.get("source"),
|
|
182
|
+
"coordinate_units": report.get("coordinate_units"),
|
|
183
|
+
}
|