This guide explains how to integrate BenchBox with AI assistants using the Model Context Protocol (MCP). Supported clients include Claude Code, ChatGPT, OpenCode, and other MCP-compatible tools.
BenchBox provides an MCP server that exposes benchmarking capabilities to AI assistants. This enables:
- Interactive benchmarking: Run benchmarks through natural language
- Result analysis: AI-assisted performance analysis and recommendations
- Configuration validation: Verify settings before running benchmarks
- Platform discovery: Explore available platforms and benchmarks
- BenchBox installed with the
mcpextra - An MCP-compatible AI assistant (Claude Code, ChatGPT, OpenCode, etc.)
Install the MCP dependencies:
uv sync --extra mcpBefore configuring your AI agent, verify the MCP server works:
uv run python -m benchbox.mcpThe server starts and waits for input.
The server should start without errors. Press Ctrl+C to stop.
For interactive testing, use the MCP Inspector:
npx @modelcontextprotocol/inspector -- uv run python -m benchbox.mcpThis opens a web UI at http://localhost:6274 where you can browse and test all BenchBox tools.
The benchbox-mcp entry point supports MCP-specific runtime options:
benchbox-mcp --results-dir /tmp/benchbox-results --charts-dir /tmp/benchbox-charts --log-level DEBUGIf flags are omitted, BenchBox resolves values with this precedence:
- Explicit flag (
--results-dir,--charts-dir,--log-level) - Env vars (
BENCHBOX_RESULTS_DIR,BENCHBOX_CHARTS_DIR,BENCHBOX_LOG_LEVEL) - Derived from
BENCHBOX_OUTPUT_DIR(for results/charts only) - Defaults (
benchmark_runs/results,benchmark_runs/charts,INFO)
This ensures MCP read/write tools and benchmark export paths stay aligned to the same configured results_dir.
Choose your AI assistant below for setup instructions.
Add BenchBox as an MCP server using the Claude Code CLI:
claude mcp add benchbox --scope project -- benchbox-mcp
claude mcp add benchbox --scope project -- benchbox-mcp --results-dir /tmp/benchbox-results
claude mcp add benchbox --scope project -- uv run python -m benchbox.mcp
claude mcp add benchbox --scope user -- benchbox-mcpThe commands, in order:
- Use the
benchbox-mcpentry point (recommended if it is in your PATH). - Pass custom MCP paths, here the results directory.
- Use
uv, which works from any directory with BenchBox installed. - Register the server user-scoped, so it is available in all your projects.
Create or edit .mcp.json in your project root:
{
"mcpServers": {
"benchbox": {
"type": "stdio",
"command": "benchbox-mcp",
"args": []
}
}
}Or using uv if benchbox-mcp isn't in PATH:
{
"mcpServers": {
"benchbox": {
"type": "stdio",
"command": "uv",
"args": ["run", "python", "-m", "benchbox.mcp"]
}
}
}claude mcp list
/mcpclaude mcp list lists the configured servers. /mcp checks the server status inside Claude Code.
Codex CLI is OpenAI's terminal-based coding assistant with MCP support.
Add BenchBox as an MCP server using the Codex CLI:
codex mcp add benchbox -- benchbox-mcp
codex mcp add benchbox -- benchbox-mcp --results-dir /tmp/benchbox-results
codex mcp add benchbox -- uv run python -m benchbox.mcpThe first command uses the benchbox-mcp entry point (recommended). The second passes custom MCP paths. The third uses uv if benchbox-mcp isn't in your PATH.
Codex stores MCP configuration in ~/.codex/config.toml. You can edit this file directly:
[mcp_servers.benchbox]
command = "benchbox-mcp"
args = []codex mcp list
codex mcp show benchboxThe first command lists configured servers, and the second shows the configuration of one server.
codex mcp remove benchboxOpenAI's ChatGPT desktop app supports MCP servers for tool integration.
- Open ChatGPT desktop settings
- Navigate to Features > MCP Servers
- Click Add Server and configure:
{
"name": "benchbox",
"transport": "stdio",
"command": "benchbox-mcp",
"args": []
}If benchbox-mcp isn't in PATH, use the full path or uv:
{
"name": "benchbox",
"transport": "stdio",
"command": "uv",
"args": ["run", "python", "-m", "benchbox.mcp"],
"cwd": "/path/to/your/project"
}Ask ChatGPT: "What MCP tools are available?" - it should list BenchBox tools including list_available, run_benchmark, etc.
OpenCode is an open-source AI coding assistant that supports MCP.
Create or edit ~/.opencode/config.json:
{
"mcp": {
"servers": {
"benchbox": {
"command": "uv",
"args": ["run", "python", "-m", "benchbox.mcp"],
"cwd": "/path/to/benchbox/project"
}
}
}
}Alternatively, create .opencode.json in your project root:
{
"mcp": {
"servers": {
"benchbox": {
"command": "uv",
"args": ["run", "python", "-m", "benchbox.mcp"]
}
}
}
}opencode --list-mcp-serversFor other MCP-compatible clients, use the standard stdio transport:
Command: uv run python -m benchbox.mcp
Transport: stdio (JSON-RPC over stdin/stdout)
Most clients support a configuration like:
{
"command": "uv",
"args": ["run", "python", "-m", "benchbox.mcp"],
"transport": "stdio"
}Consult your client's documentation for the specific configuration format.
Once configured, Claude Code can use BenchBox tools through natural language. Example interactions:
"What database platforms are available in BenchBox?"
Claude will use list_available("platforms") to show available platforms with their capabilities.
"Run TPC-H at scale factor 0.1 on DuckDB"
Claude will use run_benchmark(platform="duckdb", benchmark="tpch", scale_factor=0.1).
"Can I run TPC-DS on Polars with scale factor 10?"
Claude will use check_dependencies(platform="polars") to check if the configuration is valid.
"Show me the slowest queries from my last benchmark run"
Claude will use get_results() to list recent runs, then get_results(result_file="...") to analyze performance.
BenchBox provides reusable prompt templates for common analysis tasks. These are invoked as slash commands:
/mcp__benchbox__analyze_results tpch duckdb
/mcp__benchbox__compare_platforms tpch "duckdb,polars-df" 0.1
/mcp__benchbox__identify_regressions
/mcp__benchbox__benchmark_planning testing
MCP prompts use positional arguments, not named parameters:
# Correct - positional arguments separated by spaces
/mcp__benchbox__compare_platforms tpch "duckdb,polars" 1
# Incorrect - named parameters not supported
/mcp__benchbox__compare_platforms benchmark=tpch scale_factor=1
| Prompt | Arguments | Description |
|---|---|---|
analyze_results |
benchmark, platform, focus | Analyze benchmark results |
compare_platforms |
benchmark, platforms, scale_factor | Compare performance across platforms |
identify_regressions |
baseline_run, comparison_run, threshold_percent | Find performance regressions |
benchmark_planning |
use_case, platforms, time_budget_minutes | Plan benchmark strategy |
troubleshoot_failure |
error_message, platform, benchmark | Diagnose benchmark failures |
MCP server configuration can be stored at different scopes depending on your client:
| Scope | Location | Shared | Use Case |
|---|---|---|---|
| Local | .claude.json in project |
No | Personal development |
| Project | .mcp.json at project root |
Yes (via git) | Team-shared configuration |
| User | ~/.claude.json |
No | Cross-project personal tools |
Use --scope flag when adding:
claude mcp add --transport stdio benchbox --scope project -- uv run python -m benchbox.mcpMost clients support:
- Project-level: Configuration file in project root (e.g.,
.opencode.json) - User-level: Configuration in home directory (e.g.,
~/.opencode/config.json)
-
Verify MCP dependencies are installed:
uv sync --extra mcp
-
Test the server directly:
uv run python -m benchbox.mcp
The server should start and wait for JSON-RPC input. Press Ctrl+C to exit.
-
Check for import errors in the output.
-
Verify working directory - the server must run from a directory where BenchBox is installed.
- Check your client's MCP server status (e.g.,
/mcpin Claude Code) - Verify the tool exists by asking "What BenchBox tools are available?"
- Check argument types match expected types (e.g.,
scale_factoris a number, not a string)
Project-scoped servers require approval on first use. If prompted, approve the server or reset choices:
claude mcp reset-project-choicesIf the client can't connect to the server:
- Ensure
uvis in your PATH - Try using absolute paths in configuration:
{ "command": "/path/to/uv", "args": ["run", "python", "-m", "benchbox.mcp"], "cwd": "/path/to/benchbox/project" } - Check client logs for connection errors
- MCP Reference - Complete tool and prompt reference
- CLI Reference - Command-line interface documentation
- API Reference - Python API documentation