You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a compile_route MCP tool that triggers on-demand compilation of a specific route (app or pages) without issuing an HTTP request, and returns any compilation issues.
Why?
Coding agents and benchmarking workflows need a way to warm the module graph or measure compile time for a route without standing up a live backend to satisfy the request. The existing path — hitting the URL — requires the route's runtime dependencies to be available and couples compile timing to request handling.
How?
New tool mcp/compile_route registered in get-or-create-mcp-server.ts, backed by a compileRoute({ page, clientOnly }) callback plumbed from both the Turbopack and webpack hot reloaders.
Reuses the dev server's existing on-demand entry path (ensurePage / handleRouteType), so the call path matches a first navigation.
Adds a subscribeToChanges opt-out on ensurePage and threads it through handleRouteType / handlePagesErrorRoute. One-shot MCP compilations skip HMR subscription wiring — without this, each call would leak a subscription that fires on every subsequent file change for the life of the dev server.
Telemetry: registers mcp/compile_route in the McpToolName union.
Error 1172 reserved for "compilation failed but no issues were recorded".
e2e test in test/development/mcp-server/mcp-server-compile-route.test.ts.
This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite. Learn more
The reason will be displayed to describe this comment to others. Learn more.
instead of making this be optional would it be better to just pass a no-op subscribe function down?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Adds a
compile_routeMCP tool that triggers on-demand compilation of a specific route (app or pages) without issuing an HTTP request, and returns any compilation issues.Why?
Coding agents and benchmarking workflows need a way to warm the module graph or measure compile time for a route without standing up a live backend to satisfy the request. The existing path — hitting the URL — requires the route's runtime dependencies to be available and couples compile timing to request handling.
How?
mcp/compile_routeregistered inget-or-create-mcp-server.ts, backed by acompileRoute({ page, clientOnly })callback plumbed from both the Turbopack and webpack hot reloaders.ensurePage/handleRouteType), so the call path matches a first navigation.subscribeToChangesopt-out onensurePageand threads it throughhandleRouteType/handlePagesErrorRoute. One-shot MCP compilations skip HMR subscription wiring — without this, each call would leak a subscription that fires on every subsequent file change for the life of the dev server.mcp/compile_routein theMcpToolNameunion.test/development/mcp-server/mcp-server-compile-route.test.ts.