Setup
Install OpenCode
If you haven’t already, install OpenCode.
Add the Braintrust MCP server
Edit your OpenCode configuration file and add the Braintrust MCP server:Replace
YOUR_BRAINTRUST_API_KEY with your actual API key.Usage
Once configured, OpenCode can access Braintrust data through the MCP server. You can fetch experiment results, query logs, log data, and more. See MCP documentation for details. Example prompts in OpenCode:- “Show me my recent Braintrust experiments”
- “Query the last 10 logged requests with errors”
- “What’s the average latency for the summarizer prompt today?”
- “Compare costs between my GPT-4 and Claude experiments”
Troubleshooting
MCP server not appearing
MCP server not appearing
- Verify the JSON configuration syntax is correct (no trailing commas, proper quotes)
- Check that you’re editing the correct configuration file
- Try restarting OpenCode completely
- Consult the OpenCode config documentation for config file locations
Authentication fails
Authentication fails
- Verify your API key is correct (no extra spaces or quotes)
- Ensure you can log into Braintrust in your browser
- Check that the
Authorizationheader is properly formatted - Generate a new API key if needed
Connection errors
Connection errors
- Verify the URL is exactly
https://api.braintrust.dev/mcp(no trailing slash) - Check your internet connection
- Corporate networks may need to allowlist
api.braintrust.devand*.braintrust.dev
Configuration not loading
Configuration not loading
- Ensure the JSON file is valid (use a JSON validator)
- Verify the
$schemafield is correct - Check file permissions
- Look for error messages in OpenCode’s console or logs
Next steps
- Run evaluations: Check out the evaluation guide to learn evaluation patterns.
- Explore MCP tools: See the MCP documentation for all available commands.
- Query with SQL: Learn how to query with SQL for complex data analysis.