react-devtools-cdt-mcp

This is an experimental library. It is based on the experimental third-party developer tools API in chrome-devtools-mcp.

Browser library that registers React inspection and profiling tools with chrome-devtools-mcp.

This is not an MCP server and does not go in your MCP client config. Import it in the page under test; chrome-devtools-mcp discovers the React tools from the page.

Third-party tools are experimental. They require chrome-devtools-mcp 1.3.0+ and --categoryExperimentalThirdParty=true.

Install

npm install react-devtools-cdt-mcp

Usage

Import the register entry before React so the DevTools hook is installed before React initializes:

import 'react-devtools-cdt-mcp/register';
import React from 'react';

react-devtools-cdt-mcp/register throws outside a browser-like environment. The package root is side-effect-free and exports the lower-level API for custom targets:

import {register, buildToolGroup} from 'react-devtools-cdt-mcp';

chrome-devtools-mcp setup

Add the experimental third-party category to your MCP client config:

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": [
        "-y",
        "chrome-devtools-mcp@latest",
        "--categoryExperimentalThirdParty=true"
      ]
    }
  }
}

When the page runs under chrome-devtools-mcp, the React tools are listed by list_3p_developer_tools and callable either via execute_3p_developer_tool({toolName, params}) or directly via evaluate_script (window.__dtmcp.executeTool(toolName, params)).

These tools can expose component props and hook values to the MCP client. Use them in local or otherwise trusted debugging sessions.

Conventions

Tools

react_get_component_tree

Snapshot of the component tree.

react_get_component_by_uid

Detailed info for a single component.

react_get_component_by_dom_element

Detailed info for the React host component corresponding to a DOM element (the host node itself, not the function component that rendered it).

react_find_components

Find components by case-insensitive name substring.

react_get_component_source

Definition source location of a component.

react_get_owner_stack_trace

Raw owner stack trace — the chain of JSX creation locations up to the root.

react_get_parent_stack

Rendered parent list — where a component is mounted in the rendered component tree.

react_get_owner_stack

Structured owner list — which components created/rendered this element through JSX.

react_start_profiling

Start a profiling session that records per-commit render timing.

react_stop_profiling

Stop the active profiling session.

react_get_trace_overview

Per-commit overview of a recorded trace.

react_get_commit_report

Detailed report for a single commit.