/ 디렉터리 / 플레이그라운드 / perfetto-mcp
● 커뮤니티 antarikshc ⚡ 바로 사용

perfetto-mcp

제작: 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.

왜 쓰나요

핵심 기능

라이브 데모

실제 사용 모습

perfetto.replay ▶ 준비됨
0/0

설치

클라이언트 선택

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

Claude Desktop → Settings → Developer → Edit Config 열기. 저장 후 앱 재시작.

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

Cursor는 Claude Desktop과 동일한 mcpServers 스키마 사용. 프로젝트 설정이 전역보다 우선.

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

Cline 사이드바의 MCP Servers 아이콘 클릭 후 "Edit Configuration" 선택.

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

Claude Desktop과 같은 형식. Windsurf 재시작 후 적용.

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

Continue는 맵이 아닌 서버 오브젝트 배열 사용.

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

context_servers에 추가. 저장 시 Zed가 핫 리로드.

claude mcp add perfetto -- uvx perfetto-mcp

한 줄 명령. claude mcp list로 확인, claude mcp remove로 제거.

사용 사례

실전 활용법: perfetto-mcp

Find the cause of UI jank in a recorded trace

👤 Android devs, perf engineers ⏱ ~25 min advanced

언제 쓸까: User report: 'the app stutters when I scroll'. You captured a Perfetto trace. Now what?

사전 조건
  • Perfetto .pftrace file — perfetto / systrace / Android Studio Profiler
흐름
  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.✓ 복사됨
    → 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?✓ 복사됨
    → Cause per frame
  3. Propose fix
    Based on these bottlenecks, suggest concrete changes (move off main, cache, etc.).✓ 복사됨
    → Fix plan

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

함정
  • 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

언제 쓸까: Production ANR and you can capture a trace.

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

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

Hunt a suspected memory leak

👤 Android / native devs ⏱ ~30 min advanced

언제 쓸까: Heap keeps growing over time on a given screen.

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

결과: Leak suspects identified.

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

조합

다른 MCP와 조합해 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.✓ 복사됨

도구

이 MCP가 노출하는 것

도구입력언제 호출비용
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

비용 및 제한

운영 비용

API 쿼터
None (local)
호출당 토큰
Trace summaries 2k-10k tokens typically
금액
Free (Apache 2.0)
Always pass a time range if you know roughly when the issue occurred — slashes query time and tokens.

보안

권한, 시크릿, 파급범위

자격 증명 저장: None; local trace files
데이터 외부 송신: Summaries go to your LLM provider — traces can include sensitive process/app names

문제 해결

자주 발생하는 오류와 해결

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.

확인: python --version

대안

perfetto-mcp 다른 것과 비교

대안언제 쓰나단점/장점
Perfetto UI (ui.perfetto.dev)You want visual timeline analysisManual; no LLM explanations
Android Studio ProfilerYou live inside Android StudioIDE-bound; less scriptable

더 보기

리소스

📖 GitHub에서 공식 README 읽기

🐙 열린 이슈 보기

🔍 400+ MCP 서버 및 Skills 전체 보기