> ## Documentation Index
> Fetch the complete documentation index at: https://docs.2extract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex

> Connect the 2extract MCP server to the OpenAI Codex CLI so it can provision proxies while it builds your integration.

Codex CLI reads its MCP servers from a TOML config file, or accepts them through its own `mcp` subcommand.

***

## Add the server

The quickest route is the CLI:

```bash icon="terminal" theme={null}
codex mcp add 2extract \
  --url https://mcp.2extract.com/mcp \
  --header "Authorization: Bearer 2xt_YOUR_API_KEY"
```

Or edit `~/.codex/config.toml` directly:

```toml ~/.codex/config.toml icon="gear" theme={null}
[mcp_servers.2extract]
url = "https://mcp.2extract.com/mcp"

[mcp_servers.2extract.http_headers]
Authorization = "Bearer 2xt_YOUR_API_KEY"
```

<Note>
  Codex moves quickly and the exact key names for remote servers have changed between releases - some versions also require a flag to enable the HTTP transport. If the config above is rejected, check `codex mcp --help` and the [Codex documentation](https://developers.openai.com/codex) for your version.

  Whatever the shape, the three values never change: the URL `https://mcp.2extract.com/mcp`, transport Streamable HTTP, and the header `Authorization: Bearer 2xt_...`.
</Note>

***

## Verify

```bash icon="terminal" theme={null}
codex mcp list
```

`2extract` should be listed. Then start Codex and ask:

> What is my 2extract balance?

<Check>
  A number comes back, and no proxy was created.
</Check>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Codex does not see the server">
    Run `codex mcp list`. If the entry is missing, the config file was not picked up - confirm the path is `~/.codex/config.toml` and that the TOML parses.

    If the entry is there but not connecting, your build may not have remote HTTP transport enabled. Check `codex mcp --help`.
  </Accordion>

  <Accordion title="Unauthorized on every call">
    The header must be exactly `Authorization: Bearer 2xt_...`. In TOML, keep the whole value in one quoted string, including the word `Bearer`.
  </Accordion>

  <Accordion title="Some tools fail, others work">
    A scope problem rather than a connection problem. The key is missing the scope those tools need - see [Overview](/ai/mcp-server/overview#scopes-an-agent-needs).
  </Accordion>
</AccordionGroup>

***

## Next steps

<CardGroup cols={2}>
  <Card title="Tools" icon="wrench" href="/ai/mcp-server/tools">
    Everything the agent can call.
  </Card>

  <Card title="Other clients" icon="plug" href="/ai/clients/other">
    The three values any MCP client needs.
  </Card>
</CardGroup>
