Perfetto Trace Analyzer logo

Perfetto Trace Analyzer

Community
antarikshc

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

Publisherantarikshc
Repositoryperfetto-mcp
LanguagePython
Forks
26
Stars
176
Available tools
0
Transport typestdio
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    Perfetto Trace Analyzer exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    176 stars and 26 forks from the linked repository.

showcase

Perfetto MCP

Turn natural language into powerful Perfetto trace analysis

A Model Context Protocol (MCP) server that transforms natural-language prompts into focused Perfetto analyses. Quickly explain jank, diagnose ANRs, spot CPU hot threads, uncover lock contention, and find memory leaks – all without writing SQL.

✨ Features

  • Natural Language → SQL: Ask questions in plain English, get precise Perfetto queries
  • ANR Detection: Automatically identify and analyze Application Not Responding events
  • Performance Analysis: CPU profiling, frame jank detection, memory leak detection
  • Thread Contention: Find synchronization bottlenecks and lock contention
  • Binder Profiling: Analyze IPC performance and slow system interactions

showcase

📋 Prerequisites

  • Python 3.13+ (macOS/Homebrew):
    bash
    brew install python@3.13
  • uv (recommended):
    bash
    brew install uv

🚀 Getting Started

Install MCP Server

Or add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

json
{
  "mcpServers": {
    "perfetto-mcp": {
      "command": "uvx",
      "args": ["perfetto-mcp"]
    }
  }
}

Run this command. See Claude Code MCP docs for more info.

bash
# Add to user scope
claude mcp add perfetto-mcp --scope user -- uvx perfetto-mcp

Or edit ~/claude.json (macOS) or %APPDATA%\Claude\claude.json (Windows):

json
{
  "mcpServers": {
    "perfetto-mcp": {
      "command": "uvx",
      "args": ["perfetto-mcp"]
    }
  }
}

or add to .vscode/mcp.json (project) or run "MCP: Add Server" command:

json
{
  "mcpServers": {
    "perfetto-mcp": {
      "command": "uvx",
      "args": ["perfetto-mcp"]
    }
  }
}

Enable in GitHub Copilot Chat's Agent mode.

Edit ~/.codex/config.toml:

toml
[mcp_servers.perfetto-mcp]
command = "uvx"
args = ["perfetto-mcp"]

Optional: Use a Local trace_processor_shell Binary

If your network environment blocks downloads, set PERFETTO_MCP_TRACE_PROCESSOR_BIN_PATH to an absolute path of a local trace_processor_shell binary.

When this env var is set, perfetto-mcp uses that binary directly. When it is not set, default perfetto Python behavior is unchanged.

Example (mcp.json):

json
{
  "mcpServers": {
    "perfetto-mcp": {
      "command": "uvx",
      "args": ["perfetto-mcp"],
      "env": {
        "PERFETTO_MCP_TRACE_PROCESSOR_BIN_PATH": "D:/tools/perfetto/trace_processor_shell.exe"
      }
    }
  }
}

Example (~/.codex/config.toml):

toml
[mcp_servers.perfetto-mcp]
command = "uvx"
args = ["perfetto-mcp"]
[mcp_servers.perfetto-mcp.env]
PERFETTO_MCP_TRACE_PROCESSOR_BIN_PATH = "D:/tools/perfetto/trace_processor_shell.exe"

Local Install (development server)

bash
cd perfetto-mcp-server
uv sync
uv run mcp dev src/perfetto_mcp/dev.py
json
{
  "mcpServers": {
    "perfetto-mcp-local": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/git/repo/perfetto-mcp",
        "run",
        "-m",
        "perfetto_mcp"
      ],
      "env": { "PYTHONPATH": "src" }
    }
  }
}
bash
pip3 install perfetto-mcp
python3 -m perfetto_mcp

📖 How to Use

Example starting prompt:

