# Claude Code CLI

> Use Figgshield from the Claude Code CLI: claude mcp add plus claude mcp login (loopback PKCE), or the personal API-key header alternative, then generate by prompting.

The Claude Code CLI talks to Figgshield over the same [MCP endpoint](https://figgshield.ai/documentation/mcp.md) as the Claude connector. You add the server once, sign in, then ask Claude Code to generate — it calls Figgshield's tools for you.

## Add the server

```bash
claude mcp add --transport http figgshield https://api.figgshield.ai/mcp
```

This registers a server named `figgshield` on the HTTP transport. Confirm it is listed:

```bash
claude mcp list
```

## Sign in (browser OAuth)

```bash
claude mcp login figgshield
```

`claude mcp login` runs an **authorization-code + PKCE** flow over a loopback redirect: it opens your browser, you sign in with Google, Apple or GitHub and approve the `figgshield:read` and `figgshield:write` scopes, and the CLI stores the token. Tokens refresh automatically, so this is a one-time step. To sign out:

```bash
claude mcp logout figgshield
```

## API-key alternative

Instead of the browser flow you can authenticate with a **personal API key**. Create one in the app under **Account → API keys** (it looks like `figg_` followed by 40 hex characters, shown once) and pass it as an `Authorization` header when adding the server:

```bash
claude mcp add --transport http figgshield https://api.figgshield.ai/mcp \
  --header "Authorization: Bearer figg_your_api_key_here"
```

With the header set there is no `claude mcp login` step — every request carries the key. Keys can be named, rotated and revoked independently in the account screen; see [Authentication](https://figgshield.ai/documentation/authentication.md).

## Generate

Once the server is added and authenticated, prompt Claude Code as usual:

```text
Generate a 5-second video of a quiet harbour at dawn.
Create a 4K image of a paper boat on a still pond.
List my recent Figgshield generations.
```

Claude Code calls `generate_video` (Kling) or `generate_image` (Nano Banana 2), polls `get_generation` for longer jobs, and gives you the `output_url` to download. The [MCP tools reference](https://figgshield.ai/documentation/mcp.md) lists every tool and its parameters.

## Skills

A Claude skill that uses Figgshield inherits the host's authentication — if Claude Code is signed in to the `figgshield` server (via OAuth or an API-key header), the skill can call the tools without any extra setup.

## Troubleshooting

| Symptom | Fix |
| --- | --- |
| `401` / repeated sign-in prompts | Run `claude mcp login figgshield` again, or check the API-key header is a current, unrevoked key. |
| `subscription_required` tool error | The account has no active plan — subscribe in the app, then retry. |
| `insufficient_credits` tool error | Top up or enable [auto top-up](https://figgshield.ai/documentation/billing.md); the next monthly grant also refills the balance. |
| Server not found | Re-check the transport and URL: `claude mcp add --transport http figgshield https://api.figgshield.ai/mcp`. |
