React Render Profile Mcp

io.github.vola-trebla由 GitHub 帳號 vola-trebla 發布v1.0.2更新於 Nov 3, 2026

Decodes React DevTools Profiler exports into render summaries and memoization advice for AI agents.

已驗證STDIO僅桌面開發者工具資料與分析

概覽

AI 產生的概覽

把 React DevTools Profiler 匯出檔解析成渲染摘要、memo 化建議,並可為 AI 編碼代理直接改寫元件原始碼。

可以做什麼
  • 彙整效能剖析:提交次數、總渲染時間、無效渲染與生命週期異常
  • 找出浪費的渲染並歸類觸發原因,評估 React Compiler 或 React.memo 被繞過的位置
  • 診斷水合不一致、Suspense 瀑布、外部 store 選擇器不穩定及狀態串聯深度
  • 提供高報酬的 memo 化建議,並靜態稽核元件原始碼的編譯器規則違規
  • 直接改寫磁碟上的元件原始碼:提升字面量、包裝 hooks、套用 React.memo
  • 檢查 RSC Flight 負載的區塊大小、瀑布與已知漏洞,並把提交與 Chrome trace 對齊估算 CLS/INP
適用情境
適合在代理重構 React 元件、Context Provider 或 store 選擇器時,用真實執行期渲染資料取代猜測;也適合排查卡頓、輸入延遲或重複渲染風暴,前提是能匯出 React DevTools 效能剖析檔。
執行需求
以 stdio 在本機執行,通常透過 npx 啟動,因此需要 Node.js。所有剖析工具都需要 React DevTools Profiler 匯出的 JSON 檔絕對路徑;修復與稽核工具需要原始碼檔案路徑。未宣告任何帳號、API 金鑰或環境變數。
安裝前請注意
修復工具會直接修改磁碟上的元件原始碼,請使用版本控制並檢視變更。它會讀取本機剖析與 trace 檔,並把內容傳送給模型。README 另建議把一段工作流程提示寫入代理的系統指令,這一步是可選的。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 React Render Profile Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

react-render-profile-mcp

[npm version] [npm downloads] [CI] [License: MIT]

An Autonomous Performance SRE & Auto-Remediation Engine for React, exposed as a Model Context Protocol (MCP) server. Built specifically to bridge the performance perception gap for AI coding agents (Claude, Cursor, Copilot).


👁️ The Blind Spot: Why AI Agents Break React Production

When an AI agent refactors a Context Provider, changes state architecture, or hooks up a global store, it is completely blind to the runtime performance impact.

An agent can successfully pass unit tests and compile code while introducing catastrophic performance regressions:

  • A single state update cascading into 80 unnecessary child re-renders.
  • Infinite rendering loops triggered by unstable Zustand/Redux selector references.
  • Hydration mismatches forcing React to throw away server-rendered HTML and mount from scratch.
  • Unstable key props causing components to unmount and mount on every render cycle (lifecycle anomalies).

react-render-profile-mcp gives AI agents a "third eye" to dynamically measure, visualize, and auto-remediate these performance bottlenecks.


⚡ The Four Pillars of AI-SRE

Instead of raw JSON dumps, this server organizes performance data into structured, actionable insights across four core engineering pillars:

🧠 1. AST Auto-Remediation Engine (ts-morph)

ア When a bottleneck is found, the agent doesn't need to manually rewrite code. The server can mutate component source code on disk:

  • Hoisting: Statically hoisting object and array literals out of render bodies.
  • Dynamic Memoization: Wrapping unstable functions and variables in useCallback and useMemo with computed dependency arrays.
  • ROI Wrapping: Wrapping components in React.memo only if the profiled self-time and spurious render count justify the comparison overhead (ROI > 1.5).
  • Rule Auditing: Scanning code to prevent compiler bailouts (detecting Date.now(), Math.random(), or render-phase useRef mutations).

📊 2. Interactive SVG Cascade Visualizer (MCP Resource)

Generates parent-child rendering graphs directly into the agent's chat window using the custom resource URI scheme react-profile://commits/{commitId}/cascade?profile_path={profile_path}.

  • Triggers are styled with distinct HSL palettes to isolate propagation channels:
    • 🔵 Context Trigger: Blue (ocean wave)
    • 🟠 Zustand/Redux Store: Orange (subscriber ripple)
    • 🔴 Props Invalidation: Red (reference mismatch)
    • 🟢 State Change: Green (emerald trigger source)

🛡️ 3. RSC Flight Stream & Security Profiler

