Logo perfetto-mcp-rs

perfetto-mcp-rs

Tổ chức
tooluse-labs

Perfetto trace analysis via MCP — PerfettoSQL queries plus dedicated Chrome tools for scroll jank, page loads, and main-thread hotspots

Nhà phát hànhtooluse-labs
Kho mãperfetto-mcp-rs
Ngôn ngữRust
Bản fork
4
Sao
21
Công cụ có sẵn
0
Phương thức truyền tảistdio
Danh mục
Giấy phépApache-2.0
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    perfetto-mcp-rs cung cấp các chức năng MCP cho các ứng dụng khách AI và tác nhân AI tương thích.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Mẫu cấu hình có thể sao chép ngay

    Dùng các đoạn cấu hình mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Mức độ quan tâm của cộng đồng đến kho mã

    21 sao và 4 bản fork từ kho mã được liên kết.


perfetto-mcp-rs

An MCP server that lets LLMs analyze Perfetto traces. Point Claude Code (or any MCP client) at a trace file (.pftrace / .perfetto-trace / .bin / … — content-sniffed) and ask in plain language. The server runs PerfettoSQL under the hood, backed by trace_processor_shell — downloaded automatically on first run, no manual Perfetto install required.

Dedicated tools ship curated SQL; for custom analysis the agent writes PerfettoSQL — steered toward the right stdlib modules.

Quick start

You drive perfetto-mcp-rs through an MCP client (Claude Code, Claude Desktop, Codex, Cursor, …) — install one first if you don't have it.

1. Install — downloads the prebuilt binary and, if Claude Code and/or Codex are present, registers the MCP server automatically:

sh
# Linux / macOS / Windows (Git Bash, MSYS2, Cygwin)
curl -fsSL https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/install.sh | sh
powershell
# Windows (PowerShell)
irm https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/install.ps1 | iex

Restart Claude Code (or start a new Codex session) to pick it up. Homebrew, Cargo, project scope, direct-binary download, and manual registration are under Install options.

2. Ask in plain language:

Load ~/traces/scroll_jank.pftrace and tell me the top scroll-jank causes.

Swap in any Perfetto trace you have — captured from the Perfetto UI, chrome://tracing, or record_android_trace.

The agent calls load_trace, sees it's a Chrome trace, and reaches for the dedicated chrome_scroll_jank_summary tool — no SQL to hand-write. When a question falls outside the dedicated tools, it drops down to execute_sql with raw PerfettoSQL on the same trace.

Works best with agentic clients (Claude Code, Codex, Claude Desktop, Cursor) that chain multi-turn tool calls and follow the server's error-message nudges. Non-agentic clients see the same tools and error nudges, but won't chain the guided flow automatically.

Tools

For one trace, other tools act on the most recently loaded trace by default. For multiple traces, call load_trace with paths, keep the returned trace_id for each file, and pass the intended id to every trace-bound tool call.

MCP tool annotations are client-facing intent and safety hints, not server-side authorization or execution boundaries.

Essential

ToolPurpose
load_traceOpen one trace with path, or several with paths; returns an opaque trace_id and lightweight routing summary for each file (type/profile, duration, platform, process/thread counts, capabilities, redaction policy, recommended next tools)
execute_sqlRun a PerfettoSQL query (max 5000 returned rows). Prefer the dedicated chrome_* / list_* tools for standard analyses; use this for custom joins or aggregations they don't expose. Output shaping: head/limit, summary, columns_only, include_row_count, max_string_len. Sensitive URL/header/cookie/path values redacted by default

Exploration

ToolPurpose
list_tablesList tables/views in the loaded trace, optional GLOB filter
list_table_structureShow column names and types for a table
list_processesList processes (pid, name, start/end timestamps)
list_threads_in_processList threads under a process name (up to 2000)
slice_descendants_breakdownSummarize child slices under a long slice id without hand-writing recursive CTEs
list_stdlib_modulesList PerfettoSQL stdlib modules, optional domain / query / limit filters (no trace needed)

Chrome traces — dedicated tools so the agent doesn't hand-roll SQL. Each flags row/string truncation in its metadata.

ToolPurpose
chrome_scroll_jank_summaryWorst janky frames with cause, sub-cause, delay_since_last_frame
chrome_page_load_summaryPage loads: URL, raw boundary timestamps, FCP, LCP, DCL, load timings (ms)
chrome_page_load_resource_summaryCompact URL-level resource/request summary for page-load windows, ranked by max overlap with normalized origin, navigation/renderer relatedness, and attribution-scope evidence
chrome_page_load_resource_pipelineOne URL's lifecycle/request spans joined with background parse, script evaluation, and style/layout signals, plus an evidence boundary for DNS/TLS/TTFB/cache/download hypotheses
chrome_page_load_resource_hotspotsURL-bearing resource/request slices on thread, process, and async tracks ranked by page-load/window overlap, with process/thread identity where available
chrome_page_load_script_hotspotsRenderer main-thread script execution grouped by URL/slice/process within a page-load/window, with style/layout descendant signals
chrome_main_thread_hotspotsTop main-thread tasks by duration with ts, upid/pid, cpu_pct, and optional page-load/time-window filters
chrome_startup_summaryBrowser startup events and time-to-first-visible-content
chrome_web_content_interactionsWeb content interactions (clicks, taps, INP) ranked by duration

Resources

ResourcePurpose
resource://perfetto-mcp/stdlib-quickrefOn-demand PerfettoSQL stdlib quick reference for Chrome, Android, and generic traces

Analyzing a trace

