perfetto-mcp-rs
MCP server for analyzing Perfetto traces with LLMs — query .pftrace files in PerfettoSQL via Claude Code or any MCP client
README
<p align="center"> <img src="assets/brand/logo-wordmark.svg" width="820" alt="perfetto-mcp-rs logo"> </p>
perfetto-mcp-rs
English | 简体中文
An MCP server for analyzing
Perfetto traces with LLMs. Point Claude Code (or any
MCP client) at a .perfetto-trace / .pftrace file and query it with
PerfettoSQL.
Backed by trace_processor_shell — downloaded automatically on first run, no
manual Perfetto install required.
Works best with agentic MCP clients (Claude Code, Codex, Claude Desktop, Cursor)
that can chain multi-turn tool calls. Non-agentic clients will see the same
tools but won't be able to follow the error-message nudges that steer the
LLM through the typical load_trace → list_tables → list_table_structure →
execute_sql flow.
Navigate agents toward the right PerfettoSQL stdlib modules — the analysis SQL is always the agent's own.
Quick install
Linux / macOS / Windows (Git Bash, MSYS2, Cygwin):
curl -fsSL https://raw.githubusercontent.com/0xZOne/perfetto-mcp-rs/main/install.sh | sh
Windows (PowerShell):
irm https://raw.githubusercontent.com/0xZOne/perfetto-mcp-rs/main/install.ps1 | iex
Both installers drop the prebuilt binary into ~/.local/bin (or
%USERPROFILE%\.local\bin on Windows), add it to your user PATH if needed,
and — if Claude Code and/or Codex are installed — register it automatically.
Restart Claude Code or start a new Codex session to pick it up.
Supported platforms: linux amd64/arm64, macOS amd64/arm64, Windows amd64. If you'd rather not run a script, grab the binary directly from the releases page.
Upgrade
Re-run the same install command — it pulls the latest release, safely overwrites the existing binary (with Windows file-lock retry), and re-registers the MCP server with Claude Code / Codex idempotently.
Pin to a specific version with the VERSION env var:
VERSION=v0.7.0 curl -fsSL https://raw.githubusercontent.com/0xZOne/perfetto-mcp-rs/main/install.sh | sh
No auto-update daemon — upgrades are explicit.
Uninstall
One-liner per platform. Unregisters the MCP server from Claude Code and Codex,
removes the binary, and deletes the cached trace_processor_shell.
Linux:
if command -v claude >/dev/null 2>&1; then claude mcp remove perfetto-mcp-rs --scope user 2>/dev/null; fi; if command -v codex >/dev/null 2>&1; then codex mcp remove perfetto-mcp-rs 2>/dev/null; fi; rm -f ~/.local/bin/perfetto-mcp-rs; rm -rf ~/.local/share/perfetto-mcp-rs
macOS:
if command -v claude >/dev/null 2>&1; then claude mcp remove perfetto-mcp-rs --scope user 2>/dev/null; fi; if command -v codex >/dev/null 2>&1; then codex mcp remove perfetto-mcp-rs 2>/dev/null; fi; rm -f ~/.local/bin/perfetto-mcp-rs; rm -rf "$HOME/Library/Application Support/perfetto-mcp-rs"
Windows (PowerShell) — close Claude Code, Codex, or anything else using the .exe first:
if (Get-Command claude -ErrorAction SilentlyContinue) { claude mcp remove perfetto-mcp-rs --scope user 2>$null }; if (Get-Command codex -ErrorAction SilentlyContinue) { codex mcp remove perfetto-mcp-rs 2>$null }; Remove-Item -Force "$HOME\.local\bin\perfetto-mcp-rs.exe*" -ErrorAction SilentlyContinue; Remove-Item -Recurse -Force "$env:LOCALAPPDATA\perfetto-mcp-rs" -ErrorAction SilentlyContinue
Tools
| Tool | Purpose |
|---|---|
load_trace |
Open a .perfetto-trace / .pftrace file (must be called first) |
list_tables |
List tables/views in the loaded trace, optional GLOB filter |
list_table_structure |
Show column names and types for a table |
execute_sql |
Run a PerfettoSQL query, returns JSON rows (max 5000) |
list_processes |
List processes in the trace (pid, name, start/end timestamps) |
list_threads_in_process |
List threads under a process name (up to 2000) |
chrome_scroll_jank_summary |
Worst janky frames with cause, sub-cause, delay_since_last_frame (Chrome trace) |
chrome_page_load_summary |
Page loads: URL, FCP, LCP, DCL, load timings in ms (Chrome trace) |
chrome_main_thread_hotspots |
Top main-thread tasks by duration with cpu_pct, uses is_main_thread (Chrome trace) |
chrome_startup_summary |
Browser startup events and time-to-first-visible-content (Chrome trace) |
chrome_web_content_interactions |
Web content interactions (clicks, taps, INP) ranked by duration (Chrome trace) |
list_stdlib_modules |
List available PerfettoSQL stdlib modules with usage examples (no trace needed) |
Typical flow depends on trace type:
- Chrome traces:
load_trace→ dedicatedchrome_*tools (chrome_scroll_jank_summary,chrome_page_load_summary,chrome_main_thread_hotspots,chrome_startup_summary,chrome_web_content_interactions) →execute_sqlfor deeper analysis on the returned rows. - Other traces:
load_trace→list_tables/list_table_structurefor schema discovery →execute_sqlfor queries. Calllist_stdlib_modulesas an auxiliary when stdlib modules might cover your analysis (Android, generic modules likeslices.with_context).
Example
Ask Claude Code or Codex something like:
Load
~/traces/scroll_jank.pftraceand tell me the top scroll jank causes.
Claude will call load_trace, then issue a query like:
INCLUDE PERFETTO MODULE chrome.scroll_jank.scroll_jank_v3;
SELECT cause_of_jank, COUNT(*) AS n
FROM chrome_janky_frames
GROUP BY cause_of_jank
ORDER BY n DESC;
Manual MCP client configuration
If the installer's auto-registration doesn't apply to your client:
Codex:
codex mcp add perfetto-mcp-rs -- /absolute/path/to/perfetto-mcp-rs
JSON-based clients (e.g. Claude Code, Claude Desktop, Cursor):
{
"mcpServers": {
"perfetto-mcp-rs": {
"command": "/absolute/path/to/perfetto-mcp-rs"
}
}
}
Configuration
| Variable | Effect |
|---|---|
PERFETTO_TP_PATH |
Path to an existing trace_processor_shell binary; skips auto-download |
PERFETTO_STARTUP_TIMEOUT_MS |
Overrides the trace_processor_shell startup timeout in milliseconds |
PERFETTO_QUERY_TIMEOUT_MS |
Overrides the HTTP status/query timeout in milliseconds |
RUST_LOG |
tracing-subscriber filter, e.g. RUST_LOG=debug for verbose logs (written to stderr) |
CLI flags:
| Flag | Default | Description |
|---|---|---|
--max-instances |
3 | Maximum cached trace_processor_shell processes (LRU-evicted) |
--startup-timeout-ms |
5000 | Max time to wait for a spawned trace_processor_shell to become ready |
--query-timeout-ms |
30000 | HTTP timeout for /status and /query requests |
Build from source
Requires a Rust toolchain and protoc (Protocol Buffers compiler):
# Ubuntu/Debian
sudo apt install -y protobuf-compiler
# macOS
brew install protobuf
# Windows
choco install protoc
Then:
git clone https://github.com/0xZOne/perfetto-mcp-rs
cd perfetto-mcp-rs
cargo build --release
# Binary at target/release/perfetto-mcp-rs
Development
cargo test # unit tests
cargo clippy # lint
cargo fmt # format
License
Dual-licensed under either of Apache License, Version 2.0 or MIT license at your option. Contributions are accepted under the same terms.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。