Vite 插件:Vue MCP 服务器
一个 Vite 插件,提供 MCP 服务器以帮助模型更好地理解 Vue 应用。
安装
使用以下命令安装插件:
pnpm install vite-plugin-vue-mcp -D
使用
在 vite.config.ts
中添加插件:
import { VueMcp } from 'vite-plugin-vue-mcp'
export default defineConfig({
plugins: [VueMcp()],
})
运行后,MCP 服务器将在 http://localhost:[port]/__mcp/sse
提供服务。
功能
- 获取组件树:
get-component-tree
- 获取组件状态:
get-component-state
- 编辑组件状态:
edit-component-state
- 高亮组件:
highlight-component
- 获取路由信息:
get-router-info
- 获取 Pinia 树:
get-pinia-tree
- 获取 Pinia 状态:
get-pinia-state
更多配置选项及详细说明,请查看 README。