/ Directorio / Playground / perfetto-mcp
● Comunidad antarikshc ⚡ Instantáneo

perfetto-mcp

por antarikshc · antarikshc/perfetto-mcp

Ask plain-English questions of a Perfetto trace — jank, ANRs, CPU hot threads, lock contention, memory leaks — and get answers without writing trace SQL.

perfetto-mcp runs Perfetto's trace processor under the hood and exposes natural-language tools that translate your questions into focused queries. Covers the usual Android/Linux performance investigation categories: slice exploration, ANR detection, CPU/thread profiling, concurrency issues, heap analysis.

Por qué usarlo

Características clave

Demo en vivo

Cómo se ve en la práctica

perfetto.replay ▶ listo
0/0

Instalar

Elige tu cliente

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "perfetto": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ],
      "_inferred": true
    }
  }
}

Abre Claude Desktop → Settings → Developer → Edit Config. Reinicia después de guardar.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "perfetto": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ],
      "_inferred": true
    }
  }
}

Cursor usa el mismo esquema mcpServers que Claude Desktop. La configuración del proyecto prevalece sobre la global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "perfetto": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ],
      "_inferred": true
    }
  }
}

Haz clic en el icono MCP Servers de la barra lateral de Cline y luego en "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "perfetto": {
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ],
      "_inferred": true
    }
  }
}

Mismo formato que Claude Desktop. Reinicia Windsurf para aplicar.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "perfetto",
      "command": "uvx",
      "args": [
        "perfetto-mcp"
      ]
    }
  ]
}

Continue usa un array de objetos de servidor en lugar de un mapa.

~/.config/zed/settings.json
{
  "context_servers": {
    "perfetto": {
      "command": {
        "path": "uvx",
        "args": [
          "perfetto-mcp"
        ]
      }
    }
  }
}

Añádelo a context_servers. Zed recarga en caliente al guardar.

claude mcp add perfetto -- uvx perfetto-mcp

Un solo comando. Verifica con claude mcp list. Quita con claude mcp remove.

Casos de uso

Usos del mundo real: perfetto-mcp

Find the cause of UI jank in a recorded trace

👤 Android devs, perf engineers ⏱ ~25 min advanced

Cuándo usarlo: User report: 'the app stutters when I scroll'. You captured a Perfetto trace. Now what?

Requisitos previos
  • Perfetto .pftrace file — perfetto / systrace / Android Studio Profiler
Flujo
  1. Point MCP at the trace
    Open /tmp/jank.pftrace for process com.example.app. Find jank frames — anything over 16.67ms on the main thread.✓ Copiado
    → List of janky frames with slice context
  2. Attribute the cause
    For the top 3 janky frames, what slice dominated? What was the main thread doing when the frame missed?✓ Copiado
    → Cause per frame
  3. Propose fix
    Based on these bottlenecks, suggest concrete changes (move off main, cache, etc.).✓ Copiado
    → Fix plan

Resultado: Jank root cause identified without staring at the timeline UI.

Errores comunes
  • Sample interval too coarse — missing short hot methods — Re-record with higher sampling frequency when needed

Diagnose an ANR from a trace

👤 Android devs dealing with ANRs ⏱ ~20 min advanced

Cuándo usarlo: Production ANR and you can capture a trace.

Flujo
  1. Detect
    Run ANR analysis on /traces/anr.pftrace for process com.example.app. What blocked the main thread?✓ Copiado
    → Blocking chain
  2. Identify lock
    Was this a lock contention? Identify holder vs waiter threads and the resource.✓ Copiado
    → Contention diagram

Resultado: ANR root cause + whom to wake up on-call.

Hunt a suspected memory leak

👤 Android / native devs ⏱ ~30 min advanced

Cuándo usarlo: Heap keeps growing over time on a given screen.

Flujo
  1. Analyze heap
    For trace X, process Y: run memory analysis. What allocations dominate and does the retained set grow monotonically?✓ Copiado
    → Allocation summary + trend
  2. Correlate
    What activities / fragments / slices correlate with growth spikes?✓ Copiado
    → Correlation report

Resultado: Leak suspects identified.

Errores comunes
  • GC hasn't run yet — growth isn't necessarily leak — Trigger GC between recordings; compare

Combinaciones

Combínalo con otros MCPs para multiplicar por 10

perfetto + filesystem

Save per-release trace analysis for regression tracking

Analyze jank trace for vX.Y.Z and save summary to /perf-reports/vX.Y.Z.md.✓ Copiado

Herramientas

Lo que expone este MCP

HerramientaEntradasCuándo llamarCoste
explore_slices trace_path, process, time_range? Get your bearings in a new trace free
detect_anr trace_path, process ANR investigation free
cpu_profile trace_path, process, threshold_ms? CPU hotspot hunt free
thread_contention trace_path, process Concurrency issues free
memory_analysis trace_path, process Memory investigations free
custom_sql trace_path, sql: str You know the exact Perfetto SQL you want free

Coste y límites

Lo que cuesta ejecutarlo

Cuota de API
None (local)
Tokens por llamada
Trace summaries 2k-10k tokens typically
Monetario
Free (Apache 2.0)
Consejo
Always pass a time range if you know roughly when the issue occurred — slashes query time and tokens.

Seguridad

Permisos, secretos, alcance

Almacenamiento de credenciales: None; local trace files
Salida de datos: Summaries go to your LLM provider — traces can include sensitive process/app names

Resolución de problemas

Errores comunes y soluciones

Trace file too large to parse

Perfetto can handle GB-scale traces but first call can be slow. Give it time; subsequent queries are faster.

Process name not found

Verify with custom_sql SELECT name FROM process. Process names can differ from app package IDs.

Python version error

Needs 3.13+. Use uv python install 3.13 then uvx perfetto-mcp.

Verificar: python --version

Alternativas

perfetto-mcp vs otros

AlternativaCuándo usarlaContrapartida
Perfetto UI (ui.perfetto.dev)You want visual timeline analysisManual; no LLM explanations
Android Studio ProfilerYou live inside Android StudioIDE-bound; less scriptable

Más

Recursos

📖 Lee el README oficial en GitHub

🐙 Ver issues abiertas

🔍 Ver todos los 400+ servidores MCP y Skills