# Claude Code

> Register the hosted dFlow MCP server in Claude Code over HTTP.

Web page: /docs/mcp/claude-code/

Claude Code can use the same hosted MCP URL as the dashboard. OAuth runs when the CLI connects unless you pass a bearer header.

## MCP URL

```
https://k8s.dflow.sh/mcp
```

## Steps

1. **Copy the URL** (dashboard **Agents** or above).
2. Run **Connect** by registering the server (command matches the dashboard **Connect MCP** card):

```bash
claude mcp add --transport http dflow https://k8s.dflow.sh/mcp
```

3. When Claude Code calls the server, complete **OAuth sign-in** and consent in the browser.
4. Pick a **workspace** on consent. Leave **Deploy** unchecked unless this machine should deploy; **Deploy is off by default**.
5. You are **done** when MCP tools respond.

For a workspace token instead of OAuth, add `--header "Authorization: Bearer <secret>"` and skip browser consent (see [MCP overview](/docs/mcp)).

## Turn Deploy on later

Revoke the grant on the dashboard, remove the server (`claude mcp remove dflow` if needed), run the add command again, and enable **Deploy** on consent.

## Troubleshooting

| Symptom | What to do |
| --- | --- |
| **401** | Re-run OAuth or refresh the grant; revoke stale connections on the dashboard. |
| **Scope error** | Reconnect with **Deploy** on consent. |
| Command not found | Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and ensure `claude` is on your `PATH`. |
