Connect AI assistants to your CodSpeed performance data using the Model Context Protocol.
The CodSpeed MCP server gives AI-powered tools direct access to your performance
data — benchmark runs, comparisons, and flamegraphs — so you can investigate
regressions, explore profiling results, and review performance changes without
leaving your editor or chat interface.The server follows the
Model Context Protocol (MCP) specification
and is hosted by CodSpeed at
Once connected, you can ask your AI assistant questions like:
“Explain the regression on the feat/my-great-feature branch.”
“Make my foo_bar function faster.”
“What are the hottest functions in the bench_foo benchmark?”
“Analyze the flamegraph for bench_parse and refactor the hot path.”
“Compare the flamegraphs of bench_serialize between main and
feat/new-encoder and explain what changed.”
“Find the bottleneck in bench_api_handler and open a PR to fix it.”
Because the MCP server runs inside coding agents, your assistant can
cross-reference flamegraph hot spots with your actual source code — then
suggest or apply optimizations directly.
Inspect a single performance run and its benchmark results. Shows benchmark
names, identifiers, and values. Accepts a run ID, branch, or defaults to the
latest run.
Compare two performance runs and return a markdown performance report. Shows
benchmark-level comparisons including improvements, regressions, and new or
missing benchmarks. When the two runs ran in different environments (CPU, OS,
runtime version, linked libraries), an “Environment Differences” section is
added first.
Retrieve the full structured result of a single benchmark in a performance
run: the instrument metrics (wall-time distribution, simulated time breakdown,
or memory allocation breakdown), known issues, and whether a flamegraph is
available.
Query and summarize a flame graph from a performance run. Returns hot spots
(functions with highest self time), the call tree, and timing information for
each function.
# Flame Graph Summary---benchmark_name: write_events[1000000]runner_mode: Simulationbenchmark_total_time: 2.1 srun_id: 6a315367cef14236ed18cd7btruncated: yes---## Top 10 expensive functions (by self time)| Function | Origin | Calls | Self Time | Total Time || ----------------------------------------------------- | ---------- | ----: | ----------------: | ----------------: || `ZSTD_compressBlock_fast_extDict_generic.constprop.0` | Unknown | 2 | 468.5 ms (22.05%) | 572.8 ms (26.96%) || `Unknown symbol (0x188a80)` | Unknown | 12 | 244.8 ms (11.52%) | 244.8 ms (11.52%) || `ZSTD_encodeSequences_bmi2` | Unknown | 2 | 223.6 ms (10.52%) | 223.6 ms (10.52%) || `ZSTD_compressBlock_fast` | Unknown | 4 | 213.3 ms (10.04%) | 213.3 ms (10.04%) || `ZSTD_compressStream` | Unknown | 2 | 97.9 ms (4.61%) | 1.3 s (60.07%) || `rmp::encode::str::write_str` (src/encode/str.rs) | rmp@0.8.15 | 1 | 93.3 ms (4.39%) | 213 ms (10.03%) |## Most expensive calls (by total time)| Function | Origin | Self Time | Total Time || -------------------------------------------------------------------- | --------------- | --------------: | -------------: || `runner_shared::artifacts::memtrack::MemtrackWriter<W>::write_event` | User code | 32.5 ms (1.53%) | 2.1 s (99.80%) || `rmp_serde::encode::MaybeUnknownLengthCompound<W,C>::end` | rmp-serde@1.3.1 | 18.3 ms (0.86%) | 1.6 s (77.23%) || `zstd::stream::zio::writer::Writer<W,D>::write` | zstd@0.13.3 | 30.8 ms (1.45%) | 1.4 s (64.57%) |_…call tree, per-function details, and remaining hot spots omitted_> Call tree filtered: showing up to 25 entries with ≥1.00% of root function> total time. Re-query with `root_function_name` set to a function of interest> for deeper exploration.
The CodSpeed MCP server uses OAuth for authentication. When you first
connect, your MCP client will open a browser window where you log in to CodSpeed
and authorize access. The client stores the resulting token and refreshes it
automatically — no API keys to manage.
The MCP server has access to the same repositories and data as your CodSpeed
account.