> ## Documentation Index
> Fetch the complete documentation index at: https://docs.docdiagram.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Install the DocDiagram plugin and authenticate in two commands.

<Frame caption="Install, authenticate once, then generate">
  <img src="https://mintcdn.com/docdiagram/sY1JQuLzhra0Zjci/images/diagrams/cc-setup-flow-light.svg?fit=max&auto=format&n=sY1JQuLzhra0Zjci&q=85&s=45f0c7fd60768364f8c78b058fb6d4d9" alt="Three steps: install the plugin, run docdiagram auth, generate your first diagram" className="block dark:hidden" width="616" height="220" data-path="images/diagrams/cc-setup-flow-light.svg" />

  <img src="https://mintcdn.com/docdiagram/sY1JQuLzhra0Zjci/images/diagrams/cc-setup-flow-dark.svg?fit=max&auto=format&n=sY1JQuLzhra0Zjci&q=85&s=b3b4111a4e14c559e57e408d164a9dfd" alt="Three steps: install the plugin, run docdiagram auth, generate your first diagram" className="hidden dark:block" width="616" height="220" data-path="images/diagrams/cc-setup-flow-dark.svg" />
</Frame>

You need [Claude Code](https://claude.com/claude-code) installed. Everything below runs from your terminal.

## 1. Add the marketplace and install

The plugin bundles the MCP server, so one install gives you both the slash commands and the `docdiagram` MCP tools.

```bash theme={null}
claude plugin marketplace add docdiagram/agents
claude plugin install docdiagram@docdiagram
```

On install, Claude Code asks once to approve the bundled `docdiagram` MCP server, the same per-server approval as any project's `.mcp.json`. Approve it and the server starts automatically in every session.

<Warning>
  `claude plugin install <git-url>` does not work. Install resolves plugin names from added marketplaces, not raw URLs. Run the two commands above in order.
</Warning>

## 2. Authenticate

Start a session and run the auth skill:

```
claude
> /docdiagram:auth
```

This opens `https://app.docdiagram.com/settings/api-keys?cc=true` in your browser. Click **Generate code**, copy the 16-character code, and paste it back when Claude prompts you.

The plugin writes the API key to `~/.docdiagram/config.yaml` (readable only by you). The skills and the bundled MCP server both read this one file, so you authenticate once.

<Note>
  No API key set up yet? The auth flow mints one for you. You do not need to visit the dashboard first.
</Note>

## 3. Generate your first diagram

```
> /docdiagram:diagram a sequence diagram of an OAuth refresh
```

This saves an image to your current folder and prints the path. See [Standalone diagrams](/claude-code/standalone-diagrams) for the full walkthrough.

## Other MCP clients

Not using Claude Code? Skip the plugin and run the MCP server straight from PyPI:

```bash theme={null}
uvx docdiagram-mcp
```

Point your client (Cursor, Continue, Cody, or any MCP-aware tool) at that command. Authenticate the same way, by running `/docdiagram:auth` once to write the shared config, or by setting `DOCDIAGRAM_API_KEY` in your client's MCP environment.

| Variable             | Default                             | Purpose                          |
| -------------------- | ----------------------------------- | -------------------------------- |
| `DOCDIAGRAM_API_KEY` | read from `config.yaml`             | Override the config-file key.    |
| `DOCDIAGRAM_API_URL` | `https://app.docdiagram.com/api/v1` | Override for self-hosted or dev. |

## Sign out

To remove your stored credentials, run `/docdiagram:logout`. It deletes `~/.docdiagram/config.yaml`.

## Next

<CardGroup cols={2}>
  <Card title="Standalone diagrams" icon="image" href="/claude-code/standalone-diagrams">
    Prompt to image, no repo needed.
  </Card>

  <Card title="Embedded diagrams" icon="file-code" href="/claude-code/embedded-diagrams">
    Diagrams that live in your docs repo.
  </Card>
</CardGroup>
