feat(rolldown): mcp#455
Draft
webfansplz wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds MCP (Model Context Protocol) support to Vite DevTools by introducing a headless Rolldown “agent” plugin that registers analysis tools, and a new vite-devtools mcp CLI command that exposes those tools over stdio via the devframe MCP adapter.
Changes:
- Add
@vitejs/devtools-rolldown/node/agententrypoint that registers Rolldown build analysis / tracing / comparison tools onctx.agent. - Add core-side MCP server (
packages/core/src/node/mcp.ts) plus a newvite-devtools mcpCLI command wired throughcli.tsandcli-commands.ts. - Update workspace deps/lockfile and API snapshots to include the new MCP surface and new exported entrypoints.
Reviewed changes
Copilot reviewed 30 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.base.json | Adds TS path alias for @vitejs/devtools-rolldown/node/agent. |
| alias.ts | Adds repo alias for @vitejs/devtools-rolldown/node/agent. |
| pnpm-workspace.yaml | Adds @modelcontextprotocol/sdk to the shared catalog. |
| pnpm-lock.yaml | Locks @modelcontextprotocol/sdk@1.29.0 and transitive additions. |
| packages/rolldown/tsdown.config.ts | Builds a new node/agent entrypoint. |
| packages/rolldown/package.json | Exposes ./node/agent subpath export. |
| packages/rolldown/src/node/rpc/utils.ts | Adjusts logs directory resolution logic for RolldownLogsManager. |
| packages/rolldown/src/node/rpc/tests/utils.test.ts | Tests updated log directory selection behavior (no process.cwd() fallback). |
| packages/rolldown/src/node/rpc/functions/rolldown-get-session-compare-details.ts | Factors out createSessionCompareDetails() for reuse. |
| packages/rolldown/src/node/agent/index.ts | Adds DevToolsRolldownAgent() plugin entrypoint. |
| packages/rolldown/src/node/agent/tools.ts | Registers Rolldown agent tools on ctx.agent. |
| packages/rolldown/src/node/agent/types.ts | Defines the agent report/insight schema types. |
| packages/rolldown/src/node/agent/utils.ts | Shared helpers for agent analysis (clamping, stats, sizing). |
| packages/rolldown/src/node/agent/context.ts | Creates an analysis context over Rolldown sessions/logs. |
| packages/rolldown/src/node/agent/analysis.ts | Composes the analysis modules into createRolldownAnalysis(). |
| packages/rolldown/src/node/agent/modules/build-analysis.ts | Implements first-pass heuristic build analysis. |
| packages/rolldown/src/node/agent/modules/build-time-analysis.ts | Implements build-time breakdown analysis. |
| packages/rolldown/src/node/agent/modules/bundle-size-analysis.ts | Implements bundle-size contributor analysis. |
| packages/rolldown/src/node/agent/modules/dependency-trace.ts | Implements module/package/asset inclusion tracing. |
| packages/rolldown/src/node/agent/modules/build-comparison.ts | Implements session-to-session comparison using shared compare logic. |
| packages/rolldown/src/node/agent/tests/plugin.test.ts | Tests that the agent plugin registers the expected tools. |
| packages/core/package.json | Adds @modelcontextprotocol/sdk dependency (via catalog). |
| packages/core/tsconfig.json | Disables composite for core package TS config. |
| packages/core/src/node/standalone.ts | Allows injecting additional headless plugins + toggling builtin devtools. |
| packages/core/src/node/mcp.ts | Implements MCP server that mirrors the DevTools agent surface over stdio. |
| packages/core/src/node/cli.ts | Adds mcp CLI command. |
| packages/core/src/node/cli-commands.ts | Adds mcp() command implementation. |
| packages/core/src/node/tests/standalone.test.ts | Tests that injected plugins’ devtools.setup hooks run in standalone mode. |
| packages/core/src/node/tests/context-capabilities.test.ts | Tests that plugin-contributed agent tools are registered. |
| test/snapshots/tsnapi/@vitejs/devtools/cli-commands.snapshot.js | Updates public API snapshot for new mcp CLI command. |
| test/snapshots/tsnapi/@vitejs/devtools/cli-commands.snapshot.d.ts | Updates public API snapshot types for mcp options/function. |
| test/snapshots/tsnapi/@vitejs/devtools-rolldown/node/agent.snapshot.js | Adds new public API snapshot for rolldown agent entrypoint. |
| test/snapshots/tsnapi/@vitejs/devtools-rolldown/node/agent.snapshot.d.ts | Adds new public API snapshot types for rolldown agent entrypoint. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| diagnostics.RDDT0001() | ||
| } | ||
| manager = new RolldownLogsManager(dir ?? dirs[0]!) | ||
| manager = new RolldownLogsManager(dir) |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.