The right path depends on the trace type:

  • Chrome traces — load_trace → dedicated chrome_* tools → execute_sql for deeper cuts on the returned rows. For slow FCP/load, check chrome_page_load_resource_summary first, then chrome_page_load_resource_pipeline for one slow URL or chrome_page_load_resource_hotspots for slice drilldown, before interpreting main-thread ResourceLoad* slices as full request time. The summary's resource_timing_evidence says whether DNS/TLS/TTFB/download/cache phase hints exist; keep conclusions at URL lifecycle-span level when phase breakdown is absent. Use chrome_page_load_script_hotspots for post-resource JS and style/layout work, and slice_descendants_breakdown on a long task id for its child-slice breakdown.
  • Other traces (Android, generic) — load_trace → list_stdlib_modules (or read resource://perfetto-mcp/stdlib-quickref) to check for a ready-made module first (Android, generic modules like slices.with_context), then run it via execute_sql + INCLUDE PERFETTO MODULE. No module fits? Fall back to list_tables / list_table_structure for schema discovery, then execute_sql.

Analyzing multiple traces

Load comparison targets together with load_trace(paths=[...]). The response returns one stable trace_id per file. Run the same trace-bound tool for each id (concurrently when the MCP client supports parallel tool calls), then compare the returned evidence. Calls without trace_id remain backward compatible and use the most recently loaded trace. If a loaded file changes on disk, its old id is rejected with an explicit instruction to reload it.

Privacy — tool results enter the LLM context, and real traces can hold URLs, headers, cookies, and local paths. execute_sql and the dedicated Chrome tools mask sensitive user and credential-like values by default while keeping the diagnostic structure visible. For raw forensic work, start the server with PERFETTO_MCP_REDACT_STRINGS_DEFAULT=false; load_trace reports the active policy in its summary.

Precision — dedicated Chrome tools preserve full string cells by default. Use max_string_len only when you explicitly want to trade detail for a smaller response.

Under the hood: dedicated tool vs. raw SQL

The scroll-jank question above resolves to a single chrome_scroll_jank_summary call — no SQL to write. When you need a cut the dedicated tools don't expose, the agent drops to execute_sql with PerfettoSQL; the same breakdown by hand:

sql
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;

Configuration

Server settings are read at startup; when both a CLI flag and environment variable exist, the CLI flag wins.

Setting (flag / env)DefaultEffect
PERFETTO_TP_PATH—Path to an existing trace_processor_shell binary; skips auto-download
--startup-timeout-ms / PERFETTO_STARTUP_TIMEOUT_MS20000Max time to wait for a spawned trace_processor_shell to become ready (ms)
--query-timeout-ms / PERFETTO_QUERY_TIMEOUT_MS30000HTTP timeout for /status and /query requests (ms)
--max-instances3Maximum idle trace_processor_shell processes retained in the LRU; active instances stay registered until their queries finish
--max-active-instances10Maximum active trace_processor_shell instances; requests for additional distinct traces wait for a semaphore permit
--span-timings / PERFETTO_MCP_SPAN_TIMINGSoffEmit tracing span-close timings for performance hotspot diagnosis (1 / true / yes / on)
--artifacts-base-url / PERFETTO_ARTIFACTS_BASE_URLLUCI bucketOverride the trace_processor_shell download source on a cache miss (mirror/proxy; same pinned version)
PERFETTO_MCP_REDACT_STRINGS_DEFAULTtrueMask sensitive URL/header/cookie/path strings in tool output; set false for raw forensic work
PERFETTO_MCP_FULL_TRACE_FINGERPRINToffUse full-file SHA-256 for trace cache identity instead of head/middle/tail sampling (1 / true / yes / on)
RUST_LOG—tracing-subscriber filter, e.g. RUST_LOG=debug for verbose logs (written to stderr)

Install options

Package managers — if you'd rather not run the install script:

sh
# macOS / Linux via Homebrew
brew tap tooluse-labs/tap
brew install perfetto-mcp-rs
# brew prints caveats; run the printed line to register with Claude Code / Codex:
perfetto-mcp-rs install --binary-path "$(brew --prefix)/bin/perfetto-mcp-rs"

# Rust developers via cargo
cargo install --locked perfetto-mcp-rs
perfetto-mcp-rs install --binary-path "$(which perfetto-mcp-rs)"

If Qoder is detected during a script install, the installer prints a paste-ready JSON snippet (Qoder has no programmatic MCP-registration API yet — open Qoder Settings → MCP → + Add and paste).

Claude scope — registration defaults to --scope user (available from any directory). For a project-local install, set SCOPE=local (or project) and run the script from that project's directory:

sh
SCOPE=local bash -c 'curl -fsSL https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/install.sh | sh'

PowerShell equivalent: $env:SCOPE = 'local'; irm ... | iex. Codex has no scope concept and ignores this variable.

Direct binary — supported platforms: linux amd64/arm64, macOS amd64/arm64, Windows amd64. Grab the binary from the releases page. Release assets are named perfetto-mcp-rs-<platform> (e.g. perfetto-mcp-rs-linux-amd64); rename or address the downloaded file explicitly when invoking install, and on Unix mark it executable first (chmod +x) — the subcommand refuses non-executable paths to avoid writing a broken MCP entry. Example:

sh
# Linux amd64 example — adjust the asset name for your platform.
curl -fsSL -o perfetto-mcp-rs \
  https://github.com/tooluse-labs/perfetto-mcp-rs/releases/latest/download/perfetto-mcp-rs-linux-amd64
chmod +x perfetto-mcp-rs
./perfetto-mcp-rs install --scope user --binary-path "$PWD/perfetto-mcp-rs"

Manual MCP client configuration — if the installer's auto-registration doesn't apply to your client.

Codex:

sh
codex mcp add perfetto-rs -- /absolute/path/to/perfetto-mcp-rs

JSON-based clients (e.g. Claude Code, Claude Desktop, Cursor):

json
{
  "mcpServers": {
    "perfetto-rs": {
      "command": "/absolute/path/to/perfetto-mcp-rs"
    }
  }
}

Upgrade & uninstall

Upgrade — run the update subcommand:

sh
perfetto-mcp-rs update

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. No auto-update daemon — upgrades are explicit.

Pin to a specific version with the --version flag:

sh
perfetto-mcp-rs update --version v0.7.0

For Claude local/project registrations, re-run from the original project directory and pass the same scope:

sh
perfetto-mcp-rs update --scope local

The raw installer one-liners still work if you prefer to drive upgrades manually or need installer-specific environment overrides.

The VERSION env var also works, but must come immediately before sh (POSIX VAR=value cmd only scopes to the next command — VERSION=v0.7.0 curl ... | sh puts VERSION on curl, not on the piped sh):

sh
curl -fsSL https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/install.sh | VERSION=v0.7.0 sh

PowerShell — set $env:VERSION in the same line, since iex runs in the current session:

powershell
$env:VERSION = 'v0.7.0'; irm https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/install.ps1 | iex

Check for updates:

sh
perfetto-mcp-rs check-update

Exits 0 if up to date (or ahead of releases — local dev build), 2 if a newer release exists, 1 on network or parse error. Useful for shell-prompt integrations and CI pre-checks. If it reports a newer release, run perfetto-mcp-rs update.

Uninstall — symmetric one-liner per platform. Deregisters from Claude Code and Codex, removes the binary, and deletes the cached trace_processor_shell. Idempotent — safe to run if any step was already done by hand.

sh
# Linux / macOS / Windows (Git Bash, MSYS2, Cygwin)
curl -fsSL https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/uninstall.sh | sh
powershell
# Windows (PowerShell) — close Claude Code, Codex, or anything else using the .exe first
irm https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/uninstall.ps1 | iex

Scoped installs (local / project) — claude stores local/project entries keyed by project directory, so uninstall must use the same SCOPE AND run from that directory. Omitting this leaves the scoped Claude entry behind while the wrapper still removes the binary and cache:

sh
# Ran `SCOPE=local bash install.sh` in ~/work/foo earlier? Then:
cd ~/work/foo
SCOPE=local bash -c 'curl -fsSL https://raw.githubusercontent.com/tooluse-labs/perfetto-mcp-rs/main/uninstall.sh | sh'

PowerShell equivalent: cd <original-project-dir>; $env:SCOPE = 'local'; irm ... | iex.

$INSTALL_DIR (default ~/.local/bin) is not removed from your PATH:

  • Linux / macOS — the installer only prints a PATH hint; if you added it to your shell rc, remove that line manually.
  • Windows — the installer writes $INSTALL_DIR into your user PATH (HKCU\Environment); remove it via System Properties → Environment Variables if you want it gone.

Other tools may still depend on this directory, which is why uninstall leaves it in place.

Build from source

Requires a Rust toolchain and protoc (Protocol Buffers compiler):

sh
# Ubuntu/Debian
sudo apt install -y protobuf-compiler
# macOS
brew install protobuf
# Windows
choco install protoc

Then:

sh
git clone https://github.com/tooluse-labs/perfetto-mcp-rs
cd perfetto-mcp-rs
cargo build --release
# Binary at target/release/perfetto-mcp-rs

Development:

sh
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.

Cài đặt

TypingMind
Yêu cầu:

Node.js 18+

{
  "mcpServers": {
    "tooluse-labs-perfetto-mcp-rs": {
      "command": "",
      "args": []
    }
  }
}

Dùng MCP perfetto-mcp-rs với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối perfetto-mcp-rs, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này chạy cục bộ thông qua trình kết nối MCP của TypingMind trên thiết bị của bạn.

Hướng dẫn thiết lập để dùng trình kết nối cục bộ

Dùng cách này khi máy chủ MCP cần truy cập các tệp, ứng dụng hoặc tài nguyên riêng tư trên máy tính của bạn.

1

Mở cài đặt MCP

Trong TypingMind, vào Cài đặt, Cài đặt nâng cao, rồi đến Giao thức ngữ cảnh mô hình và chọn Thiết lập trình kết nối.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Nhấp vào biểu tượng Cài đặt.
  3. Vào Cài đặt nâng cao.
  4. Mở mục Giao thức ngữ cảnh mô hình.
  5. Nhấp vào Thiết lập trình kết nối rồi chọn Thiết bị này.
Màn hình thiết lập trình kết nối MCP của TypingMind với tùy chọn Thiết bị này được chọn
2

Chạy lệnh thiết lập trình kết nối

Chọn Thiết bị này, sao chép lệnh từ TypingMind và chạy trong Terminal. Để tiến trình tiếp tục chạy trong khi bạn dùng MCP.

  1. Sao chép lệnh thiết lập hiển thị trong TypingMind.
  2. Mở Terminal trên macOS hoặc Windows Terminal trên Windows.
  3. Dán và chạy lệnh.
  4. Xác nhận cài đặt gói nếu Terminal hỏi bạn có muốn tiếp tục không.
  5. Để tiến trình tiếp tục chạy trong cửa sổ Terminal khi bạn dùng các công cụ MCP.
3

Thêm perfetto-mcp-rs làm máy chủ

Khi trạng thái trình kết nối là Sẵn sàng, nhấp vào Sửa máy chủ và dán cấu hình máy chủ MCP.

  1. Đợi đến khi trạng thái trình kết nối hiển thị Sẵn sàng.
  2. Nhấp vào Sửa máy chủ.
  3. Dán cấu hình máy chủ MCP của perfetto-mcp-rs.
  4. Lưu danh sách máy chủ.
  5. Làm mới nếu bạn muốn xác nhận trình kết nối vẫn sẵn sàng.
Cài đặt MCP của TypingMind hiển thị máy chủ đang hoạt động và nút Sửa máy chủ
{
  "mcpServers": {
    "tooluse-labs-perfetto-mcp-rs": {
      "command": "npx",
      "args": [
        "-y",
        "perfetto-mcp-rs"
      ]
    }
  }
}
4

Dùng kết nối với nhiều mô hình

Lưu danh sách máy chủ, mở Plugin, bật các công cụ MCP của perfetto-mcp-rs, sau đó chọn bất kỳ mô hình AI nào được hỗ trợ trong TypingMind và dùng các công cụ trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.

  1. Mở trang Plugin trong TypingMind.
  2. Bật các công cụ MCP của perfetto-mcp-rs.
  3. Bắt đầu cuộc trò chuyện và chọn mô hình AI bạn muốn dùng.
  4. Dùng các công cụ MCP trong cuộc trò chuyện hoặc gán chúng cho một tác nhân AI.
  5. Chuyển sang mô hình AI khác bất cứ khi nào cần mà không phải kết nối lại MCP.
Cuộc trò chuyện trên TypingMind dùng các công cụ MCP đã bật với mô hình AI đã chọn
Bạn có thể dùng perfetto-mcp-rs giúp tôi làm việc này không?
perfetto-mcp-rs
Được. Tôi đọc rồi.
Đây là kết quả tôi tìm được bằng perfetto-mcp-rs.

Câu hỏi thường gặp

Máy chủ MCP perfetto-mcp-rs dùng để làm gì?

perfetto-mcp-rs là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP perfetto-mcp-rs với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng perfetto-mcp-rs với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP perfetto-mcp-rs với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối perfetto-mcp-rs, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP perfetto-mcp-rs với TypingMind?

perfetto-mcp-rs hoạt động thông qua trình kết nối MCP cục bộ của TypingMind. Đây là lựa chọn phù hợp nhất khi máy chủ MCP cần truy cập tệp cục bộ, ứng dụng máy tính, công cụ dòng lệnh hoặc tài nguyên riêng trên máy tính của bạn.

MCP perfetto-mcp-rs cung cấp những công cụ nào trong TypingMind?

perfetto-mcp-rs cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP perfetto-mcp-rs không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu perfetto-mcp-rs yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