@xiaou66/vite-plugin-vue-mcp-next 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xiaou66
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,531 @@
1
+ # vite-plugin-vue-mcp-next
2
+
3
+ 面向 Vite + Vue 开发态的 Runtime DevTools MCP 插件。插件会在 Vite dev server 中挂载 MCP(Model Context Protocol,本地工具调用协议)服务,并注入浏览器 runtime,让 AI 客户端读取页面 DOM、Console 日志、Network 请求、Vue 组件树、Router、Pinia 状态,并在显式授权后执行控制台表达式。
4
+
5
+ 该插件只面向本地开发环境。生产构建默认不包含调试采集逻辑。
6
+
7
+ ## 能力概览
8
+
9
+ | 能力 | 默认通道 | 配置 CDP 后 | 说明 |
10
+ |---|---|---|---|
11
+ | 页面列表 | Vite entry + Runtime | Vite entry + Runtime + CDP target | 用于多页面和多 tab 场景下选择调试目标 |
12
+ | DOM tree | Runtime Hook | CDP 优先,Hook 兜底 | 可返回裁剪后的运行时 DOM 结构 |
13
+ | DOM selector 查询 | Runtime Hook | CDP 优先,Hook 兜底 | 可按 selector 返回节点文本、属性和布局信息 |
14
+ | Console 日志 | Runtime Hook | CDP 优先,Hook 兜底 | 采集 `log/info/warn/error/debug` 和运行时日志 |
15
+ | Evaluate 控制台执行 | Runtime Hook | CDP 优先,Hook 兜底 | 默认关闭,必须显式开启 |
16
+ | Network 请求 | Runtime Hook | CDP 优先,Hook 兜底 | 返回请求 URL、query、body、status、headers、response body |
17
+ | Vue 组件树 | Vue Runtime Bridge | Vue Runtime Bridge | Vue 专属语义不走 CDP |
18
+ | Vue 组件状态 | Vue Runtime Bridge | Vue Runtime Bridge | 读取和编辑组件状态 |
19
+ | Router 信息 | Vue Runtime Bridge | Vue Runtime Bridge | 返回当前路由和路由表 |
20
+ | Pinia 状态 | Vue Runtime Bridge | Vue Runtime Bridge | 返回 Pinia inspector tree 和 store state |
21
+
22
+ ## 安装与使用
23
+
24
+ ```bash
25
+ pnpm add -D @xiaou66/vite-plugin-vue-mcp-next
26
+ ```
27
+
28
+ ```ts
29
+ import vue from '@vitejs/plugin-vue'
30
+ import { defineConfig } from 'vite'
31
+ import vueMcpNext from 'vite-plugin-vue-mcp-next'
32
+
33
+ export default defineConfig({
34
+ plugins: [vue(), vueMcpNext()]
35
+ })
36
+ ```
37
+
38
+ 启动 Vite 后,默认 MCP SSE 入口为:
39
+
40
+ ```text
41
+ http://localhost:<vite-port>/__mcp/sse
42
+ ```
43
+
44
+ 启动 Vite dev server 后,插件会自动写入常见 AI 客户端的项目级 MCP 配置,服务名默认是 `vue-mcp-next`。自动配置只新增或更新本插件的 server 条目,不会删除已有 MCP Server。
45
+
46
+ | 客户端 | 自动配置文件 |
47
+ |---|---|
48
+ | Cursor | `.cursor/mcp.json` |
49
+ | Codex | `.codex/config.toml` |
50
+ | Claude Code | `.mcp.json` |
51
+ | Trae | `.trae/mcp.json` |
52
+
53
+ 实际端口以启动日志中的 `MCP: Server is running at ...` 为准。
54
+
55
+ ### 手动配置 MCP 客户端
56
+
57
+ 如果你不想使用自动配置,或需要把地址复制到其他支持 HTTP MCP 的客户端,可以手动配置当前 Vite dev server 的 SSE 地址。
58
+
59
+ Cursor、Claude Code、Trae 等 JSON 配置客户端可以使用:
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "vue-mcp-next": {
65
+ "url": "http://localhost:5173/__mcp/sse"
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ Codex 使用 TOML 配置:
72
+
73
+ ```toml
74
+ [mcp_servers.vue-mcp-next]
75
+ url = "http://localhost:5173/__mcp/sse"
76
+ ```
77
+
78
+ `5173` 是示例端口。若 Vite 使用了其他端口,请替换为启动日志中打印的 MCP 地址。
79
+
80
+ ## 完整配置
81
+
82
+ ```ts
83
+ vueMcpNext({
84
+ mcpPath: '/__mcp',
85
+ host: 'localhost',
86
+ printUrl: true,
87
+ updateCursorMcpJson: true,
88
+ mcpClients: {
89
+ cursor: true,
90
+ codex: true,
91
+ claudeCode: true,
92
+ trae: true,
93
+ serverName: 'vue-mcp-next'
94
+ },
95
+ appendTo: undefined,
96
+ runtime: {
97
+ mode: 'auto',
98
+ evaluate: {
99
+ enabled: false,
100
+ timeoutMs: 3000
101
+ }
102
+ },
103
+ cdp: {
104
+ browserUrl: undefined,
105
+ wsEndpoint: undefined,
106
+ targetUrlPattern: undefined
107
+ },
108
+ network: {
109
+ mode: 'auto',
110
+ maxRecords: 500,
111
+ captureRequestBody: true,
112
+ captureResponseBody: true,
113
+ maxBodySize: 100_000,
114
+ maskHeaders: ['authorization', 'cookie', 'set-cookie']
115
+ },
116
+ dom: {
117
+ maxDepth: 8,
118
+ maxNodes: 2000,
119
+ maxTextLength: 300
120
+ },
121
+ console: {
122
+ maxRecords: 1000
123
+ }
124
+ })
125
+ ```
126
+
127
+ ### 顶层配置
128
+
129
+ | 配置 | 类型 | 默认值 | 说明 |
130
+ |---|---|---|---|
131
+ | `mcpPath` | `string` | `'/__mcp'` | MCP 服务挂载路径,实际 SSE 地址是 `${mcpPath}/sse` |
132
+ | `host` | `string` | `'localhost'` | 打印 MCP 地址和写入 MCP 客户端配置时使用的 host |
133
+ | `printUrl` | `boolean` | `true` | 是否在 Vite 启动日志中打印 MCP SSE 地址 |
134
+ | `mcpClients` | `{ cursor?: boolean; codex?: boolean; claudeCode?: boolean; trae?: boolean; serverName?: string }` | 全部启用 | 是否自动写入 Cursor、Codex、Claude Code、Trae 的项目级 MCP 配置 |
135
+ | `updateCursorMcpJson` | `boolean | { enabled: boolean; serverName?: string }` | `true` | 兼容旧配置,建议新项目使用 `mcpClients` |
136
+ | `appendTo` | `string | RegExp` | `undefined` | 非 HTML 入口注入点。配置后会在匹配入口模块前追加 runtime import |
137
+
138
+ `appendTo` 适合 playground、框架包装入口、或不希望通过 `transformIndexHtml` 注入的场景:
139
+
140
+ ```ts
141
+ vueMcpNext({
142
+ appendTo: 'src/main.ts'
143
+ })
144
+ ```
145
+
146
+ ### Runtime 配置
147
+
148
+ | 配置 | 类型 | 默认值 | 说明 |
149
+ |---|---|---|---|
150
+ | `runtime.mode` | `'auto' | 'cdp' | 'hook'` | `'auto'` | DOM、Console、Evaluate 等通用 DevTools 能力的通道策略 |
151
+ | `runtime.evaluate.enabled` | `boolean` | `false` | 是否允许 MCP 客户端执行页面表达式 |
152
+ | `runtime.evaluate.timeoutMs` | `number` | `3000` | Hook fallback 执行表达式的超时时间 |
153
+
154
+ `evaluate_script` 默认关闭。该能力可以读取和修改页面状态,必须由使用者显式开启:
155
+
156
+ ```ts
157
+ vueMcpNext({
158
+ runtime: {
159
+ evaluate: {
160
+ enabled: true
161
+ }
162
+ }
163
+ })
164
+ ```
165
+
166
+ Hook fallback 当前执行的是表达式,不是完整语句块:
167
+
168
+ ```js
169
+ // 可以
170
+ (console.warn('mcp log', { ok: true }), 'logged')
171
+
172
+ // 不可以
173
+ console.warn('mcp log', { ok: true }); 'logged'
174
+ ```
175
+
176
+ 如果需要完整 DevTools Console 行为,建议配置 CDP。
177
+
178
+ ### CDP 配置
179
+
180
+ CDP(Chrome DevTools Protocol,Chrome DevTools 使用的浏览器调试协议)是可选能力。配置后,DOM、Console、Evaluate、Network 等通用 DevTools 能力会优先走 CDP;未配置或 target 不匹配时走页面 Hook 兜底。
181
+
182
+ ```ts
183
+ vueMcpNext({
184
+ cdp: {
185
+ browserUrl: 'http://127.0.0.1:9222',
186
+ targetUrlPattern: 'localhost:5173'
187
+ }
188
+ })
189
+ ```
190
+
191
+ 也可以直接传入页面 WebSocket endpoint:
192
+
193
+ ```ts
194
+ vueMcpNext({
195
+ cdp: {
196
+ wsEndpoint: 'ws://127.0.0.1:9222/devtools/page/xxx'
197
+ }
198
+ })
199
+ ```
200
+
201
+ | 配置 | 类型 | 默认值 | 说明 |
202
+ |---|---|---|---|
203
+ | `cdp.browserUrl` | `string` | `undefined` | Chrome remote debugging HTTP 地址,例如 `http://127.0.0.1:9222` |
204
+ | `cdp.wsEndpoint` | `string` | `undefined` | 已知页面 WebSocket endpoint。配置后会直接连接该 endpoint |
205
+ | `cdp.targetUrlPattern` | `string | RegExp` | `undefined` | 多 tab 或多页面时用于匹配目标页面 URL |
206
+
207
+ 启动 Chrome remote debugging 的示例:
208
+
209
+ ```bash
210
+ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
211
+ --remote-debugging-port=9222 \
212
+ --user-data-dir=/tmp/vite-plugin-vue-mcp-next-chrome
213
+ ```
214
+
215
+ 也可以连接 Electron、ZTools 等已经暴露 CDP 的应用。例如调试中已验证 `http://127.0.0.1:9222/json/list` 能返回 ZTools 页面 target,MCP 工具可直接对这些 `cdp:*` 页面执行 DOM、Evaluate、Console、Network 调试。
216
+
217
+ 安全注意:CDP remote debugging 具备强页面控制能力,只应在本机开发环境使用,不要暴露到公网或共享网络。
218
+
219
+ ### Network 配置
220
+
221
+ | 配置 | 类型 | 默认值 | 说明 |
222
+ |---|---|---|---|
223
+ | `network.mode` | `'auto' | 'cdp' | 'hook' | 'off'` | `'auto'` | Network 采集通道策略 |
224
+ | `network.maxRecords` | `number` | `500` | 最大缓存请求数 |
225
+ | `network.captureRequestBody` | `boolean` | `true` | 是否采集请求体 |
226
+ | `network.captureResponseBody` | `boolean` | `true` | 是否采集响应体 |
227
+ | `network.maxBodySize` | `number` | `100_000` | 请求体和响应体最大采集长度 |
228
+ | `network.maskHeaders` | `string[]` | `['authorization', 'cookie', 'set-cookie']` | 需要脱敏的 header 名称 |
229
+
230
+ Hook Network 覆盖 `fetch` 和 `XMLHttpRequest`。CDP Network 更接近 Chrome DevTools Network 面板,可以覆盖更多请求生命周期信息。
231
+
232
+ ### DOM 与 Console 配置
233
+
234
+ | 配置 | 类型 | 默认值 | 说明 |
235
+ |---|---|---|---|
236
+ | `dom.maxDepth` | `number` | `8` | DOM tree 最大输出深度 |
237
+ | `dom.maxNodes` | `number` | `2000` | DOM tree 最大节点数 |
238
+ | `dom.maxTextLength` | `number` | `300` | 单个文本节点最大长度 |
239
+ | `console.maxRecords` | `number` | `1000` | Console 日志最大缓存条数 |
240
+
241
+ DOM 默认跳过 `script`、`style`、`noscript`,并隐藏 password input 的值。这样做是为了避免 MCP 上下文被大页面或敏感字段污染。
242
+
243
+ ## MCP 工具清单
244
+
245
+ ### 页面工具
246
+
247
+ | 工具 | 输入 | 输出 | 说明 |
248
+ |---|---|---|---|
249
+ | `list_pages` | 无 | `entries`、`pages`、`cdpError?` | 返回 Vite HTML 入口、runtime 页面和 CDP target |
250
+ | `get_page_state` | `pageId?` | 页面状态 | 预留页面状态工具名 |
251
+
252
+ `list_pages` 的 `pages` 中可能出现两类页面:
253
+
254
+ - `runtime-*`:由页面注入 runtime bridge 后连接
255
+ - `cdp:*`:由 CDP `/json/list` 发现
256
+
257
+ ### DOM 工具
258
+
259
+ | 工具 | 输入 | 输出 | 说明 |
260
+ |---|---|---|---|
261
+ | `get_dom_tree` | `pageId?`、`maxDepth?`、`maxNodes?` | `source`、`snapshot` | 获取裁剪后的 DOM tree |
262
+ | `query_dom` | `pageId?`、`selector`、`limit?` | `source`、`nodes` | 按 selector 查询元素摘要 |
263
+
264
+ CDP 可用时输出 `source: 'cdp'`,否则使用 Runtime Hook 输出 `source: 'hook'`。
265
+
266
+ ### Console 工具
267
+
268
+ | 工具 | 输入 | 输出 | 说明 |
269
+ |---|---|---|---|
270
+ | `get_console_logs` | `pageId?`、`level?`、`limit?` | `logs` | 获取 Console 日志 |
271
+ | `clear_console_logs` | `pageId?` | `ok` | 清空缓存日志 |
272
+
273
+ 日志结构包含:
274
+
275
+ ```ts
276
+ interface ConsoleRecord {
277
+ id: string
278
+ pageId: string
279
+ source: 'cdp' | 'hook'
280
+ level: 'log' | 'info' | 'warn' | 'error' | 'debug'
281
+ message: string
282
+ args?: unknown[]
283
+ stack?: string
284
+ timestamp: number
285
+ }
286
+ ```
287
+
288
+ ### Evaluate 工具
289
+
290
+ | 工具 | 输入 | 输出 | 说明 |
291
+ |---|---|---|---|
292
+ | `evaluate_script` | `pageId?`、`expression`、`awaitPromise?` | `source`、`value/result` | 执行控制台表达式 |
293
+
294
+ 该工具默认关闭,必须配置 `runtime.evaluate.enabled: true`。CDP 可用时使用 `Runtime.evaluate`,否则使用 Runtime Hook fallback。
295
+
296
+ ### Network 工具
297
+
298
+ | 工具 | 输入 | 输出 | 说明 |
299
+ |---|---|---|---|
300
+ | `get_network_requests` | `pageId?`、`urlContains?`、`method?`、`status?`、`limit?` | `requests` | 获取请求列表 |
301
+ | `get_network_request_detail` | `id` | `request` | 获取单条请求详情 |
302
+ | `clear_network_requests` | `pageId?` | `ok` | 清空请求缓存 |
303
+
304
+ Network 记录结构覆盖调试接口时最常见的三个问题:
305
+
306
+ ```ts
307
+ interface NetworkRecord {
308
+ id: string
309
+ pageId: string
310
+ source: 'cdp' | 'hook'
311
+ url: string
312
+ method: string
313
+ requestHeaders?: Record<string, string>
314
+ requestQuery?: Record<string, string | string[]>
315
+ requestBody?: unknown
316
+ status?: number
317
+ responseHeaders?: Record<string, string>
318
+ responseBody?: unknown
319
+ error?: string
320
+ startedAt: number
321
+ endedAt?: number
322
+ durationMs?: number
323
+ }
324
+ ```
325
+
326
+ - 请求了哪些接口:`url`、`method`
327
+ - 接口请求参数是什么:`requestQuery`、`requestBody`、`requestHeaders`
328
+ - 接口响应值是什么:`status`、`responseHeaders`、`responseBody`、`error`
329
+
330
+ ### Vue 专属工具
331
+
332
+ | 工具 | 输入 | 输出 | 说明 |
333
+ |---|---|---|---|
334
+ | `get_component_tree` | `pageId?` | `data` | 获取 Vue component tree |
335
+ | `get_component_state` | `pageId?`、`componentName` | `data` | 获取组件状态 |
336
+ | `edit_component_state` | `pageId?`、`componentName`、`path`、`value`、`valueType` | `ok` | 修改组件状态 |
337
+ | `highlight_component` | `pageId?`、`componentName` | `ok` | 高亮组件 |
338
+ | `get_router_info` | `pageId?` | `data` | 获取 Vue Router 信息 |
339
+ | `get_pinia_tree` | `pageId?` | `data` | 获取 Pinia inspector tree |
340
+ | `get_pinia_state` | `pageId?`、`storeName` | `data` | 获取 Pinia store state |
341
+
342
+ Vue 组件、Router、Pinia 是应用层语义,固定走 Vue Runtime Bridge,不用 CDP 替代。
343
+
344
+ ## 本地验证
345
+
346
+ ### 自动化检查
347
+
348
+ ```bash
349
+ pnpm run check
350
+ ```
351
+
352
+ 该命令会串行执行:
353
+
354
+ - `pnpm run typecheck`
355
+ - `pnpm run lint`
356
+ - `pnpm run test`
357
+ - `pnpm run build`
358
+
359
+ ### Playground 验证
360
+
361
+ ```bash
362
+ pnpm run play
363
+ ```
364
+
365
+ 启动后会输出:
366
+
367
+ ```text
368
+ Local: http://localhost:3456/
369
+ MCP: Server is running at http://localhost:3456/__mcp/sse
370
+ ```
371
+
372
+ 当前 playground 页面入口为:
373
+
374
+ ```text
375
+ http://localhost:3456/playground/index.html
376
+ ```
377
+
378
+ ### MCP Inspector 验证
379
+
380
+ ```bash
381
+ pnpm run inspect:mcp
382
+ ```
383
+
384
+ 在 Inspector 中连接:
385
+
386
+ ```text
387
+ http://localhost:3456/__mcp/sse
388
+ ```
389
+
390
+ 推荐按以下顺序测试:
391
+
392
+ 1. 调用 `list_pages`,确认能看到 `runtime-*` 或 `cdp:*` 页面
393
+ 2. 调用 `query_dom`,例如 selector 使用 `[data-testid="count"]`
394
+ 3. 调用 `evaluate_script`,例如表达式使用 `document.title`
395
+ 4. 在页面点击 Console Log,再调用 `get_console_logs`
396
+ 5. 在页面点击 Network Request,再调用 `get_network_requests`
397
+ 6. 调用 `get_component_tree`
398
+ 7. 调用 `get_router_info`
399
+ 8. 调用 `get_pinia_tree` 和 `get_pinia_state`
400
+
401
+ ### CDP 验证
402
+
403
+ 先确认 CDP endpoint 可用:
404
+
405
+ ```bash
406
+ curl -fsS http://127.0.0.1:9222/json/version
407
+ curl -fsS http://127.0.0.1:9222/json/list
408
+ ```
409
+
410
+ 在插件中配置:
411
+
412
+ ```ts
413
+ vueMcpNext({
414
+ cdp: {
415
+ browserUrl: 'http://127.0.0.1:9222',
416
+ targetUrlPattern: 'localhost:3456/playground/index.html'
417
+ },
418
+ runtime: {
419
+ evaluate: {
420
+ enabled: true
421
+ }
422
+ }
423
+ })
424
+ ```
425
+
426
+ CDP 验证通过时,以下工具返回中应出现 `source: 'cdp'`:
427
+
428
+ - `get_dom_tree`
429
+ - `query_dom`
430
+ - `evaluate_script`
431
+ - `get_console_logs`
432
+ - `get_network_requests`
433
+
434
+ ## 已验证结果
435
+
436
+ 当前实现已通过以下验证:
437
+
438
+ - MCP SSE 服务可连接
439
+ - `tools/list` 可枚举 16 个 MCP 工具
440
+ - `list_pages` 可返回 Vite entry、runtime 页面和 CDP target
441
+ - Runtime Hook 可读取 DOM、Console、Network
442
+ - Runtime Hook 可执行已授权表达式
443
+ - Vue Runtime Bridge 可读取组件树、Router、Pinia tree/state
444
+ - CDP 可读取 DOM tree、selector 查询、Evaluate、Console、Network
445
+ - `pnpm run check` 通过
446
+ - `git diff --check` 通过
447
+
448
+ ## 限制与边界
449
+
450
+ - 生产构建默认不启用调试采集。
451
+ - Hook Network 只覆盖 `fetch` 和 `XMLHttpRequest`,不覆盖所有静态资源、浏览器内部请求或扩展请求。
452
+ - 最接近 Chrome DevTools Network 面板的行为需要配置 CDP。
453
+ - Hook fallback 的 `evaluate_script` 只支持表达式,不支持完整语句块。
454
+ - DOM、日志和 Network 都有默认缓存或输出上限,响应体和长文本会被裁剪。
455
+ - Vue 组件、Router、Pinia 能力固定走 Vue Runtime Bridge,不用 CDP 替代。
456
+ - CDP 只连接用户提供的 `browserUrl` 或 `wsEndpoint`,插件不负责启动 Chrome。
457
+
458
+ ## 脚本
459
+
460
+ | 脚本 | 说明 |
461
+ |---|---|
462
+ | `pnpm run build` | 构建 ESM、CJS 和类型声明 |
463
+ | `pnpm run dev` | 以 watch 模式构建 |
464
+ | `pnpm run typecheck` | 执行 TypeScript 静态检查 |
465
+ | `pnpm run lint` | 执行 ESLint 检查 |
466
+ | `pnpm run test` | 执行 Vitest 测试 |
467
+ | `pnpm run check` | 串行执行类型检查、Lint、测试和构建 |
468
+ | `pnpm run play` | 启动本地 playground |
469
+ | `pnpm run inspect:mcp` | 启动 MCP Inspector |
470
+
471
+ ## 发布到 npm
472
+
473
+ 包名已经配置为:
474
+
475
+ ```text
476
+ @xiaou66/vite-plugin-vue-mcp-next
477
+ ```
478
+
479
+ 发布前需要确认 npm 已登录,并且账号具备 `@xiaou66` scope 的发布权限:
480
+
481
+ ```bash
482
+ npm whoami
483
+ ```
484
+
485
+ 如果未登录:
486
+
487
+ ```bash
488
+ npm login
489
+ ```
490
+
491
+ 发布前检查:
492
+
493
+ ```bash
494
+ pnpm install --frozen-lockfile
495
+ pnpm run check
496
+ pnpm run pack:dry-run
497
+ ```
498
+
499
+ 正式发布:
500
+
501
+ ```bash
502
+ pnpm run publish:npm
503
+ ```
504
+
505
+ 该包是 scoped package,`package.json` 已配置:
506
+
507
+ ```json
508
+ {
509
+ "publishConfig": {
510
+ "access": "public",
511
+ "registry": "https://registry.npmjs.org/"
512
+ }
513
+ }
514
+ ```
515
+
516
+ 因此也可以直接执行:
517
+
518
+ ```bash
519
+ npm publish
520
+ ```
521
+
522
+ 发布脚本会在 `prepublishOnly` 阶段自动执行 `pnpm run check`。该检查会生成 `dist/`,npm 发布包只包含 `dist`、`README.md` 和 `LICENSE`。
523
+
524
+ 当前发布配置包含:
525
+
526
+ - `license: MIT`
527
+ - `repository: git+https://github.com/xiaou66/vite-plugin-vue-mcp-next.git`
528
+ - `homepage: https://github.com/xiaou66/vite-plugin-vue-mcp-next#readme`
529
+ - `bugs: https://github.com/xiaou66/vite-plugin-vue-mcp-next/issues`
530
+ - `publishConfig.access: public`
531
+ - `files: dist, README.md, LICENSE`