Skip to content

[DevTools] Remove experimental __IS_INTERNAL_MCP_BUILD__ flag and related code#498

Closed
everettbu wants to merge 1 commit into
mainfrom
cleanup-devtools-mcp-build-flag
Closed

[DevTools] Remove experimental __IS_INTERNAL_MCP_BUILD__ flag and related code#498
everettbu wants to merge 1 commit into
mainfrom
cleanup-devtools-mcp-build-flag

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35755
Original author: hoxyq


This is unused.

…ated code

Remove the unused internal MCP build flag infrastructure that was added
for experimental MCP integration. This removes the flag declaration,
build configuration, and the __internal_only_getComponentTree function
from the DevTools renderer.
@greptile-apps

greptile-apps Bot commented Feb 10, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR removes the experimental __IS_INTERNAL_MCP_BUILD__ build flag across DevTools configs (ESLint/Flow globals, Jest env setup, and various webpack DefinePlugin constants), and deletes the MCP-only renderer interface method that was conditionally exposed behind that flag.

Most changes are straightforward cleanup, but removing the renderer interface method appears to break the MCP server tool under compiler/packages/react-mcp-server, which still expects __internal_only_getComponentTree to exist on the renderer interface.

Confidence Score: 2/5

  • Not safe to merge as-is due to a confirmed runtime break in the MCP server tool.
  • The flag removal itself is consistent, but the PR also removes __internal_only_getComponentTree from the DevTools renderer interface while compiler/packages/react-mcp-server/src/tools/componentTree.ts still calls it, which will now throw at runtime.
  • packages/react-devtools-shared/src/backend/fiber/renderer.js (and compiler/packages/react-mcp-server/src/tools/componentTree.ts caller)

Important Files Changed

Filename Overview
.eslintrc.js Removes IS_INTERNAL_MCP_BUILD from declared ESLint globals.
packages/react-devtools-core/webpack.backend.js Removes IS_INTERNAL_MCP_BUILD from DefinePlugin globals for backend build.
packages/react-devtools-core/webpack.standalone.js Removes IS_INTERNAL_MCP_BUILD from DefinePlugin globals for standalone build.
packages/react-devtools-extensions/webpack.config.js Removes IS_INTERNAL_MCP_BUILD env handling and related stats filename suffix and DefinePlugin global.
packages/react-devtools-fusebox/webpack.config.frontend.js Removes IS_INTERNAL_MCP_BUILD from DefinePlugin globals for fusebox frontend.
packages/react-devtools-inline/webpack.config.js Removes IS_INTERNAL_MCP_BUILD from DefinePlugin globals for inline build.
packages/react-devtools-shared/src/backend/fiber/renderer.js Removes internal MCP-only __internal_only_getComponentTree export; this appears to break compiler/packages/react-mcp-server which calls it.
scripts/flow/react-devtools.js Removes Flow global declaration for IS_INTERNAL_MCP_BUILD.
scripts/jest/devtools/setupEnv.js Removes Jest test global IS_INTERNAL_MCP_BUILD initialization.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines 8817 to 8819
return unresolvedSource;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaks MCP component tree tool

This PR removes the __internal_only_getComponentTree function from the renderer interface (it used to be conditionally injected behind __IS_INTERNAL_MCP_BUILD__). However compiler/packages/react-mcp-server/src/tools/componentTree.ts still calls .get(1).__internal_only_getComponentTree(), so this will now throw at runtime (method is undefined). Either update/remove the MCP server tool, or keep exposing a supported API for extracting the component tree.

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-shared/src/backend/fiber/renderer.js
Line: 8817:8819

Comment:
**Breaks MCP component tree tool**

This PR removes the `__internal_only_getComponentTree` function from the renderer interface (it used to be conditionally injected behind `__IS_INTERNAL_MCP_BUILD__`). However `compiler/packages/react-mcp-server/src/tools/componentTree.ts` still calls `.get(1).__internal_only_getComponentTree()`, so this will now throw at runtime (method is `undefined`). Either update/remove the MCP server tool, or keep exposing a supported API for extracting the component tree.

How can I resolve this? If you propose a fix, please make it concise.

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Feb 11, 2026
@everettbu
everettbu deleted the cleanup-devtools-mcp-build-flag branch February 11, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants