# Connect Claude Code

> Draft for `/docs/connect/claude-code`. Commands checked on 2026-11-22 against <https://code.claude.com/docs/en/mcp>, <https://code.claude.com/docs/en/hooks> and <https://code.claude.com/docs/en/plugins/host-marketplace.md>; the plugin hook was tried with Claude Code 2.1.330.

## Install the plugin (recommended)

The nauvid plugin bundles the MCP server, the nauvid skill (how to make designs and work through comments) and a prompt hook that tells Claude when someone `@Claude`s it, or mentions you, in a nauvid comment.

```
claude plugin marketplace add https://nauvid.com/claude/marketplace.json
claude plugin install nauvid@nauvid
```

Inside a session the same works as `/plugin marketplace add https://nauvid.com/claude/marketplace.json`, then `/plugin install nauvid@nauvid`. Then run `/mcp`, choose `plugin:nauvid:nauvid` and sign in as below. If you added nauvid before with `claude mcp add`, remove that entry (`claude mcp remove nauvid`) so the tools are not listed twice.

Updates: `claude plugin update nauvid@nauvid`, or turn on auto-update for the `nauvid` marketplace under **Marketplaces** in `/plugin`.

### Hear about @mentions

With the plugin, each prompt you send in Claude Code (any project) first asks nauvid for open comment threads where `@Claude` or you are mentioned and nobody has answered yet. When there are none, nothing is added. When there are, Claude sees one short block before your prompt: how many, and each thread's id, design id, time and link. Never the comment text: Claude reads that with `list_comments`, where it arrives fenced as reviewer data. Claude then offers to handle them, or handles them if that is what you are doing.

The hook also runs after `/clear` and after a compaction. It does not run while Claude Code starts (MCP servers are not connected yet); your first prompt covers that. It needs the OAuth sign-in above; with a service key only, use `pending_mentions` or the `open_mentions` count on `whoami`, `list_designs` and `get_design` instead (see [The review loop](review-loop.md)).

**Only some teams in this repo.** If you are in several teams and work on one team's designs in a project, ask Claude: "in this repo, only remind me about mentions in <team>" (or "no mention reminders in this repo"). It calls `set_mention_scope` with the project directory; from then on the hook in that directory lists only those teams (or nothing). Other directories keep every team. Ask again with no teams to undo it. The scope only changes the reminders; Claude can still open any design you point it at.

Without the plugin, `whoami`, `list_designs` and `get_design` still carry an `open_mentions` count when something is waiting, so Claude learns of mentions the next time it opens nauvid.

## Without the plugin

### Sign in as you (OAuth)

1. Add the server:

   ```
   claude mcp add --transport http nauvid https://nauvid.com/mcp
   ```

2. In Claude Code, run `/mcp`, choose `nauvid` and follow the steps in your browser: continue with Google, check the app name and host on nauvid's consent page, then choose **Allow**. From a shell, `claude mcp login nauvid` does the same.
3. Ask "Who am I in nauvid?". Claude Code calls `whoami` and answers with your name and the client name.

Claude Code stores the token and refreshes it. To disconnect, run `claude mcp logout nauvid`, or revoke the agent in nauvid under Settings → Account.

#### Share the server with a repository

`--scope project` writes the server to `.mcp.json` in the project root, so everyone who opens the repository gets it. Each person still signs in with their own Google account.

```json
{
  "mcpServers": {
    "nauvid": { "type": "http", "url": "https://nauvid.com/mcp" }
  }
}
```

`--scope user` makes it available in all your projects. The default scope is `local`: only you, only this project.

## Headless (service key)

For `claude -p`, scheduled jobs and CI, where nobody can click through a browser. Create a key first: see [Service keys](service-keys.md).

```
claude mcp add --transport http nauvid https://nauvid.com/mcp \
  --header "Authorization: Bearer $NAUVID_KEY"
```

Or in `.mcp.json`, where `${NAUVID_KEY}` is read from the environment:

```json
{
  "mcpServers": {
    "nauvid": {
      "type": "http",
      "url": "https://nauvid.com/mcp",
      "headers": { "Authorization": "Bearer ${NAUVID_KEY}" }
    }
  }
}
```

Never put the key itself in a file that is committed.

## Troubleshooting

| What you see | Cause and fix |
| --- | --- |
| `401` after it worked before | The token expired and could not be refreshed, or the agent was revoked. Run `/mcp` and sign in again. |
| Tools list is empty | The sign-in was not finished. Run `/mcp` and complete it. |
| `not_found` for a design you can see in the browser | You signed in to nauvid with a different Google account than in the browser. Ask `whoami`. |
| A service key gets `401` | The key was revoked, or the person who created it left the team. Create a new key. |
