> ## 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.

# VS Code

> Connect VS Code Copilot agent mode to DeFi Orbit AI and verify with one tool call.

VS Code (GitHub Copilot agent mode) connects to DeFi Orbit AI over streamable HTTP through `.vscode/mcp.json`. You need an active API key from [API Keys](https://platform.defiorbit.xyz/dashboard/keys).

## Add the server

Create `.vscode/mcp.json` in the workspace. The `inputs` block makes VS Code prompt for the key once and store it encrypted, so the file is safe to commit:

```json theme={null}
{
  "inputs": [
    {
      "type": "promptString",
      "id": "defiorbit-key",
      "description": "DeFi Orbit API key",
      "password": true
    }
  ],
  "servers": {
    "defiorbit": {
      "type": "http",
      "url": "https://mcp.defiorbit.xyz/mcp",
      "headers": {
        "Authorization": "Bearer ${input:defiorbit-key}"
      }
    }
  }
}
```

Run **MCP: List Servers** from the command palette and start `defiorbit`; VS Code asks for the key on first start. To register the server once for all workspaces, use **MCP: Open User Configuration** and add the same `servers` entry there.

## Verify the first call

Open Copilot Chat in agent mode and 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 the server starts cleanly but every call returns `INVALID_API_KEY`, re-enter the key (**MCP: List Servers → defiorbit → Show Configuration** to reset the stored input). All failure cases are on [Troubleshooting](/ai/troubleshooting).


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