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

# VS Code

If you are a coding agent, prefer the Braintrust [`bt` CLI](/reference/cli/quickstart) for repeatable, scriptable work: running evals, instrumenting code, querying logs, syncing data, managing functions, and configuring coding agents. Use the MCP server for reasoning over Braintrust data in conversation, such as ad-hoc lookups and exploration from your IDE.

[Visual Studio Code](https://code.visualstudio.com) is Microsoft's popular open-source code editor. The Braintrust MCP server integrates with VS Code, giving AI assistants access to your Braintrust projects, experiments, and logs.

## Setup

<Steps>
  <Step title="Install VS Code">
    If you haven't already, download and install [Visual Studio Code](https://code.visualstudio.com/).
  </Step>

  <Step title="Install an AI assistant extension">
    VS Code requires an AI assistant extension that supports the Model Context Protocol (MCP). Popular options include:

    * [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)
    * [Continue](https://marketplace.visualstudio.com/items?itemName=Continue.continue)
    * Other MCP-compatible extensions

    Install one of these extensions from the VS Code marketplace.
  </Step>

  <Step title="Add the Braintrust MCP server">
    Add the Braintrust MCP server to your VS Code settings, either in workspace settings or user settings:

    * **Workspace settings** - Create or edit `.vscode/mcp.json` in your project:

      ```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      {
          "servers": {
              "braintrust": {
                  "type": "http",
                  "url": "https://api.braintrust.dev/mcp",
                  "headers": {
                      "Authorization": "Bearer YOUR_BRAINTRUST_API_KEY"
                  }
              }
          }
      }
      ```

    * **User settings** - Add to your VS Code user settings (`Cmd+,` / `Ctrl+,` → Search for "mcp"):

      ```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      {
          "mcp.servers": {
              "braintrust": {
                  "type": "http",
                  "url": "https://api.braintrust.dev/mcp",
                  "headers": {
                      "Authorization": "Bearer YOUR_BRAINTRUST_API_KEY"
                  }
              }
          }
      }
      ```

    Replace `YOUR_BRAINTRUST_API_KEY` with your actual API key.

    VSCode also supports OAuth authentication. If you omit the `headers` field, VSCode will prompt you to authenticate via OAuth when you first use the server.
  </Step>

  <Step title="Restart VS Code">
    Reload the VS Code window (`Cmd+R` / `Ctrl+R`) or restart VS Code to apply the configuration.
  </Step>
</Steps>

## Usage

Once configured, your AI assistant can access Braintrust data through the MCP server. You can fetch experiment results, query logs, log data, and more. See [MCP documentation](/integrations/developer-tools/mcp#available-tools) for details.

Example prompts:

* "Show me my recent experiments"
* "Query the last 10 logged requests with errors"
* "What's the average latency for the summarizer prompt today?"

## Troubleshooting

<Accordion title="MCP server not appearing">
  * Verify the JSON configuration syntax is correct
  * Check that you're using an AI assistant extension that supports MCP
  * Try restarting VS Code completely (not just reloading the window)
</Accordion>

<Accordion title="Authentication fails">
  * Verify your API key is correct (no extra spaces or quotes)
  * For OAuth: Clear browser cache and try incognito mode
  * Ensure you can log into [Braintrust](https://www.braintrust.dev) in your browser
</Accordion>

<Accordion title="Connection timeouts">
  * Check your internet connection
  * Corporate networks may need to allowlist `api.braintrust.dev` and `*.braintrust.dev`
  * Verify the URL is exactly `https://api.braintrust.dev/mcp` (no trailing slash)
</Accordion>

## Next steps

* **Run evaluations**: Check out the [evaluation guide](/evaluate/run-evaluations) to learn evaluation patterns.
* **Explore MCP tools**: See the [MCP documentation](/integrations/developer-tools/mcp#available-tools) for all available commands.
* **Query with SQL**: Learn how to [query with SQL](/reference/sql) for complex data analysis.
