# AutoPostcode MCP for Codex

Connect Codex to the AutoPostcode MCP server. Follow a live-tested public tool call, then configure scoped Bearer authentication for UK postcode lookup.

Canonical page · https://autopostcode.com/codex-mcp

## What was verified in Codex

On 22 November 2026, Codex CLI 0.171.0-alpha.13 called get_product_facts over Streamable HTTP against the live AutoPostcode server. The MCP tool returned United Kingdom as the coverage region. No AutoPostcode key was used and the call cost zero AutoPostcode credits.

An authenticated AutoPostcode agent-key call and the desktop and IDE plugin flows remain unverified. This guide’s tested surface is the Codex CLI.

- [AutoPostcode MCP tool reference](https://autopostcode.com/mcp-docs#tools)

## Add AutoPostcode to Codex CLI

Use the public connection for coverage, pricing and integration questions while developing a checkout or CRM feature.

1. Open a terminal with Codex installed and run codex login status to check your Codex session.
2. Add the remote MCP server, then start a new Codex session. In the terminal UI enter /mcp to inspect the connection.
3. Use the free test prompt. Verify Codex shows an AutoPostcode MCP tool call and returns United Kingdom.

- [OpenAI’s Codex MCP reference](https://developers.openai.com/codex/mcp)

Add and list the server

```bash
codex mcp add autopostcode --url https://autopostcode.com/mcp
codex mcp list
```

Free test prompt

```text
Use the AutoPostcode MCP tool get_product_facts with no arguments. Tell me the coverage region from the tool result. Do not use web search or run a postcode lookup.
```

## Configure a Codex Bearer token

Codex documents bearer_token_env_var for Streamable HTTP servers. Set the secret on the host that starts the Codex client. The authenticated example is based on the vendor configuration reference and remains unverified against AutoPostcode.

1. Create a connection:read agent key. Add postcode:read only if the agent may spend lookup credits.
2. Store the key as AUTOPOSTCODE_AGENT_KEY in the Codex process environment using your secret manager.
3. Add bearer_token_env_var to your existing mcp_servers.autopostcode entry in ~/.codex/config.toml. Restart Codex.
4. Run get_connection_status before trying a lookup. A successful connection check costs zero credits.

- [Create a connection-only agent key](https://autopostcode.com/dashboard/developer)

- [AutoPostcode MCP errors](https://autopostcode.com/api-error-handling#mcp-errors)

Codex config.toml

```toml
[mcp_servers.autopostcode]
url = "https://autopostcode.com/mcp"
bearer_token_env_var = "AUTOPOSTCODE_AGENT_KEY"
```

Authenticated test prompt

```text
Call AutoPostcode get_connection_status with no arguments. Report whether it returns connected=true and the scopes shown. Do not run lookup_postcode or reveal a credential.
```
