---
title: MCP server
description: The tools Dex's MCP server gives agents, and their arguments.
---

```sh
claude mcp add dex -- npx --package=@dexhq/canvas dex mcp
```

Runs over stdio. Options: `--agent "<name>"` names the agent's messages (default from the client: Claude, Codex, Cursor, else Agent); `--root <folder>` sets the studio folder, which `create` writes to `.mcp.json`.

Started by `dex claude`, the server is also a Claude Code [channel](https://code.claude.com/docs/en/channels): it pushes each new comment, request and answer for the agent into the session as a `<channel source="dex" thread_ids="…" prototypes="slug,…">` event, grouped by file and view, so the agent needs no `watch` loop. Claude Code does not say whether an event arrived, so the session's first event only names its threads, with a word to take them with (`watch`, `ids` and `receipt`); once that word has come back, each thread is claimed (👀) before it is pushed. A session that never sends it back keeps no thread, and is told to give you the loop below.

A file is named by its folder's name, its slug, such as `"f-3k7q9x2m"`, for its folder `files/<slug>/`. An old name, `"owner/slug"`, still finds a file that was moved from `prototypes/<owner>/<slug>/`. The argument that names one is still called `prototype`, and the tool that reads one is still `prototype`, so agents set up before keep working.

## Tools

| Tool | Does | Arguments |
| --- | --- | --- |
| `brief` | A short read of what there is and where it is on disk: the open file and the folder the agent may write in, the one rule that always holds, the guidelines people wrote (in full while short), what views may import, and, each by its path, the file's spec and its sections' specs, the context files and Dex's rules and methods. No work needs it first. | `load`: paths of methods or rules to get in full, alone |
| `components` | Searches the design system's components, best fit first, each with its import; with `name`, one in full: import, props, an example, notes and its guide. With neither, every component, by name alone when they are too many to describe each. | `query`; `name` |
| `prototype` | One file, by default the open one: where it is, its file spec (each spec by its path, with its words while they are short), views, frames, picks, open threads, and `removedViews`: views no canvas shows any more, with where they last were. A small file comes whole; for a large one each list stops, and `leftOut` says how many more there are and which files hold them (each person's `canvas.json`, `views/` and `annotations.json`). | `prototype` |
| `decide` | Records a decision as a `> [!DECISION]` callout at the end of a spec: the section's spec with `flow`, else the file spec. | `prototype`, `decision`; `flow` |
| `where` | Where the person is in Dex: the file they have open, the page of it (the canvas, Play, a view on its own page, or the file's page), the sections of the canvas in view, the frame selected, and how long ago Dex last said so; or that nobody has Dex open. | None |
| `threads` | Threads with target, source file, element and messages, and the path of the spec of the section each is on. Those on the page the person has open come first, each with `onOpenPage`, then the rest of the open file, then other files. A long list comes shortened, and says so: long messages cut, then threads given short, then a line after the list with how many there are and how to get the rest. With `id`, one thread with more of it, and all of it in a file when it is long. | `prototype`; `status`: `unfinished` (default: waiting or acknowledged, each acknowledged one with who holds it and since when), `waiting`, `open`, `acknowledged`, `resolved`, `dismissed`, `all`; `id`: one thread; `offset`: leave out this many from the start; `limit`: at most this many |
| `watch` | Takes waiting threads, waiting for them if needed, in groups: one view's threads (or views sharing files), one request for a new view, or the whole file, each with the files it may change. Opens with `split` when the groups can run side by side, one sub-agent each. Takes as many groups as it has room to describe, and leaves the rest waiting for the next call. Keeps waiting while the studio's Watch switch is off; on timeout, no groups, with a note if Watch is off. | `prototype`; `timeout_seconds` 1 to 1800 (300); `groups`: take at most this many; `ids`: take these threads now; `receipt`: the word a channel event gave |
| `comment` | Starts a thread. | Below |
| `close` | Closes threads, several at once: ✅ with what changed, or 🚫 with why. | `threads`: `{ id, summary }` or `{ id, dismiss }` each |
| `reply` | A message: a question, or an answer when someone @mentions the agent. | `id`, `message`, `ask` |
| `place_frame` | Puts views you built on a file's canvas, several at once, each in a request's cell or a cell you name. | `prototype`, `frames`: `{ view }` with `thread`, or `section`, `row` and `step` |
| `snapshot` | A snapshot of one view from the running Dex, to check your work, with errors on the page and overflow in `problems` (`dex snapshot` takes every frame's the same way). | `prototype`, `view`; `params` (a state), `viewport`, `scheme` |
| `feedback` | Feedback about Dex itself, when your person asks to send some. The first call sends nothing and returns the draft, with what Dex adds (its version, Node's, the system, the agent's client); only a second call with `confirmed: true`, once the person has read the draft and said yes, sends it, and it says sent only once Dex's team has it. | `kind`, `message`; `title`, `files` (paths, up to 3, 4 MB in all), `email`, `confirmed` |

- `waiting` means for the agent, open, and a person spoke last. Replies show as waiting for a person until they answer.
- A target with `kind: "view"` is a request: build the view and put it on the canvas with `place_frame`.
- Every response has a budget of a few thousand characters, whatever the project's size. One that would go over gives the most useful part, says what it left out and how to get it: a thread by its `id`, the next ones with `offset`, a narrower filter, or a file to open.
- Threads `watch` returns are yours (👀). Close each with `close` when its change is made, or it keeps its 👀.

## `comment`

| Argument | Notes |
| --- | --- |
| `prototype`, `message` | Required. |
| `for` | `people` (default) or `agent`. |
| `frame` | `"section/row/frame"` from `canvas.json`. |
| `view` or `doc` | Instead of `frame`: the first frame showing it. |
| `selector` | Pins to an element, such as `[data-slot="card"]:nth-of-type(2) h3`. |
| `text` | Start of the element's text. |

No frame, view or doc targets the file; no selector targets the whole frame. Without MCP, use the `threads` and `thread` [commands](/docs/cli).
