# MCP server

@exhaustive-ui/mcp lets coding agents query this documentation and the compiled API instead of guessing.

## Install

[@exhaustive-ui/mcp](https://www.npmjs.com/package/@exhaustive-ui/mcp) is a
[Model Context Protocol](https://modelcontextprotocol.io) server. Your coding tool starts it with npx, over stdio; it needs Node.js 20 or later. The package also
exposes the `exhaustive-ui-mcp` bin when it is installed globally.

```bash
npx -y @exhaustive-ui/mcp
```

`ng add @exhaustive-ui/core` offers to configure it for Claude Code, Cursor, Gemini CLI, Codex and VS Code, and the `ai-config` schematic does the same in a project that already uses ExhaustiveUI: see
[Build with AI](https://exhaustive-ui.com/ai). The sections below are the manual setup.

## Tools

Eight tools, all read-only: the server reads the documentation and never changes your project. Every tool answers with structured content and the same JSON as text, for clients that only forward text.

| Tool | What it does |
| --- | --- |
| `list` | Lists the components, directives, guides, code examples or MCP resources, with paging. |
| `search` | Searches the component docs, the guides, the API members (inputs, outputs, templates, pass-through keys, CSS classes, design tokens) and the code examples. |
| `get_component` | Reads a component: its card (import, tag, key inputs, outputs, every template with its context, one example), selectors, import path, sections and examples, and on request its full API, example code or whole document. Takes up to 10 components at once. |
| `get_example` | Returns one complete code example of a component, a standalone Angular component with its template and imports, by section or feature. |
| `get_guide` | Reads a guide by name or route (installation, configuration, styled mode, Tailwind CSS, accessibility...), whole or one section. |
| `get_setup` | Returns the setup steps for an environment: Angular CLI, configuration, styled or unstyled mode, Tailwind CSS, icons, custom icons, pass-through. |
| `validate_usage` | Checks a template or component source against the compiled API: unknown inputs and outputs, invalid literal values, unsupported two-way bindings, deprecated inputs, inputs removed or renamed in v22, wrong selectors and PrimeNG imports. |
| `version` | Returns the server version, the documented library version, where the docs were read from (live site, cache or offline snapshot) and the registered tools, resources and prompts. |

Component names are resolved loosely: `button`, `p-button`, `Button`, `[pTooltip]`, `@exhaustive-ui/core/select`, a docs URL and the PrimeNG names of renamed components (`dropdown`, `calendar`,
`sidebar`...) all work. The server also exposes the Markdown documents as MCP resources, and prompts for the usual tasks: use a component, build a form, theme a component, migrate from PrimeNG, update to v22 and audit the usage
of a component.

## Claude Code

Add the server for all your projects:

```bash
claude mcp add exhaustive-ui -s user -- npx -y @exhaustive-ui/mcp
```

Or install the plugin, which adds a skill to the server:

```bash
/plugin marketplace add e-xiste/exhaustive-ui
/plugin install exhaustive-ui@exhaustive-ui
```

To set it up for the current project only, which writes `.mcp.json`, leave out the scope:

```bash
claude mcp add exhaustive-ui -- npx -y @exhaustive-ui/mcp
```

## Cursor

Add `.cursor/mcp.json` to a project, or edit `~/.cursor/mcp.json`:

```typescript
{
  "mcpServers": {
    "exhaustive-ui": {
      "command": "npx",
      "args": ["-y", "@exhaustive-ui/mcp"]
    }
  }
}
```

## VS Code

Add `.vscode/mcp.json` to a project, or configure the same server globally. VS Code uses a `servers` key:

```typescript
{
  "servers": {
    "exhaustive-ui": {
      "command": "npx",
      "args": ["-y", "@exhaustive-ui/mcp"]
    }
  }
}
```

## Codex

Add the server with the Codex CLI:

```bash
codex mcp add exhaustive-ui -- npx -y @exhaustive-ui/mcp
```

Or add it to `~/.codex/config.toml`:

```typescript
[mcp_servers.exhaustive-ui]
command = "npx"
args = ["-y", "@exhaustive-ui/mcp"]
```

## Gemini CLI

Add the server to the `mcpServers` of `.gemini/settings.json` in a project, the file the `ai-config` schematic writes for `--tool=gemini-cli`:

```typescript
{
  "mcpServers": {
    "exhaustive-ui": {
      "command": "npx",
      "args": ["-y", "@exhaustive-ui/mcp"]
    }
  }
}
```

## Claude Desktop, Docker and others

Claude Desktop reads the same `mcpServers` entry as Cursor, in `claude_desktop_config.json` (Settings > Developer > Edit Config). Any other client that speaks the Model Context Protocol starts the server with the same
npx command.

The Docker image runs the published package over stdio:

```bash
docker build -t exhaustive-ui-mcp https://github.com/e-xiste/exhaustive-ui.git#main:packages/mcp
docker run -i --rm exhaustive-ui-mcp
```

## Options and check

The server reads the Markdown and JSON files of `/llms/` from this site at runtime and keeps them in memory for 15 minutes, so it follows the deployed documentation without a new release of the package. A snapshot of the same
files is bundled in the package and used when the site cannot be reached. Environment variables change this behavior:

| Variable | Default | Purpose |
| --- | --- | --- |
| `EXHAUSTIVE_UI_DOCS_URL` | `https://exhaustive-ui.com` | Docs site to read from, for instance a local `ng serve` of the docs app. |
| `EXHAUSTIVE_UI_MCP_CACHE_TTL` | `900` | Seconds a fetched document is reused before it is fetched again. |
| `EXHAUSTIVE_UI_MCP_FETCH_TIMEOUT` | `10000` | Milliseconds before a request to the docs site is abandoned. |
| `EXHAUSTIVE_UI_MCP_OFFLINE` | unset | Set to `1` to never contact the site and only use the bundled snapshot. |
| `EXHAUSTIVE_UI_MCP_SNAPSHOT_DIR` | the `data/` directory of the package | Directory of the offline snapshot, a copy of the `/llms/` directory of the site. |

The package also has a `check` command for agents and CI: it validates every template of a project against the API, with file and line, from the bundled snapshot, and exits with 1 when it finds an error.

```bash
npx -y @exhaustive-ui/mcp check            # the templates under src/
npx -y @exhaustive-ui/mcp check apps libs  # other folders or files
npx -y @exhaustive-ui/mcp check --json     # the issues as JSON
```

## Registry

Each release publishes the server to the [official MCP registry](https://registry.modelcontextprotocol.io) as `io.github.e-xiste/exhaustive-ui`, so clients
that browse the registry can install it by name.

