> ## Documentation Index
> Fetch the complete documentation index at: https://docs.buildwithtrace.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

> Expose Trace as a Model Context Protocol server so Cursor, Claude Desktop, or any MCP client can read your designs, run checks, and generate parts.

Trace speaks [Model Context Protocol](https://modelcontextprotocol.io) two ways, so any MCP-compatible AI client (Cursor, Claude Desktop, and others) can use Trace's EDA capabilities as tools:

* **Hosted MCP (remote, one-click)** — connect to `https://mcp.buildwithtrace.com/mcp` and sign in with OAuth. Nothing to install. Best for asking questions, running checks, searching parts, and generating symbols/footprints.
* **Local MCP (stdio)** — run `buildwithtrace mcp serve` on your machine, scoped to a project directory. Best when the AI needs to read your local design files.

## Hosted MCP (remote) — recommended

The fastest way to connect: point your client at the hosted endpoint and authenticate in the browser. No CLI, no Python, no local process.

```
https://mcp.buildwithtrace.com/mcp
```

In **Cursor**, add it as a remote MCP server (Settings → MCP → *Add new MCP server*, or use the one-click "Add MCP" buttons in these docs). On first use, Cursor opens a browser popup to sign in to your Trace account (OAuth 2.1 with PKCE) — once you authorize, the connection is saved and Trace's tools appear in your tool list. Any MCP client that supports remote servers + OAuth works the same way.

```json theme={null}
{
  "mcpServers": {
    "trace": {
      "url": "https://mcp.buildwithtrace.com/mcp"
    }
  }
}
```

<Info>
  Hosted MCP requires a Trace account (free tier available) and authorizes via your browser — there's no token to copy or paste. It exposes the chat-backed tools (ERC/DRC, design review, ask, part search, symbol/footprint generation, DFM). To give the AI access to your **local design files**, use the local stdio server below.
</Info>

## Local MCP (stdio)

The Trace CLI also ships an MCP server you run yourself, scoped to a project on your machine.

<Info>
  The local MCP server requires you to be authenticated (`buildwithtrace auth login`) because most tools call the Trace backend. It runs over **stdio** and is meant to be launched by your MCP client, not run by hand.
</Info>

## One-step setup: the Trace agent plugin

The fastest way to give a coding agent (Cursor, Claude, Codex) deep Trace knowledge **and** wire up the MCP server is the Trace plugin:

```bash theme={null}
npx plugins add buildwithtrace/trace-plugin
```

It installs a set of **skills** that teach your agent about Trace — platform overview, schematic design, PCB layout, component search, symbol/footprint generation, design review, manufacturing, the `buildwithtrace` CLI, file formats (`.kicad_sch`/`.kicad_pcb`), signal tracing, and the MCP tools — and connects your editor to the MCP server described below.

Requirements: the `buildwithtrace` CLI (`pip install buildwithtrace`) and a Trace account (free tier available).

<Tip>
  Prefer just the raw MCP tools without the skills? Skip the plugin and use the manual configuration below.
</Tip>

## Start the server

```bash theme={null}
buildwithtrace mcp serve --project /path/to/board
```

| Option                  | Description                             |
| ----------------------- | --------------------------------------- |
| `--project`, `-p <dir>` | Scope the server to a project directory |

## Available tools

List the tools the server exposes:

```bash theme={null}
buildwithtrace mcp tools
```

The server registers 12 tools:

| Tool                 | Purpose                                                               |
| -------------------- | --------------------------------------------------------------------- |
| `get_project_info`   | Project metadata and file overview                                    |
| `list_project_files` | Enumerate design files in the project                                 |
| `read_schematic`     | Read schematic contents                                               |
| `search_in_files`    | Search across project files                                           |
| `get_erc_violations` | Run/return Electrical Rule Check results                              |
| `get_drc_violations` | Run/return Design Rule Check results                                  |
| `review_design`      | AI design review                                                      |
| `ask_question`       | Ask a question about the design                                       |
| `search_parts`       | Component search via distributors (Nexar aggregates DigiKey + Mouser) |
| `generate_symbol`    | Generate a KiCad symbol                                               |
| `generate_footprint` | Generate a KiCad footprint                                            |
| `check_dfm`          | Design-for-manufacturing checks                                       |

## Prompt templates

The server also registers 4 reusable prompts your MCP client can surface as one-click workflows:

| Prompt                     | What it kicks off                            |
| -------------------------- | -------------------------------------------- |
| `review_design_prompt`     | Full design review (DFM, SI, thermal, power) |
| `select_components_prompt` | Component selection with availability + cost |
| `check_before_fab_prompt`  | Pre-fab gate: ERC, DRC, BOM validation, DFM  |
| `optimize_layout_prompt`   | Placement/routing improvement suggestions    |

## Connect from Cursor

Add Trace to your MCP configuration (`~/.cursor/mcp.json` or the project's `.cursor/mcp.json`):

```json theme={null}
{
  "mcpServers": {
    "trace": {
      "command": "buildwithtrace",
      "args": ["mcp", "serve", "--project", "/path/to/board"]
    }
  }
}
```

## Connect from Claude Desktop

Add it to `claude_desktop_config.json`:

```json theme={null}
{
  "mcpServers": {
    "trace": {
      "command": "buildwithtrace",
      "args": ["mcp", "serve", "--project", "/path/to/board"]
    }
  }
}
```

After saving, restart the client. Trace's tools will appear in the client's tool list, and the assistant can read your schematic, run ERC/DRC, search parts, and generate symbols/footprints — all against the scoped project.

<Tip>
  Make sure `buildwithtrace` is on the `PATH` your MCP client sees. If your client launches with a minimal environment, use the absolute path to the `buildwithtrace` binary in `command` (find it with `which buildwithtrace`).
</Tip>

## MCP servers as Trace's plugin system

Trace treats MCP as its plugin model in both directions:

* **Trace as a server** (this page) — other AI clients consume Trace's EDA tools, either via the [`trace-plugin`](#one-step-setup-the-trace-agent-plugin) (skills + MCP) or the manual config above.
* **Trace as a client** — the desktop app and backend can consume external MCP servers to extend what the AI can do.

There's no separate plugin format to learn: if it speaks MCP, it works with Trace.
