# Connect Codex, Cursor, or Claude Code

Use a user-level configuration wherever possible. The endpoint accepts a bearer PAT through the `Authorization` header and does not use cookies, query tokens, SSE, or browser CORS.

Existing `elicitra` client entries and `ELICITRA_MCP_TOKEN` environment references
remain valid without an expiry date. These are local client names: the server
receives the same bearer token. New configurations below use `betterstood` and
`BETTERSTOOD_MCP_TOKEN`; do not create a second entry if your existing one works.
The fourteen tool names remain unchanged. See [runtime compatibility](/developers/compatibility/#runtime-brand-identifiers).

## Codex

See the [official Codex MCP guide](https://developers.openai.com/codex/mcp) for current client commands and configuration behavior.

Use Codex CLI 0.144.1 or newer for this setup. Version 0.143.0 can write a remote-MCP block that its own config loader rejects; upgrade before adding Betterstood rather than editing around the broken entry. Confirm with `codex --version`.

Set `BETTERSTOOD_MCP_TOKEN`, then add this to `~/.codex/config.toml`:

```sh
codex mcp add betterstood \
  --url https://betterstood.com/api/mcp \
  --bearer-token-env-var BETTERSTOOD_MCP_TOKEN
```

The equivalent `~/.codex/config.toml` entry is:

```toml
[mcp_servers.betterstood]
url = "https://betterstood.com/api/mcp"
bearer_token_env_var = "BETTERSTOOD_MCP_TOKEN"
```

Restart Codex and run `codex mcp list`. Then open Codex, run `/mcp`, and make a real `elicitra_get_started` call before treating setup as complete. Codex reads server instructions during initialization; Betterstood keeps their first 512 characters self-contained.

## Claude Code

See the [official Claude Code MCP guide](https://code.claude.com/docs/en/mcp) for current scope and transport options.

Claude Code expands environment variables in HTTP headers. Add a user-scoped entry without exposing the token to shell history:

```sh
claude mcp add-json --scope user betterstood '{"type":"http","url":"https://betterstood.com/api/mcp","headers":{"Authorization":"Bearer ${BETTERSTOOD_MCP_TOKEN}"}}'
```

Verify with `claude mcp get betterstood`, then open `/mcp` inside Claude Code.

## Cursor

See the [official Cursor MCP guide](https://docs.cursor.com/context/model-context-protocol) for current configuration locations and supported transports.

Create `~/.cursor/mcp.json` with an environment-backed authorization header:

```json
{
  "mcpServers": {
    "betterstood": {
      "type": "http",
      "url": "https://betterstood.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${env:BETTERSTOOD_MCP_TOKEN}"
      }
    }
  }
}
```

Restart Cursor from an environment that can read `BETTERSTOOD_MCP_TOKEN`. Confirm the connection under **Settings → Tools & MCP → Available Tools** or with `cursor-agent mcp list-tools betterstood`. Do not place the expanded PAT in either global or project configuration.

Cursor's header and environment-variable support has changed across releases. Betterstood only claims compatibility with client versions in the [compatibility matrix](/developers/compatibility/) after a real bearer-auth smoke test.

## Verify the connection

All clients must discover exactly the tools allowed by the PAT scope: 10 tools for the read profile and 14 for full draft authoring. A read-only PAT includes `elicitra_knowledge_search` but must not list create/update tools, and directly calling a hidden write tool must still fail with `TOOL_NOT_AVAILABLE`.

Ask:

> Call `elicitra_knowledge_search` in `en-US` to explain what a Betterstood scenario is. Then call `elicitra_get_started` and `elicitra_account_info`. Summarize what you can change, what you cannot change, and the safe scenario-to-campaign workflow.
