
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.
概覽
把 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 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 React Render Profile Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
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
keyprops 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
useCallbackanduseMemowith computed dependency arrays. - ROI Wrapping: Wrapping components in
React.memoonly 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-phaseuseRefmutations).
📊 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.
🤖 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):
📋 How to Export a Profile
- Open React DevTools in your browser.
- Navigate to the Profiler tab.
- Click the Record button (circle), interact with your application to trigger the performance issue, and click Stop.
- Click the Save Profile icon (💾) to download the
.jsonfile. - Provide the absolute path to this file to the MCP server.
⚙️ Setup & Installation
Claude Desktop
Add this to your claude_desktop_config.json:
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-morphstatement manipulation blocks, avoiding common parser state corruption during multi-pass rewrites.
Part of the MCP Toolbelt
Developed alongside:
- tailwind-context-resolver-mcp — Resolve Tailwind design tokens and validate utility classes.
- v8-cpu-profile-decoder-mcp — Decode V8 CPU profiles for Node.js backend performance tuning.
License
MIT
來源:README.md,提交 e834c0d
工具
0版本歷史
1- v1.0.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分