Skip to main content
Glama
shin0112
by shin0112

unity-profiler-mcp

MCP server for analyzing saved Unity Profiler captures. An AI client (Claude Code, etc.) can list captures, summarize frame times, find the most expensive main-thread markers, and compare groups of captures marker by marker (e.g. 3 runs of branch A vs 3 runs of branch B) — instead of reading Profiler screenshots by hand.

Two parts:

Part

Path

Role

MCP server (Node, stdio)

server/

Tools below; reads .highlights and exported marker JSON, computes summaries and comparisons

Unity bridge (UPM, Editor-only)

unity-package/

Local HTTP listener on 127.0.0.1 that loads a .data capture with ProfilerDriver and exports per-marker statistics

.data captures can only be read by the Unity Editor, so marker statistics need the editor open. profiler_summary works without the editor (it reads the .highlights file the Profiler saves next to each capture).

Tools

Tool

Input

Result

profiler_list_captures

folder?

captures with size, time, hasHighlights, hasMarkers

profiler_summary

capture, folder?

estimated CPU/GPU frame time (p50/p95/p99/max, % over 16.7 / 33.3 ms) and main-thread frame time if exported

profiler_export

capture, folder?, force?

editor exports <capture>.data.markers.json

profiler_top_markers

capture, limit?, sortBy? (avg,p95,spikeAvg,selfAvg,gcBytesAvg), maxDepth?, contains?

most expensive markers; exports first if needed

profiler_compare

a[], b[], limit?, sortBy? (avg,p95,spikeAvg), maxDepth?, contains?

per-marker group means, delta, run-to-run spread, beyondSpread flag

capture is a file name inside the capture folder (with or without .data) or an absolute path. The capture folder defaults to UNITY_PROFILER_CAPTURES, then <project>/ProfilerCaptures of the open editor.

Marker export

  • Main thread only, samples merged by name, hierarchy depth ≤ 8, markers averaging under 0.005 ms dropped.

  • Per marker: frames present, total ms avg / p50 / p95 / max, spikeAvg (average over the slowest 5% of frames), selfAvg, callsAvg, gcBytesAvg.

  • Exporting loads the capture into the Profiler window (replacing what is shown) and blocks the editor while it runs; large captures take a while. Results are cached next to the capture.

.highlights

The frame-time series are decoded from the .highlights file the Profiler writes on save. The layout is undocumented; series 0/1 are assumed to be CPU/GPU frame time and are labelled cpuMsEstimated / gpuMsEstimated. Check them against the Profiler's Highlights module before relying on them.

Related MCP server: renderdoc-mcp

Install

1. Unity package

Add to Packages/manifest.json:

"com.shin0112.unity-profiler-mcp": "https://github.com/shin0112/unity-profiler-mcp.git?path=/unity-package"

or, for a local clone:

"com.shin0112.unity-profiler-mcp": "file:C:/projects/unity-profiler-mcp/unity-package"

Menu: Tools > Unity Profiler MCP > Status / Enable Bridge / Disable Bridge.

2. MCP server (Claude Code)

From GitHub:

claude mcp add unity-profiler -- npx -y github:shin0112/unity-profiler-mcp

From a local clone:

cd C:/projects/unity-profiler-mcp && npm install
claude mcp add unity-profiler -- node C:/projects/unity-profiler-mcp/server/index.js

Configuration

Setting

Where

Default

Port

EditorPrefs Shin0112.UnityProfilerMcp.Port (editor) and env UNITY_PROFILER_PORT (server) — keep them equal

17891

Capture folder

env UNITY_PROFILER_CAPTURES or tool folder

<project>/ProfilerCaptures

Export timeout

env UNITY_PROFILER_EXPORT_TIMEOUT_MS (server); the bridge waits up to 15 min

900000

Recording captures that compare well

  • Development Build, Deep Profile and allocation call stacks off.

  • Same scene, spawner, unit count and camera position for every run; record after the scene settles (e.g. 300+ frames).

  • Several runs per variant, so profiler_compare can separate real differences from run-to-run noise.

  • Emulators and the Editor are fine for relative comparison only; confirm absolute numbers on a target device.

License

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to analyze RenderDoc GPU frame captures for graphics debugging and performance analysis through a headless Python API. It provides a comprehensive suite of tools for inspecting pipeline states, shader bindings, and exporting frame resources like textures and meshes.
    180
    -
  • F
    license
    B
    quality
    C
    maintenance
    MCP server for RenderDoc that enables AI assistants to analyze GPU frame captures (.rdc files) for graphics debugging and performance analysis, with 42 tools covering the full RenderDoc workflow.
    6
    -
  • A
    license
    B
    quality
    C
    maintenance
    Enables AI clients to analyze RenderDoc captures by browsing draw/dispatch events, inspecting pipeline state and shaders, and paginating vertex/constant buffer data.
    13
    1
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables supported AI clients to connect to and automate the Unity Editor, covering scene and GameObject manipulation, asset and material operations, script creation and validation, testing, builds, screenshots, and editor-state inspection. It supports HTTP and stdio transports and ships client configuration helpers for Unity 2021.3+ on Windows, Linux, and macOS.
    MIT