# Agents and MCP

Give Claude Code, Codex, Cursor or your own agent the same AskAds tools ChatGPT and Claude use. Sign in with your browser, or with an API key.

AskAds's MCP server is at `https://askads.app/mcp` (Streamable HTTP). It has the same tools as the ChatGPT app and the Claude connector: reports, campaigns, paused drafts, images, competitors, pausing and asking for approval. Using ChatGPT or Claude in the browser or the desktop app? See [ChatGPT setup](/chatgpt) or [Claude setup](/claude) instead.

## Browser sign-in or a key?

| | Browser sign-in (OAuth) | API key |
|---|---|---|
| Best for | You, at your own computer | Servers, CI, shared or headless agents |
| What it may do | Everything your role allows | Only the key's [scopes](/developers/authentication#scopes) and business limit |
| Approving spending | On the website | On the website. The approval tool refuses keys. |
| Shows in the dashboard as | A connected app | A key, with its name in the activity log |

Either way, nothing goes live and no budget goes up until a person approves on the website. [The money rule](/developers/money-rule).

For a key, keep it in an environment variable so it is never pasted into a chat:

```bash
export ASKADS_API_KEY=ask_key_...
```

The CLI prints any of the setups below for you: `npx askads mcp config --agent claude-code` (or `codex`, `cursor`).

## Claude Code {#claude-code}

Checked against Claude Code's MCP docs ([code.claude.com/docs/en/mcp](https://code.claude.com/docs/en/mcp)) on 20 Nov 2026.

**Browser sign-in.** Add the server, then type `/mcp` inside Claude Code, pick `askads` and sign in when your browser opens:

```bash
claude mcp add --transport http askads https://askads.app/mcp
```

**With a key.** Put the server in your project's `.mcp.json`. Claude Code reads `${ASKADS_API_KEY}` from your environment each time it starts, so the key itself is never written into any file:

```json
{
  "mcpServers": {
    "askads": {
      "type": "http",
      "url": "https://askads.app/mcp",
      "headers": { "Authorization": "Bearer ${ASKADS_API_KEY}" }
    }
  }
}
```

`npx askads mcp config --agent claude-code --with-key` prints exactly this. Do not pass the key with `claude mcp add --header "Authorization: Bearer $ASKADS_API_KEY"`: your shell fills in the key there, and it ends up saved in Claude Code's settings file.

For browser sign-in, add `--scope user` to the `claude mcp add` line to have AskAds in every project, or `--scope project` to write `.mcp.json` for the team.

## Codex {#codex}

Checked against the Codex MCP docs ([learn.chatgpt.com/docs/extend/mcp](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)) on 20 Nov 2026.

**Browser sign-in.** Add this to `~/.codex/config.toml` (or `.codex/config.toml` in a trusted project), then run `codex mcp login askads`:

```toml
[mcp_servers.askads]
url = "https://askads.app/mcp"
```

`codex mcp add askads --url https://askads.app/mcp` writes the same table for you. On a machine without a browser, `codex mcp login askads --no-browser` prints a link to open elsewhere.

**With a key.** Codex reads the key from the variable you name and sends it as the bearer token:

```toml
[mcp_servers.askads]
url = "https://askads.app/mcp"
bearer_token_env_var = "ASKADS_API_KEY"
```

## Cursor {#cursor}

Checked against Cursor's MCP docs ([cursor.com/docs/context/mcp](https://cursor.com/docs/context/mcp)) on 20 Nov 2026.

**Browser sign-in.** Add this to `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (one project). Cursor shows a sign-in button next to `askads`; sign in when your browser opens:

```json
{
  "mcpServers": {
    "askads": { "url": "https://askads.app/mcp" }
  }
}
```

**With a key.** Cursor fills `${env:ASKADS_API_KEY}` from the environment:

```json
{
  "mcpServers": {
    "askads": {
      "url": "https://askads.app/mcp",
      "headers": { "Authorization": "Bearer ${env:ASKADS_API_KEY}" }
    }
  }
}
```

## Your own agent {#custom}

Any MCP client that speaks Streamable HTTP works.

- **Address**: `https://askads.app/mcp`. `GET` answers 405 by design; clients `POST` JSON-RPC.
- **With a key**: send `Authorization: Bearer ask_key_...` on every request.
- **With OAuth**: a request without a token gets 401 with `WWW-Authenticate: Bearer resource_metadata="https://askads.app/.well-known/oauth-protected-resource/mcp"`. From there: authorization server metadata at `https://askads.app/.well-known/oauth-authorization-server`, dynamic client registration at `https://askads.app/oauth/register`, authorization code with PKCE (S256), and `resource=https://askads.app/mcp`. Tokens for the MCP server do not work on the REST API, and the other way round.
- **No MCP?** Use the [REST API](/developers/api) with a key. Give your agent [/developers/agents.md](/developers/agents.md) as its first read: it is written for agents.

## Tips for agents

- Call `get_account_status` first. It says which ad platforms are connected and what to do if one is missing.
- Build with `create_draft_campaign`, then ask with `propose_launch`. Tell the person the approval link from the answer; do not try to approve.
- Pausing (`pause`) and lowering a budget (`lower_budget`) work at once and need no approval.
- If a tool says "stop all changes" is on, only pausing works until a person switches it off on the website.
