# Agent self-setup

> Numbered steps an AI agent can follow to connect itself to dFlow MCP.

Web page: /docs/mcp/agent-setup/

An autonomous agent can connect to the hosted MCP server without a pasted workspace token. These steps assume a human can complete browser OAuth once.

## MCP URL

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

## Steps

1. Copy the MCP URL `https://k8s.dflow.sh/mcp` and keep it for the client you are configuring.
2. Open the dFlow dashboard **Agents** page and use **Connect MCP** to pick the same client you run in (Cursor deeplink, Claude connectors link, ChatGPT steps, or the Claude Code / Codex commands shown there).
3. Register only the URL in MCP config. Do not put a bearer token in the install payload for OAuth clients (Cursor must not receive token headers in the deeplink config).
4. Trigger a connection or first MCP tool call so the runtime starts **OAuth Connect**.
5. Ask the human to **sign in** to dFlow in the browser and approve the connection.
6. On consent, have the human select the correct **workspace** and scopes. Default to **Read** and **Stage** only; do not request **Deploy** unless the human explicitly wants cluster writes.
7. Confirm success with a read-only MCP call (`whoami` or `list_projects`). Stop if you see **401** (reconnect or revoked grant) or a message that the connection **can stage but not deploy** (reconnect with Deploy on consent).
8. Report which workspace id is active and which scopes were granted. Do not log refresh tokens or access tokens.

## Client commands (must match the dashboard)

| Client | Register |
| --- | --- |
| Claude Code | `claude mcp add --transport http dflow https://k8s.dflow.sh/mcp` |
| Codex | `codex mcp add dflow --url https://k8s.dflow.sh/mcp` then `codex mcp login dflow` |
| Cursor | Install `{ "url": "https://k8s.dflow.sh/mcp" }` via dashboard **Add to Cursor** or equivalent user MCP config |
| Claude (web) | Paste URL at [claude.ai/settings/connectors](https://claude.ai/settings/connectors) |
| ChatGPT | Settings → Apps & Connectors → Developer mode → create connector with the URL |

## After setup

Deploy is **off by default**. To deploy or apply through MCP, the human must reconnect and tick **Deploy** on consent. List or revoke grants from the dashboard or with `oauth_grants_list` / `oauth_grants_delete`.