In the perfetto trace, I see that the FragmentManager is taking 438ms to execute. Can you figure out why it's taking so long?

Required Parameters

Every tool needs these two inputs:

ParameterDescriptionExample
trace_pathAbsolute path to your Perfetto trace/path/to/trace.perfetto-trace
process_nameTarget process/app namecom.example.app

In Your Prompts

Be explicit about the trace and process, prefix your prompt with:

"Use perfetto trace /absolute/path/to/trace.perfetto-trace for process com.example.app"

Optional Filters

Many tools support additional filtering (but let your LLM handle that):

  • time_range: {start_ms: 10000, end_ms: 25000}
  • Tool-specific thresholds: min_block_ms, jank_threshold_ms, limit

🛠️ Available Tools

🔎 Exploration & Discovery

ToolPurposeExample Prompt
find_slicesSurvey slice names and locate hot paths"Find slice names containing 'Choreographer' and show top examples"
execute_sql_queryRun custom PerfettoSQL for advanced analysis"Run custom SQL to correlate threads and frames in the first 30s"

🚨 ANR Analysis

Note: Helpful if the recorded trace contains ANR

ToolPurposeExample Prompt
detect_anrsFind ANR events with severity classification"Detect ANRs in the first 10s and summarize severity"
anr_root_cause_analyzerDeep-dive ANR causes with ranked likelihood"Analyze ANR root cause around 20,000 ms and rank likely causes"

🎯 Performance Profiling

ToolPurposeExample Prompt
cpu_utilization_profilerThread-level CPU usage and scheduling"Profile CPU usage by thread and flag the hottest threads"
main_thread_hotspot_slicesFind longest-running main thread operations"List main-thread hotspots >50 ms during 10s–25s"

📱 UI Performance

ToolPurposeExample Prompt
detect_jank_framesIdentify frames missing deadlines"Find janky frames above 16.67 ms and list the worst 20"
frame_performance_summaryOverall frame health metrics"Summarize frame performance and report jank rate and P99 CPU time"

🔒 Concurrency & IPC

ToolPurposeExample Prompt
thread_contention_analyzerFind synchronization bottlenecks"Find lock contention between 15s–30s and show worst waits"
binder_transaction_profilerAnalyze Binder IPC performance"Profile slow Binder transactions and group by server process"

💾 Memory Analysis

ToolPurposeExample Prompt
memory_leak_detectorFind sustained memory growth patterns"Detect memory-leak signals over the last 60s"
heap_dominator_tree_analyzerIdentify memory-hogging classes"Analyze heap dominator classes and list top offenders"

Output Format

All tools return structured JSON with:

  • Summary: High-level findings
  • Details: Tool-specific results
  • Metadata: Execution context and any fallbacks used

📚 Resources

📄 License

Apache 2.0 License. See LICENSE for details.


Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "perfetto-mcp": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ]
    }
  }
}

Use Perfetto Trace Analyzer MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Perfetto Trace Analyzer is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Perfetto Trace Analyzer as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Perfetto Trace Analyzer MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "perfetto-trace-analyzer": {
      "command": "npx",
      "args": [
        "-y",
        "perfetto-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Perfetto Trace Analyzer MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Perfetto Trace Analyzer MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Perfetto Trace Analyzer to help me with this task?
Perfetto Trace Analyzer
Sure. I read it.
Here is what I found using Perfetto Trace Analyzer.

Frequently asked questions

What is the Perfetto Trace Analyzer MCP server used for?

Perfetto Trace Analyzer is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Perfetto Trace Analyzer MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Perfetto Trace Analyzer with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Perfetto Trace Analyzer MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Perfetto Trace Analyzer connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Perfetto Trace Analyzer MCP to TypingMind?

Perfetto Trace Analyzer runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Perfetto Trace Analyzer MCP provide in TypingMind?

Perfetto Trace Analyzer exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Perfetto Trace Analyzer MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Perfetto Trace Analyzer requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