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

# VS Code

> Connect VS Code to the Braintrust MCP server to query logs, compare experiments, and work with datasets

[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

**1. Choose authentication**

> [tab] OAuth (recommended)
>
> Use OAuth when your client supports it. Your client opens a Braintrust authorization page where you sign in and approve access. The server acts with the permissions of the account you sign in with.
>
> * No Braintrust API key required
> * No OAuth client ID or client secret to configure
>
> The server implements OAuth 2.0 with dynamic client registration and publishes its metadata at `/.well-known/oauth-authorization-server` on the same host as your MCP endpoint (see next step), so a client can register itself.

> [tab] API key
>
> Use an API key for clients without OAuth support or for programmatic connections. The server acts with the permissions of the account the key belongs to.
>
> 1. Create a key in \*\* Settings\*\* > [\*\* API keys\*\*](https://www.braintrust.dev/app/~/configuration/api-keys).
> 2. Configure your client to send this header on every request, replacing `YOUR_BRAINTRUST_API_KEY` with your key:
>
>    ```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
>    Authorization: Bearer YOUR_BRAINTRUST_API_KEY
>    ```

**2. Choose your endpoint**

Use the endpoint for your organization's [data plane region](https://docs.braintrust.dev/admin/organizations.md#data-plane-region):

| Region | MCP endpoint |
| - | - |
| US | `https://api.braintrust.dev/mcp` |
| EU | `https://api-eu.braintrust.dev/mcp` |

Other connection details:

* **Self-hosted:** Copy the **MCP URL** from \*\* Settings\*\* > [\*\* Data plane\*\*](https://www.braintrust.dev/app/~/configuration/data-plane). This is your Braintrust API URL with `/mcp` appended.
* **Transport:** If your client asks you to choose a transport, choose HTTP (also called streamable HTTP). SSE-only clients can't connect.

**3. Add the server to VS Code**

Follow the [VS Code guide](https://code.visualstudio.com/docs/agent-customization/mcp-servers) to add the remote server. For header and OAuth settings, see the [VS Code configuration reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration).

**4. Verify the connection**

To verify the connection, ask VS Code's agent to list your recent Braintrust projects. If it can't connect, see [Braintrust MCP troubleshooting](https://docs.braintrust.dev/integrations/developer-tools/mcp.md#troubleshooting).

**5. Start using Braintrust tools**

VS Code's agent can query logs, compare experiments, work with datasets, and use other Braintrust tools. For example:

* "Show me my recent Braintrust experiments."
* "Query the last 10 logged requests with errors."
* "Compare accuracy scores between my two latest experiments."

See [what the Braintrust MCP can do](https://docs.braintrust.dev/integrations/developer-tools/mcp.md#what-the-mcp-can-do) for more workflows and example prompts.

## Next steps

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


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