Analyzes React Server Components (RSC) Flight streams to optimize delivery:

  • Identifies bloated chunks (> 50KB) and sequential waterfalls.
  • Scans payloads for prototype traversal vulnerabilities like CVE-2025-55182 (React2Shell) exploits.

⚛️ 4. Multi-Layer Trace Correlator

Aligns React commits with Chrome Performance timeline events using blink.user_timing markers.

  • Measures post-commit layout, paint, and style calculation tasks to calculate real Core Web Vitals impacts (CLS / INP estimates).

🛠️ MCP Tools Reference

Below is a compact summary of the tools exposed by this server. All tools accept a required profile_path pointing to a React DevTools export .json.

Tool NameParametersPurpose / Output
get_render_summaryprofile_pathOverview of commits, total render time, spurious renders count, and lifecycle anomalies.
find_spurious_rendersprofile_path, min_render_count?Lists components that rendered with identical props/state. Classifies trigger into UNSTABLE_PARENT_REF or CONTEXT_UPDATE.
analyze_compiler_efficacyprofile_path, invalid_threshold?Computes Invalidation Index to identify where React Compiler or React.memo is bypassed.
diagnose_hydration_and_suspenseprofile_path, waterfall_threshold_ms?Detects server-client hydration mismatches and nested Suspense fetch waterfalls.
evaluate_external_store_performanceprofile_path, max_blocking_task_ms?Finds unstable useSyncExternalStore selectors and high-priority blocking sync tasks.
trace_state_cascade_footprintprofile_path, commit_indexTraces virtual owner tree to measure propagation depth and consumer count of updates.
suggest_memoizationprofile_path, min_wasted_ms?Provides high-ROI React.memo suggestions based on average self-time (> 2ms threshold).
remediate_componentfile_path, component_name, unstable_props, roi_scoreModifies AST on disk to hoist variables, wrap hooks, and apply memoization.
audit_compiler_rulesfile_path, component_nameStatically audits component source code for React Compiler rule violations.
profile_rsc_streamstream_payloadParses RSC Flight logs to audit chunk sizes, waterfalls, and React2Shell exploits.
correlate_chrome_traceprofile_path, trace_pathAligns React commits with Chrome trace events to calculate CLS/INP web vitals impacts.

🤖 Prompt Injection: Teach Your Agent to Profile

To get the most out of this server, add the following prompt to your agent's system instructions (e.g., in .cursorrules, Cursor System Prompt, or Claude Custom Instructions):

markdown
You are equipped with `react-render-profile-mcp`. Use it systematically whenever:
1. You make structural changes to React components, global state providers, or store selectors.2. The user reports lag, slow input response, or UI stuttering.3. You refactor context providers, Zustand selectors, or Redux dispatches.
Debugging Workflow:
- Ask the user to record and export a React DevTools profile (.json).- Run `get_render_summary` to understand the scale of the problem and look for `lifecycle_anomaly: true` (unstable keys).- Run `find_spurious_renders` and `analyze_compiler_efficacy` to pinpoint unstable prop references.- Call the `react-profile://commits/{commitId}/cascade` resource to visualize cascades.- Use `remediate_component` to automatically apply AST optimizations (hoisting static variables, wrapping hooks) instead of doing it manually.

📋 How to Export a Profile

  1. Open React DevTools in your browser.
  2. Navigate to the Profiler tab.
  3. Click the Record button (circle), interact with your application to trigger the performance issue, and click Stop.
  4. Click the Save Profile icon (💾) to download the .json file.
  5. Provide the absolute path to this file to the MCP server.

⚙️ Setup & Installation

Claude Desktop

Add this to your claude_desktop_config.json:

json
{  "mcpServers": {    "react-render-profile": {      "command": "npx",      "args": ["-y", "react-render-profile-mcp"]    }  }}

Cursor / VS Code / Other Clients

Add an MCP server of type command:

  • Command: npx -y react-render-profile-mcp

🔧 Under the Hood

  • ESM-Native: Built with TypeScript ESM, optimized for fast Node.js imports.
  • React DevTools v5 Protocol: Natively decodes serialized operations arrays, resolving fiber snapshots and name maps.
  • Lane Identification: Distinguishes between high-priority lane updates and concurrent transition commits (Low Priority/Idle) to prevent false-positive regression flags.
  • AST Modification Safety: Implements ts-morph statement manipulation blocks, avoiding common parser state corruption during multi-pass rewrites.

Part of the MCP Toolbelt

Developed alongside:


License

MIT

來源:README.md,提交 e834c0d

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分