react-render-profile-mcp

v1.0.2
io.github.vola-trebla/react-render-profile-mcp Checked 1 day ago Published 6 months ago

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

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_render_summary

Returns a high-level overview of a React DevTools Profiler export: total commits, total render time, top 5 slowest components by self time, and total spurious (wasted) render count. Use this first to understand the scale of the performance problem before drilling into specifics.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)

find_spurious_renders

Finds React components that re-rendered without any meaningful prop, state, context, or hook changes. These are wasted renders caused by unstable references (inline objects/functions/arrays) passed from a parent. Returns component name, total render count, spurious count, and wasted milliseconds. Use to identify the highest-ROI targets for React.memo.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
min_render_countnumberOnly include components with at least this many total renders (default: 1)

get_hottest_components

Returns the top N React components ranked by self CPU time (excluding children) across the entire profiling session. Includes total self ms, average per render, and percentage of total profile time. Use to find which components are the most expensive to render, regardless of cause.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
top_nnumberNumber of components to return (default: 10)

trace_render_cascade

For a specific React commit (render cycle), shows what triggered it and lists every component that re-rendered as a result, sorted by actual duration descending. Reveals propagation — e.g. a context update cascading into 40 children. Call get_render_summary first to find total_commits, then use 0-based commit_index.

ParameterTypeDescription
commit_index *numberZero-based index of the commit to inspect
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)

suggest_memoization

Analyzes the profiling data and returns concrete memoization suggestions. Currently detects React.memo candidates: components with spurious renders above the wasted ms threshold. Each suggestion explains why the component re-renders unnecessarily and what to do about it.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
min_wasted_msnumberOnly suggest for components wasting more than this many ms total (default: 0)

analyze_compiler_efficacy

Evaluates React Compiler or manual React.memo efficacy by tracking spurious renders. Calculates the Invalidation Index for each component to identify where unstable prop references trigger wasteful renders.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
invalid_thresholdnumberMinimum invalidation index threshold to report (default: 10)

diagnose_hydration_and_suspense

Detects server-client hydration mismatches and sequential nested Suspense waterfalls by analyzing mount durations, unmount events, and timelines.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
waterfall_threshold_msnumberTimeline delta threshold in ms to detect Suspense waterfalls (default: 100)

evaluate_external_store_performance

Analyzes useSyncExternalStore performance, identifying selector reference instability and concurrency bypasses where heavy store updates block the high-priority main thread.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
max_blocking_task_msnumberMaximum duration budget in ms for synchronous tasks before flagging bypass (default: 50)

trace_state_cascade_footprint

Reconstructs the virtual parent/owner tree traversal to measure the depth and consumer count of a state update cascade for a specific commit index.

ParameterTypeDescription
commit_index *numberZero-based index of the commit to trace
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)

remediate_component

Automatically optimizes a React component's AST by hoisting static declarations, wrapping unstable callbacks/objects in useCallback/useMemo, and wrapping the component in React.memo if the ROI score is above 1.5. Mutates the file on disk.

ParameterTypeDescription
component_name *stringName of the React component to optimize
file_path *stringAbsolute path to the React component file on disk
roi_score *numberEstimated ROI score from profiling (usually 0 to 5) justifying memoization overhead
unstable_props *stringComma-separated or space-separated list of props to memoize/wrap in hooks

audit_compiler_rules

Audits a React component file to check if it violates compiler memoization safety guidelines (e.g., Date.now(), Math.random(), useRef mutations in render, 'use no memo' bails).

ParameterTypeDescription
component_name *stringName of the React component to audit
file_path *stringAbsolute path to the React component file on disk

profile_rsc_stream

Analyzes a React Server Components (RSC) Flight stream text log. Detects bloated chunks (>50KB), sequential Waterfall request bottlenecks, and security hazards like constructor traversing exploits (CVE-2025-55182 / React2Shell).

ParameterTypeDescription
stream_payload *stringRaw line-separated Flight stream text payload

correlate_chrome_trace

Aligns React commits with Chrome Performance trace events (re-layout, paint, style calculations) using blink.user_timing ⚛ markers to calculate Core Web Vitals (INP/CLS) impact.

ParameterTypeDescription
profile_path *stringAbsolute path to the React DevTools Profiler export (.json)
trace_path *stringAbsolute path to Chrome performance timeline trace export (.json)