Setup
Install Codex
If you haven’t already, install Codex.
Add the Braintrust MCP server
Edit This configures Codex to read your Braintrust API key from the
~/.codex/config.toml and add the Braintrust MCP server configuration:BRAINTRUST_API_KEY environment variable.Usage
Once configured, Codex 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 Codex:- “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 accuracy scores between my GPT-4 and Claude experiments”
Troubleshooting
BRAINTRUST_API_KEY not found
BRAINTRUST_API_KEY not found
- Verify the variable is set:
echo $BRAINTRUST_API_KEY(macOS/Linux) orecho %BRAINTRUST_API_KEY%(Windows) - Ensure you’ve reloaded your shell after setting the variable
- Check that Codex is launched from a shell where the variable is set
MCP server not appearing
MCP server not appearing
- Verify the TOML configuration syntax is correct
- Check that the file path is exactly
~/.codex/config.toml - Run
/mcpin Codex to see available MCP servers - Try restarting Codex
Authentication fails
Authentication fails
- Verify your API key is correct (no extra spaces)
- Ensure you can log into Braintrust using the account associated with the API key
- 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
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.