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

# Claude Code

> Connect Claude Code to DeFi Orbit AI and verify with one tool call.

Claude Code connects to DeFi Orbit AI over streamable HTTP with the `claude mcp add` command. You need an active API key from [API Keys](https://platform.defiorbit.xyz/dashboard/keys).

## Add the server

```bash theme={null}
claude mcp add --transport http defiorbit https://mcp.defiorbit.xyz/mcp \
  --header "Authorization: Bearer <API_KEY>"
```

This registers the server for the current project. Add `--scope user` to make it available in every project on the machine.

To share the server with a team without sharing the key, commit a `.mcp.json` at the project root that reads the key from an environment variable:

```json theme={null}
{
  "mcpServers": {
    "defiorbit": {
      "type": "http",
      "url": "https://mcp.defiorbit.xyz/mcp",
      "headers": {
        "Authorization": "Bearer ${DEFIORBIT_API_KEY}"
      }
    }
  }
}
```

Each teammate then sets `DEFIORBIT_API_KEY` in their shell before starting Claude Code.

## Verify the first call

Run `/mcp` inside a Claude Code session — `defiorbit` should show as connected with 54 tools. Then ask:

> Call the defiorbit usage-credits tool.

A working setup returns the organization's balance:

```json theme={null}
{ "data": { "credits_remaining": 123242, "grants": 119259, "purchased_credits": 3983 } }
```

That call costs 1 credit, the same as [Get Remaining Credits](/api-reference/usage/credits) over REST, and confirms the key, billing, and rate limit are all wired to your organization.

## If it fails

The one to know: an invalid key still connects and lists all 54 tools — authentication is only checked when a tool runs. If `/mcp` shows the server as healthy but every call returns `INVALID_API_KEY`, the key is wrong or revoked, not the connection. All failure cases are on [Troubleshooting](/ai/troubleshooting).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.