# Coding agents

Coding agents like Claude Code, Codex and opencode can deploy your apps and look after them through Alf's MCP server: create services, deploy, read logs and metrics, roll back, try changes in previews.

## Connect with the browser (recommended)

The agent opens your browser; you approve it and choose the organization, whether it may only look or also deploy, and which projects.

With the [command line](/docs/cli) installed, `alf agents` finds Claude Code, Codex and Cursor on your machine and adds the server to each, asking first. By hand:

**Claude Code**

```bash
claude mcp add --transport http alf https://api.runalf.com/mcp
```

Then run `/mcp` in Claude Code, pick `alf` and **Authenticate**.

**Codex**

```bash
codex mcp add alf --url https://api.runalf.com/mcp
codex mcp login alf
```

**opencode**: in `opencode.json`:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": { "alf": { "type": "remote", "url": "https://api.runalf.com/mcp", "enabled": true } }
}
```

then `opencode mcp auth alf`.

**Other MCP clients** (Cursor, VS Code, Windsurf, …): add a remote (HTTP) MCP server with the address `https://api.runalf.com/mcp`.

Every agent with access, signed in or with a token, is listed under **Agents → Connected agents**, where you can disconnect it.

## Connect with a token

For CI, scripts or clients without sign-in: make a token under **Agents** (choose read or read & deploy, optionally one project, an expiry and [limits](/docs/agent-safety)) and send it as `Authorization: Bearer sat_…`. The Agents page shows the exact setup for each client.

## Tell the agent how you work

Add a few lines to your repository's `AGENTS.md` or `CLAUDE.md`, for example:

```
## Deploying
This app runs on Alf; use its MCP tools (server "alf").
- After pushing, deploy the service that changed and wait_for_deployment until it's live or failed.
- Passwords and keys go in secrets, never in variables or the repository.
- Don't delete anything unless I ask for exactly that; take a snapshot of a volume before changing its data.
```

## What the agent sees

Besides the [tools](/docs/agent-tools), agents can read a guide and a summary of each project (services, addresses, how they connect) and use ready-made prompts: `deploy`, `debug_deployment` and `preview_changes` (slash commands in Claude Code). Agents without MCP can read [llms.txt](/llms.txt).

## What the agent did

**Agents → What agents did** lists every change agents made in the last 30 days, and [notifications](/docs/notifications) can tell you as it happens.
