@xiaou66/vite-plugin-vue-mcp-next 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,7 @@
11
11
  | 页面列表 | Vite entry + Runtime | Vite entry + Runtime + CDP target | 用于多页面和多 tab 场景下选择调试目标 |
12
12
  | DOM tree | Runtime Hook | CDP 优先,Hook 兜底 | 可返回裁剪后的运行时 DOM 结构 |
13
13
  | DOM selector 查询 | Runtime Hook | CDP 优先,Hook 兜底 | 可按 selector 返回节点文本、属性和布局信息 |
14
+ | 元素选择上下文 | 编译期 ID + Runtime Hook | 编译期 ID + Runtime Hook | 按住快捷键选择元素,复制 elementId 后通过 MCP 返回组件、DOM 和可编辑源码位置 |
14
15
  | 页面截图 | snapdom DOM 截图 | CDP 真截图优先,snapdom 降级 | 默认保存到项目目录并返回路径,也可配置为 base64 返回 |
15
16
  | Console 日志 | Runtime Hook | CDP 优先,Hook 兜底 | 采集 `log/info/warn/error/debug` 和运行时日志 |
16
17
  | Evaluate 控制台执行 | Runtime Hook | CDP 优先,Hook 兜底 | 默认关闭,必须显式开启 |
@@ -60,6 +61,36 @@ Streamable HTTP: http://localhost:<vite-port>/__mcp/mcp
60
61
 
61
62
  实际端口以启动日志中的 `MCP: SSE server is running at ...` 和 `MCP: Streamable HTTP server is running at ...` 为准。
62
63
 
64
+ ### 页面元素选择
65
+
66
+ 开发服务器启动后,页面内默认支持 `Option + Shift` / `Alt + Shift` 进入元素选择模式。按住快捷键移动鼠标会高亮当前元素,单击后插件会自动复制 `elementId`,并提示 `元素位置已复制,请发送给 AI`。
67
+
68
+ AI 收到 `elementId` 后应调用:
69
+
70
+ ```json
71
+ {
72
+ "tool": "get_element_context",
73
+ "arguments": {
74
+ "elementId": "src/pages/Home.vue:12:8"
75
+ }
76
+ }
77
+ ```
78
+
79
+ 项目源码会返回 `editable: true` 和 `codeLocation`;第三方组件会返回 `editable: false`、`packageName` 和 `entryFile`;运行时兜底 ID 只在当前页面生命周期内有效。
80
+
81
+ ```ts
82
+ vueMcpNext({
83
+ elementPicker: {
84
+ enabled: true,
85
+ shortcut: {
86
+ altKey: true,
87
+ shiftKey: true
88
+ },
89
+ toastDurationMs: 2200
90
+ }
91
+ })
92
+ ```
93
+
63
94
  ### 手动配置 MCP 客户端
64
95
 
65
96
  如果你不想使用自动配置,或需要把地址复制到其他支持 HTTP MCP 的客户端,可以手动配置当前 Vite dev server 的 MCP 地址。
@@ -138,6 +169,16 @@ vueMcpNext({
138
169
  skill: {
139
170
  autoConfig: true
140
171
  },
172
+ elementPicker: {
173
+ enabled: true,
174
+ shortcut: {
175
+ altKey: true,
176
+ shiftKey: true,
177
+ metaKey: false,
178
+ ctrlKey: false
179
+ },
180
+ toastDurationMs: 2200
181
+ },
141
182
  appendTo: undefined,
142
183
  runtime: {
143
184
  mode: 'auto',
@@ -487,7 +528,7 @@ interface ConsoleRecord {
487
528
  source: 'cdp' | 'hook'
488
529
  level: 'log' | 'info' | 'warn' | 'error' | 'debug'
489
530
  message: string
490
- args?: unknown[]
531
+ args?: string[]
491
532
  stack?: string
492
533
  timestamp: number
493
534
  }