> ## Documentation Index
> Fetch the complete documentation index at: https://developer.firstsales.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex and Claude Code

> Connect Codex or Claude Code to FirstSales through Product MCP or the CLI.

Coding agents with shell access can use FirstSales in two ways:

* **Product MCP** with OAuth. The agent acts inside the organizations and workspaces you approve on the consent screen.
* **The `firstsales` CLI** with a Developer API key. See [CLI workflow](#cli-workflow).

Product MCP does not accept Developer API keys, and the CLI does not use MCP OAuth tokens.

## Connect Codex to Product MCP

Add the server, then sign in with Dynamic Client Registration (DCR):

```bash theme={null}
codex mcp add firstsales --url https://api.app.firstsales.io/mcp
codex mcp login firstsales \
  --scopes mcp:access,offline_access \
  --oauth-client-registration dcr
```

Codex opens the FirstSales consent screen in your browser. Pick the organizations and
workspaces the agent may use, approve, and return to the terminal. A successful login
prints `Successfully logged in to MCP server 'firstsales'.`

> [!NOTE]
>
> Type the registration value in lowercase: `dcr`. The Codex help text shows the
> placeholder `AUTO|CIMD|DCR`, but uppercase `DCR` is rejected.

`offline_access` lets Codex refresh the 10-minute access token without another browser
login. Add `mcp:write`, `mcp:destructive`, or `mcp:financial` only when the agent needs
those tiers. See [Consent, authority, and token
lifetime](/agents/mcp-server#consent-authority-and-token-lifetime).

### If login fails with `invalid_client`

Without `--oauth-client-registration dcr`, Codex can choose its own HTTPS Client ID
Metadata Document (CIMD). If FirstSales cannot validate that document, the authorization
request fails with:

```json theme={null}
{"error":"invalid_client","error_description":"Unable to validate client metadata document."}
```

Run the login again with `--oauth-client-registration dcr`, as shown above. DCR registers
a public client with FirstSales and does not depend on the Codex metadata document. This
error concerns that one document; it does not mean every client metadata document is
unsupported.

### If a tool says the workspace is not granted

A tool call for a workspace you did not approve returns a message asking you to
reconnect. Run `codex mcp login firstsales` again with the same flags and select that
workspace on the consent screen.

## Connect Claude Code to Product MCP

```bash theme={null}
claude mcp add --transport http firstsales https://api.app.firstsales.io/mcp
```

Then run `/mcp` inside Claude Code, choose `firstsales`, and complete the browser consent.

## CLI workflow

Use this sequence in Codex or Claude Code:

```bash theme={null}
firstsales whoami --json
firstsales workspaces list --org org_123 --json
firstsales campaigns list --org org_123 --workspace ws_123 --json
```

For mutations:

```bash theme={null}
firstsales campaigns pause \
  --org org_123 \
  --workspace ws_123 \
  --campaign camp_123 \
  --idempotency-key pause-camp-123-2026-06-30 \
  --json
```

For destructive operations, agents must pass `--confirm` deliberately.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.