# MCP server (/docs/native/cli/mcp)

```bash
delacour mcp
```

An MCP server over stdio, exposing the same functions the commands call. Ask an agent for "a
button" without it and you get plausible JSX — the right shape, and none of the parts that matter
here: the icon that inherits its size from the button's context, the spinner that *replaces* the
icon so the label does not shift, the `expo install` route for the native modules underneath.

With it, the agent reads the real component and copies it.

## Wiring it up [#wiring-it-up]

`npx` is shown; `pnpm dlx`, `yarn dlx` and `bunx` run the same command. In the JSON configs, pnpm is `"command": "pnpm"` with `"args": ["dlx", "delacour@latest", "mcp"]`.

<Tabs items={["Claude Code", "Cursor", "Any MCP client"]}>
<Tab value="Claude Code">

```bash
claude mcp add delacour -- npx delacour@latest mcp
```

</Tab>
<Tab value="Cursor">

```json title=".cursor/mcp.json"
{
  "mcpServers": {
    "delacour": {
      "command": "npx",
      "args": ["delacour@latest", "mcp"]
    }
  }
}
```

</Tab>
<Tab value="Any MCP client">

```json
{
  "command": "npx",
  "args": ["delacour@latest", "mcp", "--cwd", "/path/to/your/app"]
}
```

`--cwd` decides which `native-components.json` applies. Omit it when the client already runs the server
from your project root.

</Tab>
</Tabs>

`--registry` and `--ref` work here too, so an agent can be pointed at a fork or pinned to a
version.

## The tools [#the-tools]

<TypeTable
  type={{
    list_components: {
      type: "() => string",
      description: "Every component and utility, with what each is for. The agent should call this before writing any React Native UI.",
    },
    get_component: {
      type: "(name) => string",
      description: "One item in full: its source files, what it copies in, what it installs, and its design notes.",
    },
    add_components: {
      type: "(names, overwrite?, install?) => string",
      description: "Copies components in, with rewritten imports, and reports the packages they need. Sets the project up first if it has no native-components.json. install defaults to false — the reply carries the exact commands, so the agent decides.",
    },
    check_updates: {
      type: "(names?) => string",
      description: "Compares the copied components with the registry and writes nothing: which files the registry changed, which the project edited, which would conflict.",
    },
    update_components: {
      type: "(names?, force?, prune?, tests?, install?) => string",
      description: "Brings copied components up to the registry. Replaces untouched files, three-way merges edited ones, and writes git conflict markers where both changed the same lines. Never discards an edit. Leaves an older native-components.json unchanged and names each option it predates with the parameter that answers it, so the agent asks the person.",
    },
    init_project: {
      type: "(src?, packageName?, packagePath?, force?, install?) => string",
      description: "Sets the project up deliberately — a shared package in a monorepo, or a source directory that is not src. Not needed for a plain app; add_components handles that on its own.",
    },
    check_project: {
      type: "() => string",
      description: "Runs the doctor checks and reports each with its fix.",
    },
  }}
/>

`add_components` is the one to reach for. It writes `native-components.json`, wires Metro and the
Tailwind globs and copies the theme in before it copies the component, so it works against a bare
`create-expo-app`. `init_project` exists for the case a default cannot infer: components belonging
to a package several apps share, or a source directory this project spells differently.

<Callout type="warn" title="Two things no tool can do for you">
Importing the CSS entry as the **first statement** of the root layout, and wrapping the app in
`<DelacourProvider>`. Both are edits to a file the user owns, and both fail silently — unstyled
components, and presses that never land. `init_project` names them in its reply and `check_project`
catches them afterwards.
</Callout>

`add_components` installs nothing unless asked. Its reply names what it copied and, when something
is missing, the commands that would install it:

```txt
Added button, icon, pressable, spinner, text, … — 43 files.
Not installed. These have to be run from the app before it will build:
  npx expo install react-native-gesture-handler react-native-reanimated react-native-svg uniwind
  npm install cn tailwind-variants tailwindcss
Re-run this tool with install: true to have them run for you.
A native module changed — rebuild the dev client; a JS reload will not pick it up.
```

Running someone's package manager unprompted is not the sort of thing to do on an agent's behalf by
default, and the agent cannot see the CLI's own output — the server's stdout is a JSON-RPC stream,
so `add` runs silent and this reply is the only place the information exists.

`check_project` is the one worth pointing an agent at explicitly. When a component renders
unstyled or a press does nothing, there is no error message to read — the agent will otherwise
start rewriting working code. Those failures are
[configuration](/docs/native/cli/troubleshooting), and this names them.

## Copying beats generating [#copying-beats-generating]

`get_component` returns the component's `AGENTS.md` alongside its source, rewritten to cite your
own import paths. That document is where the reasoning lives — why `isLoading` swaps the icon
rather than joining it, why a `View` cannot cascade colour to a `Text`, why the separator stretches
instead of taking a percentage width.

An agent that has read it edits the component correctly. An agent that has not writes something
that renders and is subtly wrong.

<Callout title="The same prose ships with the files">
`add` writes each component's `AGENTS.md` next to its source, so the notes are in your repository
whether or not the MCP server is running. That is a real advantage of owning the code: the design
rules travel with it.
</Callout>

## Without MCP [#without-mcp]

Every tool has a command behind it, so an agent with shell access needs nothing installed:

```bash
delacour list --json
delacour view button --json
delacour add button --yes     # sets the project up first, if it has to
delacour doctor --json
```

See also [`llms.txt`](/docs/native/getting-started/llms) for handing an agent the whole library as
context, and [Agents](/docs/native/getting-started/agents) for the conventions it should follow
when editing these components.
