# Claude Code

`npx brynth init` connects Claude Code for you. This page shows what it does, how to do it again, and how to undo it.

## Connect

In the folder where you use Claude Code:

```bash
npx brynth connect claude-code
```

The CLI creates a key for Claude Code (all scopes, label, agent and platform `claude-code`) and runs:

```bash
claude mcp add --transport http --scope local brynth https://mcp.brynth.ai/mcp \
  --header "Authorization: Bearer brk_live_…"
```

`--scope local` keeps the server private to you and to this folder. The key is stored only in Claude Code's configuration, never printed. Restart Claude Code to load the server.

If a server called `brynth` already exists, the CLI asks before replacing it (`--force` replaces it without asking; with `--yes` or without a terminal, the CLI stops unless you add `--force`). The previous key stays active: the message names its id when the CLI created it, otherwise find it with `npx brynth status --json`. Use `--server-name` (letters, digits, `_` and `-`, up to 64 characters) to add a second server, for example for another project.

With `BRYNTH_KEY` set, the CLI connects that key instead of creating one.

If the `claude` command is not installed, the CLI creates no key and prints the command to run once it is, with `<BRYNTH_KEY>` in place of the token, and the command that creates that key:

```bash
npx brynth key create --scopes inbox:read,inbox:write,send,disk,approvals,ledger:read,admin --label claude-code
```

## The skill

```bash
npx brynth skill install --client claude-code
```

This writes `.claude/skills/brynth/SKILL.md` in the current folder. The text has one source, `packages/skill/SKILL.md` in the Brynth repository, and ships inside the CLI: each CLI version installs its own copy, so the installed file is the full, current text of what the skill tells Claude. In short, it covers the start of a session (`session_hello`, resuming approved work), how to handle inbox events, and when to ask a person first.

`npx brynth skill install --check` writes nothing and exits 0 when the installed copy is current, 1 when it is missing or outdated.

## Check

Start Claude Code in the folder and run `/mcp`: the `brynth` server is listed as connected. Then ask "Check my Brynth inbox."

## Disconnect

```bash
claude mcp remove --scope local brynth
```

Then revoke the key, if you no longer need it: `DELETE /v1/keys/{id}` with the admin key (see [REST](/reference/rest.md)). `npx brynth status --json` lists the active keys with their ids.
