> 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 Claude Code

## 1. Set your key

Create a key at [app.defdex.io/developer/keys](https://app.defdex.io/developer/keys), then:

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

## 2. Add DefDex

```bash
claude mcp add --transport http defdex https://app.defdex.io/mcp \
  --header "Authorization: Bearer $DEFDEX_API_KEY"
```

Use double quotes so your shell expands `$DEFDEX_API_KEY`. The name and URL come before
`--header`. This saves the server for you only, outside your repository.

### Share with your team

To add DefDex to a repository without committing a key, create `.mcp.json` at the project
root. Claude Code fills `${DEFDEX_API_KEY}` from each teammate's environment:

**`.mcp.json`**

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

Don't run `claude mcp add --scope project` with `$DEFDEX_API_KEY`: the shell expands it and
the key would land in the committed file.

## 3. Verify

Start Claude Code and run `/mcp`. `defdex` should show as connected with tools such as
`search_records`, `get_entity` and `get_credit_balance`. From your terminal,
`claude mcp list` shows the same.

## 4. Try it

```text
Use DefDex to find the programs the Space Development Agency runs and which companies hold awards on them.
```

```text
Look up Palantir in DefDex and summarize its obligated DoD awards by fiscal year. Keep obligated and ceiling amounts separate.
```

## Optional: add the skill

The [DefDex skill](/agents/skill) teaches Claude when to reach for DefDex and how to keep
dollar labels straight:

```bash
mkdir -p ~/.claude/skills/defdex
curl -fsSL https://defdex.io/skills/defdex/SKILL.md -o ~/.claude/skills/defdex/SKILL.md
```

Start a new session so Claude Code loads it.

## Troubleshooting

* **401 Unauthorized.** The key wasn't sent or was revoked. Check `echo ${DEFDEX_API_KEY:0:8}`
  prints a prefix, then remove and re-add the server: `claude mcp remove defdex`.
* **Two `defdex` servers.** Remove one with `claude mcp remove defdex --scope <scope>` and start a new session.
* **402 Payment Required.** Your credits for this cycle are used up. See [Credits and limits](/credits-and-limits).
* **429 Too Many Requests.** Wait for the `Retry-After` seconds; all of your keys share one per-minute limit.

Never paste your key into the conversation.