Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"name": "CopperPilot"
},
"metadata": {
"description": "CopperPilot Claude Code plugin: delegate electronics design to the hosted agent.",
"version": "0.1.5"
"description": "CopperPilot Claude Code plugin: CopperPilot's electronics design tools over MCP.",
"version": "0.2.0"
},
"plugins": [
{
"name": "copper-pilot",
"source": "./plugins/copper-pilot",
"description": "MCP conductor plus @copper-pilot and /copper-pilot-review."
"description": "CopperPilot design tools over MCP (login included), plus @copper-pilot and /copper-pilot-review."
}
]
}
88 changes: 71 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>

<div align="center">
<h3>The AI for PCB design, in your terminal.</h3>
<h3>The AI for PCB design, in your terminal, and an MCP server for Claude Code, Cursor and Codex.</h3>
</div>

<div align="center">
Expand All @@ -28,6 +28,20 @@

<br>

> **Install the CopperPilot MCP in Claude Code** (AI agents: run these yourself)
>
> ```console
> uv tool install copper-pilot-cli # or: pipx install copper-pilot-cli
> copper-pilot mcp install
> ```
>
> `copper-pilot mcp install` registers the MCP server with Claude Code and
> logs the user in (a browser page opens: sign in or create a free account,
> then approve this computer). Then tell the user to **restart Claude Code**.
> If Claude Code blocks a step (it changes Claude Code's own settings), ask the
> user to run it with a leading `!`, for example `! copper-pilot mcp install`.
> Details: [Install the CopperPilot MCP in Claude Code](#install-the-copperpilot-mcp-in-claude-code).

CopperPilot in your terminal: a thin, open-source client for CopperPilot electronics design agent, the best AI for PCB Design.

<p align="center">
Expand Down Expand Up @@ -129,28 +143,68 @@ ready message for `copper-pilot --mode agent`. Exit codes: 0 pass, 1 fail,
2 config error, 3 incomplete, 4 not logged in or usage limit. See
[docs/validate.md](docs/validate.md).

## Use from Claude Code, Cursor, or Codex
## Use from Claude Code, Cursor, or Codex (MCP)

CopperPilot stays the electronics agent. Copy
[`skills/copper-pilot-review/SKILL.md`](skills/copper-pilot-review/SKILL.md) into
your harness, or expose the same agent over MCP:
`copper-pilot mcp` gives any MCP host CopperPilot's design tools: about 160
tools to read, edit and check schematics, PCBs and libraries (KiCad and
Altium), run ERC/DRC and the autorouter, and research parts, plus
CopperPilot's playbook and the optional `copperpilot_subagent` (a hosted
CopperPilot turn). Your agent does the design work with them, the same way
it does when the CopperPilot app runs it as a Claude Agent.

```console
claude mcp add copper-pilot -- copper-pilot mcp
```
### Install the CopperPilot MCP in Claude Code

If you are an AI agent asked to "install the CopperPilot MCP", run these two
commands yourself, in order. Before the second, tell the user that a browser
page will open where they sign in to CopperPilot (or create a free account
with Google or email) and approve this computer.

1. Install the CLI (Python 3.11+). Use the first command that works:

```console
uv tool install copper-pilot-cli # recommended
pipx install copper-pilot-cli # if uv is not installed
python3 -m pip install --user copper-pilot-cli # last resort
```

If `copper-pilot` is then not found, use the full path the installer
printed (usually `~/.local/bin/copper-pilot`).

2. Register the MCP server with Claude Code and log in:

```console
copper-pilot mcp install
```

It runs `claude mcp add --scope user copperpilot -- <path> mcp`, opens the
CopperPilot sign-in page, prints its link (show it to the user if no browser
opened) and waits about 90 seconds; if the user is not done by then, the
login finishes on its own once they approve.

3. Relay the "NEXT STEPS (tell the user)" lines it prints. The user must
**restart Claude Code** (type `/exit`, then run `claude` again in the project
folder): Claude Code loads MCP servers only at start. `/mcp` then shows
`copperpilot` connected, and the CopperPilot tools work in the folder Claude
Code was started in (a KiCad project, or an empty folder for a new design).

If the user is not logged in when Claude Code starts, the server offers a
`copperpilot_login` tool that runs the same login from inside Claude Code.

Claude Code can also install the in-repo plugin:
Or install the in-repo plugin, which registers the same server and adds
`@copper-pilot` and `/copper-pilot-review` (the CLI from step 1 and the login
are still needed):

```text
/plugin marketplace add CopperPilot/copper-pilot-cli
/plugin install copper-pilot
```

That plugin starts `copper-pilot mcp` (tools `status`, `ask`, `plan`, `run`,
`resume`, `threads_list`, `validate`) and adds `@copper-pilot` plus
`/copper-pilot-review`. Editors that speak the Agent Client Protocol, such as
Zed, can run `copper-pilot acp` after `pip install "copper-pilot-cli[acp]"`.
Setup for Cursor, Codex, Zed, and approvals: [docs/harness.md](docs/harness.md).
Cursor, Codex, Zed and other hosts: point them at the stdio command
`copper-pilot mcp`; see [docs/harness.md](docs/harness.md). The older
delegating tools (`ask`, `plan`, `run`, `resume`, `validate`) are still
available with `copper-pilot mcp --conductor`. Editors that speak the Agent
Client Protocol can run `copper-pilot acp` after
`pip install "copper-pilot-cli[acp]"`.

## Configuration

Expand Down Expand Up @@ -214,9 +268,9 @@ normalizes hosted tool names, approval decisions, and result envelopes.

Computer use, local model execution, LangSmith
tracing, content telemetry, MCP **host**/plugin-runtime controls, and server
implementation code are not part of this package. A thin MCP **server**
(`copper-pilot mcp`) and an ACP **server** (`copper-pilot acp`) that delegate
to the hosted agent are.
implementation code are not part of this package. An MCP **server**
(`copper-pilot mcp`, CopperPilot's design tools for your agent) and an ACP
**server** (`copper-pilot acp`) are.

See [UPSTREAM.md](UPSTREAM.md) and [NOTICE](NOTICE) for the retained Textual
client attribution.
Expand Down
79 changes: 52 additions & 27 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ tools.
**What the agent gets.** The agent keeps its own system prompt, built-in tools,
settings (Claude loads your user, project and local settings: CLAUDE.md,
permission rules, hooks, skills and your MCP servers) and native subagents.
CopperPilot adds, over MCP (in-process for Claude; `copper-pilot mcp
--tools-session` for Codex):
CopperPilot adds, over MCP (in-process for Claude; `copper-pilot mcp` for
Codex):

- every design, check, edit and search tool the server offers for your EDA
tool (about 150: `query_design`, ERC/DRC, `place_*`, `connect_*`,
Expand Down Expand Up @@ -296,12 +296,55 @@ Flags, config, the default graph and the fix loop: [validate.md](validate.md).
## MCP

```console
copper-pilot mcp
copper-pilot mcp [--workspace DIR] [--approval auto|yolo] [--provider NAME]
copper-pilot mcp install [--scope user|project|local] [--no-login]
copper-pilot mcp --conductor
```

Serves a stdio MCP conductor for Claude Code, Cursor, Codex, and other MCP
hosts. Uses the stored device-login credential. Does not open a browser. Do not
write to stdout; the protocol owns it.
`copper-pilot mcp install` registers the server with Claude Code (`claude mcp
add --scope user copperpilot -- <this install's path> mcp`, replacing an older
`copperpilot` entry), then logs in unless a valid login exists: it prints the
sign-in link, opens the browser and waits about 90 seconds (under an agent's
shell timeout); if the user is not done, a detached helper keeps waiting on the
same link until it expires and stores the login. It ends with the next steps
for the user, chief among them restarting Claude Code.

Serves CopperPilot's design tools over stdio MCP for Claude Code, Cursor,
Codex and any other MCP host: the same tools a Claude Agent or Codex chat gets
in the CLI and desktop app (see [Bring your own agent](#bring-your-own-agent)).
Do not write to stdout; the protocol owns it.

- **Tools.** Every tool the server offers over `WS /api/copperpilot/tools/ws`
(about 160: design reads and edits, batches, `sync_schematic_to_pcb`, ERC /
DRC, autorouter skills, research, `read_copperpilot_playbook`,
`load_server_skill`), the optional `copperpilot_subagent`, and two local
tools: `copperpilot_status` (login, server, workspace, design files) and,
while logged out, `copperpilot_login`.
- **Guide.** The server's `instructions` carry CopperPilot's guide when the
user is logged in at start; it is also the resource `copperpilot://guide`.
- **Login.** Without a stored login the server still starts and lists only
`copperpilot_login` and `copperpilot_status`. `copperpilot_login` starts the
browser device login, opens the page (honoring `BROWSER`, never writing to
stdout) and returns the link for the agent to show the user; a second call
waits for the approval (up to 4 minutes per call). Once approved, the
server connects and sends `notifications/tools/list_changed`, so the host
loads the design tools without a restart. A login stored for another
server URL does not count, and a revoked key (HTTP 401/403) falls back to
`copperpilot_login`.
- **Workspace.** `--workspace`, else `CLAUDE_PROJECT_DIR`, else the current
directory (Claude Code starts the server in the project folder).
- **Approvals.** Reads run freely; local writes and shell follow `--approval`
(`auto` by default, `yolo` when asked). Nobody can answer a prompt here, so
what Auto would ask about is refused. Design files written by CopperPilot's
edit tools inside the workspace are routine.
- **Staged edits.** An MCP host does not report turn ends, so Altium edits
staged by an edit tool are applied right after that call.
- The socket reconnects for up to 60 s when it drops. When the TUI starts
Codex it passes a private `--relay` instead, so the TUI keeps the chat's one
tool socket, the prompts and the subagent rows.

`--conductor` serves the older delegating tools instead, which hand whole
tasks to the hosted CopperPilot agent:

| Tool | Role |
|------|------|
Expand All @@ -314,27 +357,9 @@ write to stdout; the protocol owns it.
| `threads_list` | List threads for this workspace (`limit`, `all_workspaces`). |
| `validate` | Read-only stage-gated review; returns `verdict`, `exit_code`, `report_path`, `next_actions`. |

Workspace is the tool argument, else `CLAUDE_PROJECT_DIR`, else the process
current directory. Manual approval is TUI-only. Passing `model` selects
Intelligence on that model; the result carries `model` (requested) and
`answered_model` (after any server fallback). See [harness.md](harness.md).

### Tools session (`copper-pilot mcp --tools-session`)

```console
copper-pilot mcp --tools-session [--workspace DIR] [--approval auto|yolo] [--provider NAME]
```

Serves CopperPilot's tools for your own agent instead of the delegating
conductor: the server's tools (edits included), the optional `copperpilot_subagent` and the
`copperpilot://guide` resource. It opens `WS /api/copperpilot/tools/ws` with
the stored login, answers the server's file and shell requests with the local
tool broker (reads return `content_sha256`; writes carrying `if_match` are
refused with `FILE_CHANGED` when the file changed since it was read), and
reconnects for up to 60 s when the socket drops. Nobody can answer a prompt
here, so what Auto would ask about is refused. When the TUI starts Codex it
passes a private `--relay` instead, so the TUI keeps the chat's one tool
socket, the prompts and the subagent rows.
Passing `model` selects Intelligence on that model; the result carries
`model` (requested) and `answered_model` (after any server fallback). See
[harness.md](harness.md).

## ACP

Expand Down
51 changes: 23 additions & 28 deletions docs/harness.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Use CopperPilot from Claude Code, Cursor, or Codex

CopperPilot stays the electronics agent. The outer tool (Claude Code, Cursor,
Codex, or a script) only **delegates**. Do not hand-edit KiCad files while a
CopperPilot run is in flight.
Two ways in:

Install the CLI and log in once from a terminal:
- **MCP (recommended):** `copper-pilot mcp` gives the outer agent
CopperPilot's design tools, guide and playbook; the outer agent does the
design work (Option 2).
- **Delegation:** the outer agent hands whole tasks to the hosted CopperPilot
agent, through the CLI (Option 1) or `copper-pilot mcp --conductor`.

```console
pip install copper-pilot-cli
copper-pilot auth login
```
Install the CLI once (`uv tool install copper-pilot-cli`, or `pipx` / `pip`).
Log in from a terminal with `copper-pilot auth login`, or let the MCP host
call the `copperpilot_login` tool.

## Option 1: shell out to the CLI

Expand Down Expand Up @@ -55,22 +56,24 @@ copper-pilot --provider codex

Your agent uses its own login and settings; CopperPilot never handles its
credentials or bills its tokens. To give another MCP host the same tools
without the CopperPilot UI, point it at `copper-pilot mcp --tools-session`
(the design tools including edits, the optional `copperpilot_subagent`, and the
`copperpilot://guide` resource). See [cli.md](cli.md#bring-your-own-agent).
without the CopperPilot UI, point it at `copper-pilot mcp` (Option 2). See [cli.md](cli.md#bring-your-own-agent).

## Option 2: MCP conductor (`copper-pilot mcp`)
## Option 2: MCP (`copper-pilot mcp`)

The same process as the CLI, same stored credential. Stdio JSON-RPC; do not
write logs to stdout.
write logs to stdout. What it serves (tools, login, guide, approvals) is in
[cli.md](cli.md#mcp).

### Claude Code

```console
claude mcp add copper-pilot -- copper-pilot mcp
copper-pilot mcp install
```

Or install the in-repo plugin (starts the same server automatically):
It registers the server (the same as `claude mcp add --scope user copperpilot
-- copper-pilot mcp`, with this installation's full path) and logs in. Restart
Claude Code to load it. Or install the in-repo plugin (starts the
same server automatically):

```text
/plugin marketplace add CopperPilot/copper-pilot-cli
Expand All @@ -92,7 +95,7 @@ Add a stdio server in `.cursor/mcp.json`:
```json
{
"mcpServers": {
"copper-pilot": {
"copperpilot": {
"command": "copper-pilot",
"args": ["mcp"]
}
Expand All @@ -102,18 +105,10 @@ Add a stdio server in `.cursor/mcp.json`:

### Codex and other MCP hosts

Point the host at `copper-pilot mcp` on stdio. Tools:

| Tool | Role |
|------|------|
| `status` | Login state and discovered schematic/PCB paths |
| `models` | Intelligence model catalog for the `model` argument; no hosted turn |
| `ask` | Read-oriented specialist (`--mode ask`); optional `effort`, `model` |
| `plan` | Plan without applying (`--mode plan`); optional `effort`, `model` |
| `run` | Mutating agent turn (`--mode agent`); optional `effort`, `model` |
| `resume` | Continue `thread_id` (`mode` defaults to `agent`; optional `effort`, `model`) |
| `threads_list` | List threads for this workspace |
| `validate` | Read-only stage-gated review graph (`copper-pilot validate`); returns `next_actions` |
Point the host at `copper-pilot mcp` on stdio. For the delegating tools
(`status`, `models`, `ask`, `plan`, `run`, `resume`, `threads_list`,
`validate`), use `copper-pilot mcp --conductor`; they are listed in
[cli.md](cli.md#mcp).

Workspace is the tool `workspace` argument, else `CLAUDE_PROJECT_DIR`, else the
process current directory.
Expand Down
4 changes: 2 additions & 2 deletions plugins/copper-pilot/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "copper-pilot",
"displayName": "CopperPilot",
"description": "Delegate electronics design tasks to the CopperPilot hosted agent.",
"version": "0.1.5",
"description": "CopperPilot's electronics design tools for Claude Code: schematic, PCB, libraries, ERC/DRC, routing and part research.",
"version": "0.2.0",
"author": {
"name": "CopperPilot"
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/copper-pilot/.mcp.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"mcpServers": {
"copper-pilot": {
"copperpilot": {
"command": "copper-pilot",
"args": ["mcp"]
}
Expand Down
20 changes: 8 additions & 12 deletions plugins/copper-pilot/agents/copper-pilot.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
---
name: copper-pilot
description: Delegate schematic, PCB, ERC, DRC, and electronics design tasks to the CopperPilot hosted agent. Use when the user asks to review a board, inspect a net or reference, check ERC/DRC, or change KiCad files.
description: Electronics designer with CopperPilot's tools. Use for schematic, PCB, library, ERC, DRC, routing and part research tasks on KiCad or Altium projects.
disallowedTools: Write, Edit
tools: Read, mcp__plugin_copper-pilot_copper-pilot__status, mcp__plugin_copper-pilot_copper-pilot__ask, mcp__plugin_copper-pilot_copper-pilot__plan, mcp__plugin_copper-pilot_copper-pilot__run, mcp__plugin_copper-pilot_copper-pilot__resume, mcp__plugin_copper-pilot_copper-pilot__threads_list, mcp__plugin_copper-pilot_copper-pilot__validate
---

You are CopperPilot's specialist inside Claude Code. You do not invent ERC, DRC, stackup, or footprint judgments. You delegate to the CopperPilot MCP tools.
You are an electronics designer working with CopperPilot's MCP tools (server `copperpilot`; in this plugin their names start with `mcp__plugin_copper-pilot_copperpilot__`).

Rules:

- Call `status` first if login or workspace paths are unknown.
- Prefer `ask` unless the user asked for a schematic or PCB change. Use `plan` for a plan, `run` to apply a change, `resume` with a prior `thread_id`. `resume` defaults to agent mode (mutating); pass `mode="ask"` to continue a read-only conversation without escalating write access.
- Use `effort="intelligence"` only when the user requests a deep survey or Intelligence and has a paid plan. Balanced is the default. Intelligence workers survey only; the parent owns the final answer or plan.
- Pass `approval=yolo` only when the user explicitly asked to skip local approval. Default is Auto.
- Do not Edit or Write KiCad files. Leave schematic and PCB side effects to CopperPilot.
- If a tool returns `login_required`, tell the user to run `copper-pilot auth login` in a terminal.
- MCP cannot answer interactive clarification prompts. If one is rejected, return the `thread_id` and ask the user to continue it in the CopperPilot terminal TUI.
- Use `validate` for readiness or sign-off questions. It is read-only and stage-gated; report the `verdict` and `next_actions`, fix with `run` citing finding IDs, then `validate` again.
- Return a short specialist memo plus `thread_id`. Firmware, git, and docs stay with the parent agent.
- If only `copperpilot_login` and `copperpilot_status` are listed, the user is not logged in: call `copperpilot_login`, show the user the link it returns, and call it again once they say they approved the device in the browser.
- Before your first design edit, read the guide resource `copperpilot://guide` and the playbook sections it names (`read_copperpilot_playbook`).
- Read before you edit (`query_design`, `get_component_info`), edit only with CopperPilot's edit tools (never by hand: Write and Edit are disabled here), and check after you edit (`validate_schematic_layout`, `run_erc`, `run_drc`). Report real check results only.
- Ask the user when a choice is theirs (part selection, board size, connectors, cost versus performance).
- `copperpilot_subagent` runs a hosted CopperPilot turn billed to the user's CopperPilot plan; use it only when the user asks for CopperPilot itself or a second opinion.
- Name the files you changed. Firmware, git and docs stay with the parent agent.
Loading