# Connect Claude Code

> Source: https://developers.anymail.watch/mcp-claude-code/

Claude Code connects to the anymail MCP server over HTTP. Sign in with OAuth in the browser, or send an API token as a header for a machine without a browser.

## With OAuth

1. Add the server:

   ```bash
   claude mcp add --transport http anymail https://app.anymail.watch/api/mcp
   ```

2. Start Claude Code and run `/mcp`.
3. Select `anymail`, then **Authenticate**. A browser window opens anymail.
4. Sign in, pick the **Workspace** and the **Access**, and select **Allow**.

Claude Code stores the tokens and refreshes them. To sign in from the shell without opening a session, run `claude mcp login anymail`. To sign out, use **Clear authentication** in the `/mcp` menu.

## With an API token

Generate a token in **Settings**, **Integrations**, **API keys**. See [Authentication](/authentication/). A read only token is enough for reports.

```bash
claude mcp add --transport http anymail https://app.anymail.watch/api/mcp \
  --header "Authorization: Bearer $ANYMAIL_TOKEN"
```

With a header, Claude Code does not use OAuth. When the token is revoked, the connection fails until you add the server again with a new token.

## Scope of the configuration

`claude mcp add` saves the server for you, in the current project, by default. Add `--scope user` to use anymail in every project, or `--scope project` to share the server through `.mcp.json` with your team. Do not put a token in a shared `.mcp.json`. Use OAuth there, so that each person signs in.

```bash
claude mcp add --transport http anymail https://app.anymail.watch/api/mcp --scope user
```

## Check the connection

Run `/mcp` in Claude Code. It lists `anymail` as connected, with 44 tools. Then ask, for example: "List my anymail campaigns with their reply rate."

The [prompts](/mcp-server/#prompts) of the server are commands in Claude Code:

```
/mcp__anymail__campaign_report
/mcp__anymail__review_replies
/mcp__anymail__build_campaign
```

## Related

- [MCP server](/mcp-server/)
- [CLI](/cli/)
- [Connect Cursor](/mcp-cursor/)
