> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.defdex.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.defdex.io/_mcp/server.

# DefDex in Codex

## 1. Set your key

```bash
export DEFDEX_API_KEY="YOUR_API_KEY"
```

Codex reads the key from this variable each time it connects; the key itself is never
written to Codex's config.

## 2. Add DefDex

```bash
codex mcp add defdex --url https://app.defdex.io/mcp --bearer-token-env-var DEFDEX_API_KEY
```

Or add it to `~/.codex/config.toml` yourself:

**`~/.codex/config.toml`**

```toml title="~/.codex/config.toml"
[mcp_servers.defdex]
url = "https://app.defdex.io/mcp"
bearer_token_env_var = "DEFDEX_API_KEY"
```

## 3. Verify

Run `codex mcp list`, or `/mcp` inside a Codex session. `defdex` should list its tools.

## 4. Try it

```text
Use DefDex to find SBIR awards to companies working on hypersonics since FY2023, and list the awarding offices.
```

## Teach Codex the rules

Add the [DefDex instructions](/agents/skill#project-instructions) to your project's
`AGENTS.md` so Codex keeps dollar labels straight and cites sources.

## Troubleshooting

* **401 Unauthorized.** `DEFDEX_API_KEY` wasn't set in the shell that started Codex. Export it and restart.
* **Tools missing.** Run `codex mcp list` to confirm the server is enabled, then start a new session.