home / mcp / perfetto mcp server

Perfetto MCP Server

This is a Model Context Protocol (MCP) server that gets answers from your Perfetto Traces. It turns natural‑language prompts into focused Perfetto analyses.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "antarikshc-perfetto-mcp": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ],
      "env": {
        "PYTHONPATH": "src"
      }
    }
  }
}

Perfetto MCP Server turns natural-language prompts into focused Perfetto analyses, enabling you to ask in plain language for ANR detection, CPU profiling, jank insights, memory leak clues, and thread contention results without writing SQL. It helps you quickly diagnose performance issues directly from Perfetto traces and share findings with your team.

How to use

To start analyzing Perfetto traces, you interact with an MCP client and point it at a trace file and target process. You should clearly specify the trace path and the process name in your prompts to ensure the analysis runs on the correct data.

Example prompt structure you can use in your client: Use perfetto trace \/absolute\/path\/to\/trace.perfetto-trace for process \\com.example.app\\``. This makes the tool fetch the right trace and focus the analysis on the specified process.

Optional filters

You can refine analyses with additional filters. Provide a time range and any thresholds your analysis should respect.

  • time_range: {start_ms: 10000, end_ms: 25000}
  • min_block_ms: 5
  • jank_threshold_ms: 16.67
  • limit: 20

Available tools

find_slices

Survey available trace slices to identify hot paths and map them to meaningful sections in your Perfetto trace.

execute_sql_query

Run custom PerfettoSQL queries to correlate threads, frames, and events for advanced analysis.

detect_anrs

Locate ANR events within the trace and classify their severity for quick triage.

anr_root_cause_analyzer

Deep-dive ANR causes with ranked likelihoods to help pinpoint root issues.

cpu_utilization_profiler

Profile CPU usage by thread and identify hottest threads and scheduling patterns.

main_thread_hotspot_slices

List long-running main-thread operations to uncover UI or app slow paths.

detect_jank_frames

Identify frames that miss deadlines and surface the worst offenders.

frame_performance_summary

Provide an overview of frame health, including jank rate and P99 CPU time.

thread_contention_analyzer

Find synchronization bottlenecks and show the worst waits across time ranges.

binder_transaction_profiler

Analyze Binder IPC performance to highlight slow interactions.

memory_leak_detector

Detect patterns of sustained memory growth and leaks over a window.

heap_dominator_tree_analyzer

Identify memory-hogging classes by analyzing heap dominators and top offenders.