rsbuild-plugin-vue-mcp
This server runs inside an Rsbuild or Rspack dev server to expose MCP tools for inspecting and editing live Vue component state, component trees, Vue Router info, and Pinia stores.
README
Rsbuild plugin VueDevtools MCP
Rsbuild/Rspack MCP plugin based on Vue DevTools.
Supports
Rsbuild 1.x/2.xandRspack 1.x/2.x.
Through the Model Context Protocol (MCP), AI tools (such as IDE assistants and agents) can read and manipulate your Vue application state in real time, truly enabling "AI that understands your application."
This plugin bridges your dev server and the Vue DevTools running inside your app page via birpc over WebSocket, exposing a set of MCP tools that let AI inspect components, router, and Pinia stores, and even edit component state directly.
Features
- 🔌 Zero-config MCP server — automatically mounted on your existing dev server (no separate process).
- 🌳 Inspect the component tree of the running app, in tree.
- 🧩 Read & edit Vue component state (reactive data, props, computed, refs…).
- 🔦 Highlight a component in the page to visually locate it.
- 🧭 Read the Vue Router info (current route, matched records, params, query…).
- 🗄️ Inspect Pinia — browse the store tree and read individual store state.
- ⚡️ Works with both Rsbuild and Rspack dev servers.
Usage
Install
# For npm
npm add rsbuild-plugin-vue-mcp -D
# For yarn
yarn add rsbuild-plugin-vue-mcp -D
# For pnpm
pnpm add rsbuild-plugin-vue-mcp -D
Rsbuild
// rsbuild.config.js
import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue';
import { pluginVueMcp } from "rsbuild-plugin-vue-mcp";
export default defineConfig({
plugins: [
pluginVue(),
pluginVueMcp(),
],
});
Rspack
// rspack.config.js
import { defineConfig } from '@rspack/cli';
import { rspack } from "@rspack/core";
import { VueLoaderPlugin } from 'rspack-vue-loader';
import { VueMcpPlugin } from 'rsbuild-plugin-vue-mcp/rspack';
export default defineConfig({
plugins: [
new rspack.HtmlRspackPlugin(),
new VueLoaderPlugin(),
new VueMcpPlugin(),
],
module: {
rules: [
{
test: /\.vue$/,
loader: 'rspack-vue-loader',
options: {
experimentalInlineMatchResource: true,
},
},
],
},
});
The MCP server (Streamable HTTP transport) will be available at http://localhost:[port]/__mcp/mcp.
Requirements: requires
@rsbuild/core >= 1.2.9(for Rsbuild) or@rspack/core >= 1.3.0(for Rspack) so the plugin can attach to the underlying HTTP server.
Connect an MCP client
Start the dev server (usually npm run dev). It prints the MCP service URL in the console, e.g.:
➜ MCP: Server is running at http://localhost:5173/__mcp/mcp
Add that URL to your client's MCP configuration (Cursor, Claude Desktop, VS Code, etc.):
{
"mcpServers": {
"vue-mcp": {
"type": "streamable-http",
"url": "http://localhost:<YourPort>/__mcp/mcp",
"disabled": false
}
}
}
[!IMPORTANT] To actually call the MCP tools and debug your app, two things are required:
- The dev server is running (so the MCP server is up).
- You have opened your app page in a browser (e.g.
http://localhost:5173). The injectedoverlay.jsthen connects to the dev server via WebSocket and exposes the Vue DevTools runtime.The tools reach the live app through that WebSocket connection — if no app page is open, the tool calls will fail or time out.
Once the page is open, the AI assistant can call the tools listed below against your running dev app.
MCP Tools
The plugin registers the following tools on the MCP server. Each tool talks to the app page through birpc, so the data always reflects the live application. All tools return their results as JSON-formatted text (not markdown).
| Tool | Description | Inputs |
|---|---|---|
get-component-tree |
Get the Vue component tree. The result is returned as a JSON text payload. | — |
get-component-state |
Get a component's state as JSON (data, props, computed, refs…). | componentName: string |
edit-component-state |
Edit a value inside a component's state (live, reactive). | componentName: string, path: string[], value: string, valueType: 'string' | 'number' | 'boolean' | 'object' | 'array' |
highlight-component |
Highlight a component on the page (auto-clears after 5s). | componentName: string |
get-router-info |
Get the current Vue Router info as JSON (route, matched records, params, query…). | — |
get-pinia-tree |
Get the Pinia store tree as JSON. | — |
get-pinia-state |
Get a single Pinia store's state as JSON. | storeName: string |
Example AI workflow
- "Show me the component tree of the current page."
- "What is the state of the
UserCardcomponent?" - "Set
countinCounterto10." → callsedit-component-stateand the UI updates instantly. - "Highlight the
Navbarcomponent." → the element flashes in the browser. - "What route are we on and what are its params?" → calls
get-router-info. - "Show me the state of the
cartPinia store."
How it works
The plugin uses birpc as the RPC layer and WebSocket as the transport between the dev server and the app page.
graph TD
subgraph A["MCP Host (AI Client)"]
A1[MCP Client]
A2[MCP Client]
end
subgraph B["MCP Server (Rsbuild/Rspack Dev Server)"]
B1[MCP Tools<br/>get-component-tree / get-component-state / ...]
B2[birpc group<br/>createRPCServer]
B3[WebSocket Server<br/>/__vue-devtools-mcp-ws]
end
subgraph C["Vue App (Browser)"]
C1[overlay.js injected]
C2[birpc client]
C3[Vue DevTools Kit<br/>devtools.api / ctx]
end
A <-- " streamable-http / SSE " --> B1
B1 --> B2
B2 <== " birpc over WebSocket " ==> B3
B3 --> C1 --> C2 --> C3
- Injection — When the dev server starts, the plugin injects
overlay.jsinto the app's HTML (or, whenappendTois configured, appends an import to matching source modules).overlay.jsinitializes@vue/devtools-kitand opens aWebSocketto the dev server at/__vue-devtools-mcp-ws. - RPC bridge — The dev server creates a birpc group (
createRPCServer) over the WebSocket connections.overlay.jscreates a birpc client (createBirpc). Requests from the server are forwarded to the app; responses come back via hook callbacks (onInspectorTreeUpdated,onInspectorStateUpdated, …). - MCP layer — MCP tool handlers (
src/mcp/server.ts) call the birpc client to reach the app, wait for the response throughhookablehooks, and return it as the tool result.
This two-hop design (MCP ↔ birpc ↔ DevTools) means every tool call inspects or mutates the **actual running application **, not a static snapshot.
Configuration
Both pluginVueMcp(options) (Rsbuild) and new VueMcpPlugin(options) (Rspack) accept the same options:
interface PluginVueMcpOptions {
/** Host to listen on. Default: `localhost`. */
host?: string
/** Print the MCP server URL in the console. Default: `true`. */
printUrl?: boolean
/** Custom MCP server info (name/version). Ignored when `mcpServer` is provided. */
mcpServerInfo?: { name?: string, version?: string, ... }
/**
* Customize or replace the MCP server instance. Called whenever a server is created.
* You may register extra tools, or return a new McpServer to replace the default one.
*/
mcpServerSetup?: (server: McpServer, api: RsbuildPluginAPI | Compiler) => void | Promise<void | McpServer>
/** Path prefix for the MCP endpoint. Default: `/__mcp` (so the endpoint is `/__mcp/mcp`). */
mcpPath?: string
/**
* Instead of injecting a <script> into HTML, append an import to modules whose id
* matches this regex. Useful for projects without an HTML entry.
* WARNING: only set this if you know exactly what it does.
*/
appendTo?: string | RegExp
}
Examples
Register extra MCP tools alongside the defaults:
pluginVueMcp({
mcpServerSetup(server, api) {
server.registerTool('ping', { description: 'Ping the dev server' }, async () => ({
content: [{ type: 'text', text: 'pong' }],
}))
},
})
Use a custom MCP endpoint path:
pluginVueMcp({ mcpPath: '/my-mcp' })
// → http://localhost:<port>/my-mcp/mcp
Requirements
- Node.js
>= 18 @rsbuild/core >= 1.2.9 || >= 2.0.0(optional peer, for the Rsbuild plugin)@rspack/core >= 1.3.0 || >= 2.0.0(optional peer, for the Rspack plugin)- A Vue 3 application instrumented with
@vue/devtools-kit(handled automatically by the injected overlay).
Debugging
You can inspect the MCP server with the official MCP Inspector:
npx @modelcontextprotocol/inspector
Then point it at http://localhost:<YourPort>/__mcp/mcp with the Streamable HTTP transport.
Reference / Credits
- Inspired by vite-plugin-vue-mcp — the original idea of bridging Vue DevTools and MCP.
- Model Context Protocol
birpc— the RPC layer used between dev server and app page@vue/devtools-kit— Vue DevTools core API
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。