> 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 Cursor

## 1. Add DefDex

Open **Cursor Settings → MCP → Add new MCP server**, or edit the file directly. Use
`~/.cursor/mcp.json` for every project, or `.cursor/mcp.json` for one:

**`~/.cursor/mcp.json`**

```json title="~/.cursor/mcp.json"
{
  "mcpServers": {
    "defdex": {
      "url": "https://app.defdex.io/mcp",
      "headers": { "Authorization": "Bearer ${env:DEFDEX_API_KEY}" }
    }
  }
}
```

Cursor fills `${env:DEFDEX_API_KEY}` from the environment it was started in. Export the
variable in your shell profile, then quit and reopen Cursor (on macOS, launching it from a
terminal with `cursor .` guarantees it sees the variable).

## 2. Verify

In **Cursor Settings → MCP**, `defdex` shows a green dot and its tools.

## 3. Try it

```text
Use DefDex to find which companies supply rocket motors to DoD programs, with sources.
```

## Troubleshooting

* **401 Unauthorized.** Cursor sent the text `${env:DEFDEX_API_KEY}` instead of the key,
  usually because it didn't see the variable at launch. Restart Cursor from a terminal
  where the variable is set. If it still fails, put the key in place of
  `${env:DEFDEX_API_KEY}` in your global `~/.cursor/mcp.json` only, never in a project file
  you commit.
* **Server shows red.** Check the JSON is valid and the URL is exactly `https://app.defdex.io/mcp`.