@page-mcp/vue2 1.0.0 → 2.0.0

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
@@ -1,16 +1,18 @@
1
1
  # @page-mcp/vue2
2
2
 
3
- Page MCP SDK Vue 2 适配器。提供 Plugin Mixin。
3
+ Vue 2 adapter for the Page MCP SDK. Provides a Plugin and Mixin for easy integration.
4
4
 
5
- ## 安装
5
+ > 🌐 **Live Preview:** [https://page-mcp.org](https://page-mcp.org)
6
+
7
+ ## Installation
6
8
 
7
9
  ```bash
8
10
  npm install @page-mcp/core @page-mcp/vue2
9
11
  ```
10
12
 
11
- ## 使用
13
+ ## Quick Start
12
14
 
13
- ### 安装 Plugin
15
+ ### 1. Install Plugin
14
16
 
15
17
  ```javascript
16
18
  // main.js
@@ -20,60 +22,74 @@ import { PageMcpPlugin } from '@page-mcp/vue2';
20
22
  Vue.use(PageMcpPlugin, { name: 'my-app', version: '1.0' });
21
23
  ```
22
24
 
23
- ### 方式一:通过 `this.$pageMcp`
24
-
25
- ```javascript
26
- export default {
27
- methods: {
28
- async init() {
29
- // 注册工具
30
- this.$pageMcp.host.registerTool({
31
- name: 'search',
32
- description: '搜索',
33
- parameters: { type: 'object', properties: { q: { type: 'string' } } },
34
- handler: async (args) => this.doSearch(args.q)
35
- });
36
-
37
- // 获取工具列表
38
- const tools = await this.$pageMcp.client.listTools();
39
- }
40
- }
41
- };
42
- ```
25
+ ### 2. Option A: Component Options (Recommended)
43
26
 
44
- ### 方式二:组件选项自动注册(推荐)
27
+ Declare tools, resources, and skills directly in component options. They are auto-registered on `created` and cleaned up on `beforeDestroy`.
45
28
 
46
29
  ```javascript
47
30
  export default {
48
31
  pageMcpTools: [
49
32
  {
50
33
  name: 'getTableData',
51
- description: '获取表格数据',
52
- parameters: { type: 'object', properties: {} },
53
- handler: async () => store.state.tableData
34
+ description: 'Get current table data',
35
+ inputSchema: { type: 'object', properties: {} },
36
+ execute: async function() { return this.tableData; }
54
37
  }
55
38
  ],
56
39
 
57
40
  pageMcpResources: [
58
41
  {
59
42
  uri: 'page://table/data',
60
- name: '表格数据',
61
- description: '当前展示的表格数据',
43
+ name: 'Table Data',
44
+ description: 'Data displayed in the table',
62
45
  handler: async () => ({ rows: store.state.tableData })
63
46
  }
64
47
  ]
65
48
  };
66
49
  ```
67
50
 
51
+ ### 2. Option B: Use `this.$pageMcp` Directly
52
+
53
+ ```javascript
54
+ export default {
55
+ methods: {
56
+ async init() {
57
+ // Register a tool
58
+ this.$pageMcp.host.registerTool({
59
+ name: 'search',
60
+ description: 'Search records',
61
+ inputSchema: { type: 'object', properties: { q: { type: 'string' } } },
62
+ execute: async (args) => this.doSearch(args.q)
63
+ });
64
+
65
+ // Discover tools from AI side
66
+ const tools = await this.$pageMcp.client.toolsList();
67
+ console.log('Available tools:', tools);
68
+ }
69
+ }
70
+ };
71
+ ```
72
+
68
73
  ## API
69
74
 
70
- | API | 描述 |
71
- |-----|------|
72
- | `this.$pageMcp.host` | PageMcpHost 实例 |
73
- | `this.$pageMcp.client` | PageMcpClient 实例 |
74
- | `this.$pageMcp.bus` | EventBus 实例 |
75
- | `pageMcpTools` 选项 | 自动注册的工具数组 |
76
- | `pageMcpResources` 选项 | 自动注册的资源数组 |
77
- | `pageMcpSkills` 选项 | 自动注册的技能数组 |
75
+ | API | Description |
76
+ |---|---|
77
+ | `this.$pageMcp.host` | `PageMcpHost` instance |
78
+ | `this.$pageMcp.client` | `PageMcpClient` instance |
79
+ | `this.$pageMcp.skills` | Extensions skills client |
80
+ | `this.$pageMcp.bus` | `EventBus` instance |
81
+ | `pageMcpTools` option | Array of tools auto-registered on component create |
82
+ | `pageMcpResources` option | Array of resources auto-registered on component create |
83
+ | `pageMcpSkills` option | Array of skills auto-registered on component create |
84
+
85
+ ## How It Works
86
+
87
+ - `PageMcpPlugin` creates `EventBus`, `PageMcpHost`, and `PageMcpClient` instances and attaches them to `Vue.prototype.$pageMcp`.
88
+ - A global mixin reads `pageMcpTools`, `pageMcpResources`, `pageMcpSkills`, and `pageMcpPrompts` from component options and registers them during `created`, cleaning up in `beforeDestroy`.
89
+ - The Host is started automatically when the Plugin is installed.
90
+
91
+ For detailed documentation, see the [main README](../../README.md#vue-2-page-mcpvue2).
92
+
93
+ ## License
78
94
 
79
- 详细文档请参阅 [主 README](../../README.md#vue-2-page-mcpvue2)。
95
+ MIT
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  EventBus: () => import_core2.EventBus,
24
+ Extensions: () => import_core2.Extensions,
24
25
  PageMcpClient: () => import_core2.PageMcpClient,
25
26
  PageMcpHost: () => import_core2.PageMcpHost,
26
27
  PageMcpPlugin: () => PageMcpPlugin,
@@ -34,10 +35,11 @@ var PageMcpPlugin = {
34
35
  const bus = options.bus ?? new import_core.EventBus();
35
36
  const host = new import_core.PageMcpHost({ name: options.name, version: options.version, bus });
36
37
  const client = new import_core.PageMcpClient({ bus });
38
+ const skills = import_core.Extensions.createSkillsClient(client);
37
39
  const hostInfo = { name: options.name, version: options.version };
38
40
  host.start();
39
41
  client.connect();
40
- const injection = { host, client, bus, hostInfo };
42
+ const injection = { host, client, skills, bus, hostInfo };
41
43
  Vue.prototype.$pageMcp = injection;
42
44
  Vue.mixin(pageMcpAutoRegisterMixin);
43
45
  }
@@ -47,11 +49,18 @@ var pageMcpAutoRegisterMixin = {
47
49
  const pageMcp = this.$pageMcp;
48
50
  if (!pageMcp) return;
49
51
  const { host } = pageMcp;
52
+ this.__pageMcpRegistered = {
53
+ tools: [],
54
+ resources: [],
55
+ skills: [],
56
+ prompts: []
57
+ };
50
58
  const tools = this.$options.pageMcpTools;
51
59
  if (tools && Array.isArray(tools)) {
52
60
  for (const tool of tools) {
53
61
  try {
54
62
  host.registerTool(tool);
63
+ this.__pageMcpRegistered.tools.push(tool.name);
55
64
  } catch {
56
65
  }
57
66
  }
@@ -61,6 +70,7 @@ var pageMcpAutoRegisterMixin = {
61
70
  for (const resource of resources) {
62
71
  try {
63
72
  host.registerResource(resource);
73
+ this.__pageMcpRegistered.resources.push(resource.uri);
64
74
  } catch {
65
75
  }
66
76
  }
@@ -70,15 +80,57 @@ var pageMcpAutoRegisterMixin = {
70
80
  for (const skill of skills) {
71
81
  try {
72
82
  host.registerSkill(skill);
83
+ this.__pageMcpRegistered.skills.push(skill.name);
73
84
  } catch {
74
85
  }
75
86
  }
76
87
  }
88
+ const prompts = this.$options.pageMcpPrompts;
89
+ if (prompts && Array.isArray(prompts)) {
90
+ for (const prompt of prompts) {
91
+ try {
92
+ host.registerPrompt(prompt);
93
+ this.__pageMcpRegistered.prompts.push(prompt.name);
94
+ } catch {
95
+ }
96
+ }
97
+ }
98
+ },
99
+ beforeDestroy() {
100
+ const pageMcp = this.$pageMcp;
101
+ const registered = this.__pageMcpRegistered;
102
+ if (!pageMcp || !registered) return;
103
+ const { host } = pageMcp;
104
+ for (const name of registered.tools) {
105
+ try {
106
+ host.unregisterTool(name);
107
+ } catch {
108
+ }
109
+ }
110
+ for (const uri of registered.resources) {
111
+ try {
112
+ host.unregisterResource(uri);
113
+ } catch {
114
+ }
115
+ }
116
+ for (const name of registered.skills) {
117
+ try {
118
+ host.unregisterSkill(name);
119
+ } catch {
120
+ }
121
+ }
122
+ for (const name of registered.prompts) {
123
+ try {
124
+ host.unregisterPrompt(name);
125
+ } catch {
126
+ }
127
+ }
77
128
  }
78
129
  };
79
130
  // Annotate the CommonJS export names for ESM import in node:
80
131
  0 && (module.exports = {
81
132
  EventBus,
133
+ Extensions,
82
134
  PageMcpClient,
83
135
  PageMcpHost,
84
136
  PageMcpPlugin,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ============================================================\n// @page-mcp/vue2 — Vue 2 Adapter for Page MCP SDK\n// ============================================================\n\nimport {\n PageMcpHost,\n PageMcpClient,\n EventBus,\n type ToolDefinition,\n type ResourceDefinition,\n type SkillDefinition,\n type HostInfo,\n} from '@page-mcp/core';\n\n// ------ Types for Vue 2 ------\n\ninterface Vue2ComponentOptions {\n beforeCreate?: () => void;\n created?: () => void;\n beforeDestroy?: () => void;\n [key: string]: unknown;\n}\n\ninterface Vue2Instance {\n $pageMcp?: PageMcpInjection;\n $options: {\n pageMcpTools?: ToolDefinition[];\n pageMcpResources?: ResourceDefinition[];\n pageMcpSkills?: SkillDefinition[];\n parent?: Vue2Instance;\n [key: string]: unknown;\n };\n $root: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface Vue2Constructor {\n mixin(mixin: Vue2ComponentOptions): void;\n prototype: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface PageMcpInjection {\n host: PageMcpHost;\n client: PageMcpClient;\n bus: EventBus;\n hostInfo: HostInfo;\n}\n\n// ------ Plugin ------\n\nexport interface PageMcpPluginOptions {\n name: string;\n version: string;\n bus?: EventBus;\n}\n\n/**\n * Vue 2 Plugin. Install globally:\n *\n * ```js\n * import Vue from 'vue';\n * import { PageMcpPlugin } from '@page-mcp/vue2';\n *\n * Vue.use(PageMcpPlugin, { name: 'my-app', version: '1.0' });\n * ```\n *\n * After installation, `this.$pageMcp` is available in all components:\n * - `this.$pageMcp.host` — PageMcpHost instance\n * - `this.$pageMcp.client` — PageMcpClient instance\n * - `this.$pageMcp.bus` — EventBus instance\n */\nexport const PageMcpPlugin = {\n install(Vue: Vue2Constructor, options: PageMcpPluginOptions): void {\n const bus = options.bus ?? new EventBus();\n const host = new PageMcpHost({ name: options.name, version: options.version, bus });\n const client = new PageMcpClient({ bus });\n const hostInfo: HostInfo = { name: options.name, version: options.version };\n\n host.start();\n client.connect();\n\n const injection: PageMcpInjection = { host, client, bus, hostInfo };\n\n // Make $pageMcp available in all components\n Vue.prototype.$pageMcp = injection;\n\n // Install the auto-registration mixin\n Vue.mixin(pageMcpAutoRegisterMixin);\n },\n};\n\n// ------ Mixin ------\n\n/**\n * Mixin that auto-registers tools/resources/skills defined in component options.\n *\n * ```js\n * export default {\n * pageMcpTools: [\n * {\n * name: 'search',\n * description: 'Search products',\n * parameters: { type: 'object', properties: { q: { type: 'string' } } },\n * handler: async (args) => this.searchProducts(args.q),\n * }\n * ],\n * pageMcpResources: [...],\n * pageMcpSkills: [...],\n * }\n * ```\n */\nconst pageMcpAutoRegisterMixin: Vue2ComponentOptions = {\n created(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n if (!pageMcp) return;\n\n const { host } = pageMcp;\n\n // Register tools from component options\n const tools = this.$options.pageMcpTools;\n if (tools && Array.isArray(tools)) {\n for (const tool of tools) {\n try {\n host.registerTool(tool);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register resources from component options\n const resources = this.$options.pageMcpResources;\n if (resources && Array.isArray(resources)) {\n for (const resource of resources) {\n try {\n host.registerResource(resource);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register skills from component options\n const skills = this.$options.pageMcpSkills;\n if (skills && Array.isArray(skills)) {\n for (const skill of skills) {\n try {\n host.registerSkill(skill);\n } catch {\n // Already registered\n }\n }\n }\n },\n};\n\n/**\n * Standalone mixin for manual use (without the plugin).\n * Useful when you want to use the mixin pattern explicitly.\n */\nexport { pageMcpAutoRegisterMixin as pageMcpMixin };\n\n// ------ Re-exports ------\n\nexport {\n PageMcpHost,\n PageMcpClient,\n EventBus,\n} from '@page-mcp/core';\n\nexport type {\n ToolDefinition,\n ToolInfo,\n ResourceDefinition,\n ResourceInfo,\n SkillDefinition,\n SkillInfo,\n SkillResult,\n HostInfo,\n} from '@page-mcp/core';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAQO;AAyJP,IAAAA,eAIO;AAjGA,IAAM,gBAAgB;AAAA,EACzB,QAAQ,KAAsB,SAAqC;AAC/D,UAAM,MAAM,QAAQ,OAAO,IAAI,qBAAS;AACxC,UAAM,OAAO,IAAI,wBAAY,EAAE,MAAM,QAAQ,MAAM,SAAS,QAAQ,SAAS,IAAI,CAAC;AAClF,UAAM,SAAS,IAAI,0BAAc,EAAE,IAAI,CAAC;AACxC,UAAM,WAAqB,EAAE,MAAM,QAAQ,MAAM,SAAS,QAAQ,QAAQ;AAE1E,SAAK,MAAM;AACX,WAAO,QAAQ;AAEf,UAAM,YAA8B,EAAE,MAAM,QAAQ,KAAK,SAAS;AAGlE,QAAI,UAAU,WAAW;AAGzB,QAAI,MAAM,wBAAwB;AAAA,EACtC;AACJ;AAsBA,IAAM,2BAAiD;AAAA,EACnD,UAA4B;AACxB,UAAM,UAAU,KAAK;AACrB,QAAI,CAAC,QAAS;AAEd,UAAM,EAAE,KAAK,IAAI;AAGjB,UAAM,QAAQ,KAAK,SAAS;AAC5B,QAAI,SAAS,MAAM,QAAQ,KAAK,GAAG;AAC/B,iBAAW,QAAQ,OAAO;AACtB,YAAI;AACA,eAAK,aAAa,IAAI;AAAA,QAC1B,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAGA,UAAM,YAAY,KAAK,SAAS;AAChC,QAAI,aAAa,MAAM,QAAQ,SAAS,GAAG;AACvC,iBAAW,YAAY,WAAW;AAC9B,YAAI;AACA,eAAK,iBAAiB,QAAQ;AAAA,QAClC,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAGA,UAAM,SAAS,KAAK,SAAS;AAC7B,QAAI,UAAU,MAAM,QAAQ,MAAM,GAAG;AACjC,iBAAW,SAAS,QAAQ;AACxB,YAAI;AACA,eAAK,cAAc,KAAK;AAAA,QAC5B,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["import_core"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ============================================================\n// @page-mcp/vue2 — Vue 2 Adapter for Page MCP SDK\n// ============================================================\n\nimport {\n Extensions,\n PageMcpHost,\n PageMcpClient,\n EventBus,\n type ToolDefinition,\n type ResourceDefinition,\n type SkillDefinition,\n type PromptDefinition,\n type HostInfo,\n} from '@page-mcp/core';\n\n// ------ Types for Vue 2 ------\n\ninterface Vue2ComponentOptions {\n beforeCreate?: () => void;\n created?: () => void;\n beforeDestroy?: () => void;\n [key: string]: unknown;\n}\n\ninterface Vue2Instance {\n $pageMcp?: PageMcpInjection;\n $options: {\n pageMcpTools?: ToolDefinition[];\n pageMcpResources?: ResourceDefinition[];\n pageMcpSkills?: SkillDefinition[];\n pageMcpPrompts?: PromptDefinition[];\n parent?: Vue2Instance;\n [key: string]: unknown;\n };\n $root: Vue2Instance;\n __pageMcpRegistered?: {\n tools: string[];\n resources: string[];\n skills: string[];\n prompts: string[];\n };\n [key: string]: unknown;\n}\n\ninterface Vue2Constructor {\n mixin(mixin: Vue2ComponentOptions): void;\n prototype: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface PageMcpInjection {\n host: PageMcpHost;\n client: PageMcpClient;\n skills: InstanceType<typeof Extensions.SkillsClient>;\n bus: EventBus;\n hostInfo: HostInfo;\n}\n\n// ------ Plugin ------\n\nexport interface PageMcpPluginOptions {\n name: string;\n version: string;\n bus?: EventBus;\n}\n\n/**\n * Vue 2 Plugin. Install globally:\n *\n * ```js\n * import Vue from 'vue';\n * import { PageMcpPlugin } from '@page-mcp/vue2';\n *\n * Vue.use(PageMcpPlugin, { name: 'my-app', version: '1.0' });\n * ```\n *\n * After installation, `this.$pageMcp` is available in all components:\n * - `this.$pageMcp.host` — PageMcpHost instance\n * - `this.$pageMcp.client` — PageMcpClient instance\n * - `this.$pageMcp.bus` — EventBus instance\n */\nexport const PageMcpPlugin = {\n install(Vue: Vue2Constructor, options: PageMcpPluginOptions): void {\n const bus = options.bus ?? new EventBus();\n const host = new PageMcpHost({ name: options.name, version: options.version, bus });\n const client = new PageMcpClient({ bus });\n const skills = Extensions.createSkillsClient(client);\n const hostInfo: HostInfo = { name: options.name, version: options.version };\n\n host.start();\n client.connect();\n\n const injection: PageMcpInjection = { host, client, skills, bus, hostInfo };\n\n // Make $pageMcp available in all components\n Vue.prototype.$pageMcp = injection;\n\n // Install the auto-registration mixin\n Vue.mixin(pageMcpAutoRegisterMixin);\n },\n};\n\n// ------ Mixin ------\n\n/**\n * Mixin that auto-registers tools/resources/skills defined in component options.\n *\n * ```js\n * export default {\n * pageMcpTools: [\n * {\n * name: 'search',\n * description: 'Search products',\n * parameters: { type: 'object', properties: { q: { type: 'string' } } },\n * handler: async (args) => this.searchProducts(args.q),\n * }\n * ],\n * pageMcpResources: [...],\n * pageMcpSkills: [...],\n * }\n * ```\n */\nconst pageMcpAutoRegisterMixin: Vue2ComponentOptions = {\n created(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n if (!pageMcp) return;\n\n const { host } = pageMcp;\n this.__pageMcpRegistered = {\n tools: [],\n resources: [],\n skills: [],\n prompts: [],\n };\n\n // Register tools from component options\n const tools = this.$options.pageMcpTools;\n if (tools && Array.isArray(tools)) {\n for (const tool of tools) {\n try {\n host.registerTool(tool);\n this.__pageMcpRegistered.tools.push(tool.name);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register resources from component options\n const resources = this.$options.pageMcpResources;\n if (resources && Array.isArray(resources)) {\n for (const resource of resources) {\n try {\n host.registerResource(resource);\n this.__pageMcpRegistered.resources.push(resource.uri);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register skills from component options\n const skills = this.$options.pageMcpSkills;\n if (skills && Array.isArray(skills)) {\n for (const skill of skills) {\n try {\n host.registerSkill(skill);\n this.__pageMcpRegistered.skills.push(skill.name);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register prompts from component options\n const prompts = this.$options.pageMcpPrompts;\n if (prompts && Array.isArray(prompts)) {\n for (const prompt of prompts) {\n try {\n host.registerPrompt(prompt);\n this.__pageMcpRegistered.prompts.push(prompt.name);\n } catch {\n // Already registered\n }\n }\n }\n },\n beforeDestroy(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n const registered = this.__pageMcpRegistered;\n if (!pageMcp || !registered) return;\n const { host } = pageMcp;\n\n for (const name of registered.tools) {\n try { host.unregisterTool(name); } catch { /* noop */ }\n }\n for (const uri of registered.resources) {\n try { host.unregisterResource(uri); } catch { /* noop */ }\n }\n for (const name of registered.skills) {\n try { host.unregisterSkill(name); } catch { /* noop */ }\n }\n for (const name of registered.prompts) {\n try { host.unregisterPrompt(name); } catch { /* noop */ }\n }\n },\n};\n\n/**\n * Standalone mixin for manual use (without the plugin).\n * Useful when you want to use the mixin pattern explicitly.\n */\nexport { pageMcpAutoRegisterMixin as pageMcpMixin };\n\n// ------ Re-exports ------\n\nexport {\n Extensions,\n PageMcpHost,\n PageMcpClient,\n EventBus,\n} from '@page-mcp/core';\n\nexport type {\n ToolDefinition,\n ToolInfo,\n ResourceDefinition,\n ResourceInfo,\n SkillDefinition,\n SkillInfo,\n SkillGetResult,\n SkillExecutionResult,\n SkillExecutionContext,\n PromptDefinition,\n PromptInfo,\n HostInfo,\n} from '@page-mcp/core';\n"],"mappings":"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","names":["import_core"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { PageMcpHost, PageMcpClient, EventBus, HostInfo, ToolDefinition, ResourceDefinition, SkillDefinition } from '@page-mcp/core';
2
- export { EventBus, HostInfo, PageMcpClient, PageMcpHost, ResourceDefinition, ResourceInfo, SkillDefinition, SkillInfo, SkillResult, ToolDefinition, ToolInfo } from '@page-mcp/core';
1
+ import { PageMcpHost, PageMcpClient, Extensions, EventBus, HostInfo, ToolDefinition, ResourceDefinition, SkillDefinition, PromptDefinition } from '@page-mcp/core';
2
+ export { EventBus, Extensions, HostInfo, PageMcpClient, PageMcpHost, PromptDefinition, PromptInfo, ResourceDefinition, ResourceInfo, SkillDefinition, SkillExecutionContext, SkillExecutionResult, SkillGetResult, SkillInfo, ToolDefinition, ToolInfo } from '@page-mcp/core';
3
3
 
4
4
  interface Vue2ComponentOptions {
5
5
  beforeCreate?: () => void;
@@ -13,10 +13,17 @@ interface Vue2Instance {
13
13
  pageMcpTools?: ToolDefinition[];
14
14
  pageMcpResources?: ResourceDefinition[];
15
15
  pageMcpSkills?: SkillDefinition[];
16
+ pageMcpPrompts?: PromptDefinition[];
16
17
  parent?: Vue2Instance;
17
18
  [key: string]: unknown;
18
19
  };
19
20
  $root: Vue2Instance;
21
+ __pageMcpRegistered?: {
22
+ tools: string[];
23
+ resources: string[];
24
+ skills: string[];
25
+ prompts: string[];
26
+ };
20
27
  [key: string]: unknown;
21
28
  }
22
29
  interface Vue2Constructor {
@@ -27,6 +34,7 @@ interface Vue2Constructor {
27
34
  interface PageMcpInjection {
28
35
  host: PageMcpHost;
29
36
  client: PageMcpClient;
37
+ skills: InstanceType<typeof Extensions.SkillsClient>;
30
38
  bus: EventBus;
31
39
  hostInfo: HostInfo;
32
40
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PageMcpHost, PageMcpClient, EventBus, HostInfo, ToolDefinition, ResourceDefinition, SkillDefinition } from '@page-mcp/core';
2
- export { EventBus, HostInfo, PageMcpClient, PageMcpHost, ResourceDefinition, ResourceInfo, SkillDefinition, SkillInfo, SkillResult, ToolDefinition, ToolInfo } from '@page-mcp/core';
1
+ import { PageMcpHost, PageMcpClient, Extensions, EventBus, HostInfo, ToolDefinition, ResourceDefinition, SkillDefinition, PromptDefinition } from '@page-mcp/core';
2
+ export { EventBus, Extensions, HostInfo, PageMcpClient, PageMcpHost, PromptDefinition, PromptInfo, ResourceDefinition, ResourceInfo, SkillDefinition, SkillExecutionContext, SkillExecutionResult, SkillGetResult, SkillInfo, ToolDefinition, ToolInfo } from '@page-mcp/core';
3
3
 
4
4
  interface Vue2ComponentOptions {
5
5
  beforeCreate?: () => void;
@@ -13,10 +13,17 @@ interface Vue2Instance {
13
13
  pageMcpTools?: ToolDefinition[];
14
14
  pageMcpResources?: ResourceDefinition[];
15
15
  pageMcpSkills?: SkillDefinition[];
16
+ pageMcpPrompts?: PromptDefinition[];
16
17
  parent?: Vue2Instance;
17
18
  [key: string]: unknown;
18
19
  };
19
20
  $root: Vue2Instance;
21
+ __pageMcpRegistered?: {
22
+ tools: string[];
23
+ resources: string[];
24
+ skills: string[];
25
+ prompts: string[];
26
+ };
20
27
  [key: string]: unknown;
21
28
  }
22
29
  interface Vue2Constructor {
@@ -27,6 +34,7 @@ interface Vue2Constructor {
27
34
  interface PageMcpInjection {
28
35
  host: PageMcpHost;
29
36
  client: PageMcpClient;
37
+ skills: InstanceType<typeof Extensions.SkillsClient>;
30
38
  bus: EventBus;
31
39
  hostInfo: HostInfo;
32
40
  }
package/dist/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  // src/index.ts
2
2
  import {
3
+ Extensions,
3
4
  PageMcpHost,
4
5
  PageMcpClient,
5
6
  EventBus
6
7
  } from "@page-mcp/core";
7
8
  import {
9
+ Extensions as Extensions2,
8
10
  PageMcpHost as PageMcpHost2,
9
11
  PageMcpClient as PageMcpClient2,
10
12
  EventBus as EventBus2
@@ -14,10 +16,11 @@ var PageMcpPlugin = {
14
16
  const bus = options.bus ?? new EventBus();
15
17
  const host = new PageMcpHost({ name: options.name, version: options.version, bus });
16
18
  const client = new PageMcpClient({ bus });
19
+ const skills = Extensions.createSkillsClient(client);
17
20
  const hostInfo = { name: options.name, version: options.version };
18
21
  host.start();
19
22
  client.connect();
20
- const injection = { host, client, bus, hostInfo };
23
+ const injection = { host, client, skills, bus, hostInfo };
21
24
  Vue.prototype.$pageMcp = injection;
22
25
  Vue.mixin(pageMcpAutoRegisterMixin);
23
26
  }
@@ -27,11 +30,18 @@ var pageMcpAutoRegisterMixin = {
27
30
  const pageMcp = this.$pageMcp;
28
31
  if (!pageMcp) return;
29
32
  const { host } = pageMcp;
33
+ this.__pageMcpRegistered = {
34
+ tools: [],
35
+ resources: [],
36
+ skills: [],
37
+ prompts: []
38
+ };
30
39
  const tools = this.$options.pageMcpTools;
31
40
  if (tools && Array.isArray(tools)) {
32
41
  for (const tool of tools) {
33
42
  try {
34
43
  host.registerTool(tool);
44
+ this.__pageMcpRegistered.tools.push(tool.name);
35
45
  } catch {
36
46
  }
37
47
  }
@@ -41,6 +51,7 @@ var pageMcpAutoRegisterMixin = {
41
51
  for (const resource of resources) {
42
52
  try {
43
53
  host.registerResource(resource);
54
+ this.__pageMcpRegistered.resources.push(resource.uri);
44
55
  } catch {
45
56
  }
46
57
  }
@@ -50,14 +61,56 @@ var pageMcpAutoRegisterMixin = {
50
61
  for (const skill of skills) {
51
62
  try {
52
63
  host.registerSkill(skill);
64
+ this.__pageMcpRegistered.skills.push(skill.name);
53
65
  } catch {
54
66
  }
55
67
  }
56
68
  }
69
+ const prompts = this.$options.pageMcpPrompts;
70
+ if (prompts && Array.isArray(prompts)) {
71
+ for (const prompt of prompts) {
72
+ try {
73
+ host.registerPrompt(prompt);
74
+ this.__pageMcpRegistered.prompts.push(prompt.name);
75
+ } catch {
76
+ }
77
+ }
78
+ }
79
+ },
80
+ beforeDestroy() {
81
+ const pageMcp = this.$pageMcp;
82
+ const registered = this.__pageMcpRegistered;
83
+ if (!pageMcp || !registered) return;
84
+ const { host } = pageMcp;
85
+ for (const name of registered.tools) {
86
+ try {
87
+ host.unregisterTool(name);
88
+ } catch {
89
+ }
90
+ }
91
+ for (const uri of registered.resources) {
92
+ try {
93
+ host.unregisterResource(uri);
94
+ } catch {
95
+ }
96
+ }
97
+ for (const name of registered.skills) {
98
+ try {
99
+ host.unregisterSkill(name);
100
+ } catch {
101
+ }
102
+ }
103
+ for (const name of registered.prompts) {
104
+ try {
105
+ host.unregisterPrompt(name);
106
+ } catch {
107
+ }
108
+ }
57
109
  }
58
110
  };
59
111
  export {
60
112
  EventBus2 as EventBus,
113
+ Extensions2 as Extensions,
61
114
  PageMcpClient2 as PageMcpClient,
62
115
  PageMcpHost2 as PageMcpHost,
63
116
  PageMcpPlugin,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ============================================================\n// @page-mcp/vue2 — Vue 2 Adapter for Page MCP SDK\n// ============================================================\n\nimport {\n PageMcpHost,\n PageMcpClient,\n EventBus,\n type ToolDefinition,\n type ResourceDefinition,\n type SkillDefinition,\n type HostInfo,\n} from '@page-mcp/core';\n\n// ------ Types for Vue 2 ------\n\ninterface Vue2ComponentOptions {\n beforeCreate?: () => void;\n created?: () => void;\n beforeDestroy?: () => void;\n [key: string]: unknown;\n}\n\ninterface Vue2Instance {\n $pageMcp?: PageMcpInjection;\n $options: {\n pageMcpTools?: ToolDefinition[];\n pageMcpResources?: ResourceDefinition[];\n pageMcpSkills?: SkillDefinition[];\n parent?: Vue2Instance;\n [key: string]: unknown;\n };\n $root: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface Vue2Constructor {\n mixin(mixin: Vue2ComponentOptions): void;\n prototype: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface PageMcpInjection {\n host: PageMcpHost;\n client: PageMcpClient;\n bus: EventBus;\n hostInfo: HostInfo;\n}\n\n// ------ Plugin ------\n\nexport interface PageMcpPluginOptions {\n name: string;\n version: string;\n bus?: EventBus;\n}\n\n/**\n * Vue 2 Plugin. Install globally:\n *\n * ```js\n * import Vue from 'vue';\n * import { PageMcpPlugin } from '@page-mcp/vue2';\n *\n * Vue.use(PageMcpPlugin, { name: 'my-app', version: '1.0' });\n * ```\n *\n * After installation, `this.$pageMcp` is available in all components:\n * - `this.$pageMcp.host` — PageMcpHost instance\n * - `this.$pageMcp.client` — PageMcpClient instance\n * - `this.$pageMcp.bus` — EventBus instance\n */\nexport const PageMcpPlugin = {\n install(Vue: Vue2Constructor, options: PageMcpPluginOptions): void {\n const bus = options.bus ?? new EventBus();\n const host = new PageMcpHost({ name: options.name, version: options.version, bus });\n const client = new PageMcpClient({ bus });\n const hostInfo: HostInfo = { name: options.name, version: options.version };\n\n host.start();\n client.connect();\n\n const injection: PageMcpInjection = { host, client, bus, hostInfo };\n\n // Make $pageMcp available in all components\n Vue.prototype.$pageMcp = injection;\n\n // Install the auto-registration mixin\n Vue.mixin(pageMcpAutoRegisterMixin);\n },\n};\n\n// ------ Mixin ------\n\n/**\n * Mixin that auto-registers tools/resources/skills defined in component options.\n *\n * ```js\n * export default {\n * pageMcpTools: [\n * {\n * name: 'search',\n * description: 'Search products',\n * parameters: { type: 'object', properties: { q: { type: 'string' } } },\n * handler: async (args) => this.searchProducts(args.q),\n * }\n * ],\n * pageMcpResources: [...],\n * pageMcpSkills: [...],\n * }\n * ```\n */\nconst pageMcpAutoRegisterMixin: Vue2ComponentOptions = {\n created(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n if (!pageMcp) return;\n\n const { host } = pageMcp;\n\n // Register tools from component options\n const tools = this.$options.pageMcpTools;\n if (tools && Array.isArray(tools)) {\n for (const tool of tools) {\n try {\n host.registerTool(tool);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register resources from component options\n const resources = this.$options.pageMcpResources;\n if (resources && Array.isArray(resources)) {\n for (const resource of resources) {\n try {\n host.registerResource(resource);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register skills from component options\n const skills = this.$options.pageMcpSkills;\n if (skills && Array.isArray(skills)) {\n for (const skill of skills) {\n try {\n host.registerSkill(skill);\n } catch {\n // Already registered\n }\n }\n }\n },\n};\n\n/**\n * Standalone mixin for manual use (without the plugin).\n * Useful when you want to use the mixin pattern explicitly.\n */\nexport { pageMcpAutoRegisterMixin as pageMcpMixin };\n\n// ------ Re-exports ------\n\nexport {\n PageMcpHost,\n PageMcpClient,\n EventBus,\n} from '@page-mcp/core';\n\nexport type {\n ToolDefinition,\n ToolInfo,\n ResourceDefinition,\n ResourceInfo,\n SkillDefinition,\n SkillInfo,\n SkillResult,\n HostInfo,\n} from '@page-mcp/core';\n"],"mappings":";AAIA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OAKG;AAyJP;AAAA,EACI,eAAAA;AAAA,EACA,iBAAAC;AAAA,EACA,YAAAC;AAAA,OACG;AAjGA,IAAM,gBAAgB;AAAA,EACzB,QAAQ,KAAsB,SAAqC;AAC/D,UAAM,MAAM,QAAQ,OAAO,IAAI,SAAS;AACxC,UAAM,OAAO,IAAI,YAAY,EAAE,MAAM,QAAQ,MAAM,SAAS,QAAQ,SAAS,IAAI,CAAC;AAClF,UAAM,SAAS,IAAI,cAAc,EAAE,IAAI,CAAC;AACxC,UAAM,WAAqB,EAAE,MAAM,QAAQ,MAAM,SAAS,QAAQ,QAAQ;AAE1E,SAAK,MAAM;AACX,WAAO,QAAQ;AAEf,UAAM,YAA8B,EAAE,MAAM,QAAQ,KAAK,SAAS;AAGlE,QAAI,UAAU,WAAW;AAGzB,QAAI,MAAM,wBAAwB;AAAA,EACtC;AACJ;AAsBA,IAAM,2BAAiD;AAAA,EACnD,UAA4B;AACxB,UAAM,UAAU,KAAK;AACrB,QAAI,CAAC,QAAS;AAEd,UAAM,EAAE,KAAK,IAAI;AAGjB,UAAM,QAAQ,KAAK,SAAS;AAC5B,QAAI,SAAS,MAAM,QAAQ,KAAK,GAAG;AAC/B,iBAAW,QAAQ,OAAO;AACtB,YAAI;AACA,eAAK,aAAa,IAAI;AAAA,QAC1B,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAGA,UAAM,YAAY,KAAK,SAAS;AAChC,QAAI,aAAa,MAAM,QAAQ,SAAS,GAAG;AACvC,iBAAW,YAAY,WAAW;AAC9B,YAAI;AACA,eAAK,iBAAiB,QAAQ;AAAA,QAClC,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAGA,UAAM,SAAS,KAAK,SAAS;AAC7B,QAAI,UAAU,MAAM,QAAQ,MAAM,GAAG;AACjC,iBAAW,SAAS,QAAQ;AACxB,YAAI;AACA,eAAK,cAAc,KAAK;AAAA,QAC5B,QAAQ;AAAA,QAER;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;","names":["PageMcpHost","PageMcpClient","EventBus"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// ============================================================\n// @page-mcp/vue2 — Vue 2 Adapter for Page MCP SDK\n// ============================================================\n\nimport {\n Extensions,\n PageMcpHost,\n PageMcpClient,\n EventBus,\n type ToolDefinition,\n type ResourceDefinition,\n type SkillDefinition,\n type PromptDefinition,\n type HostInfo,\n} from '@page-mcp/core';\n\n// ------ Types for Vue 2 ------\n\ninterface Vue2ComponentOptions {\n beforeCreate?: () => void;\n created?: () => void;\n beforeDestroy?: () => void;\n [key: string]: unknown;\n}\n\ninterface Vue2Instance {\n $pageMcp?: PageMcpInjection;\n $options: {\n pageMcpTools?: ToolDefinition[];\n pageMcpResources?: ResourceDefinition[];\n pageMcpSkills?: SkillDefinition[];\n pageMcpPrompts?: PromptDefinition[];\n parent?: Vue2Instance;\n [key: string]: unknown;\n };\n $root: Vue2Instance;\n __pageMcpRegistered?: {\n tools: string[];\n resources: string[];\n skills: string[];\n prompts: string[];\n };\n [key: string]: unknown;\n}\n\ninterface Vue2Constructor {\n mixin(mixin: Vue2ComponentOptions): void;\n prototype: Vue2Instance;\n [key: string]: unknown;\n}\n\ninterface PageMcpInjection {\n host: PageMcpHost;\n client: PageMcpClient;\n skills: InstanceType<typeof Extensions.SkillsClient>;\n bus: EventBus;\n hostInfo: HostInfo;\n}\n\n// ------ Plugin ------\n\nexport interface PageMcpPluginOptions {\n name: string;\n version: string;\n bus?: EventBus;\n}\n\n/**\n * Vue 2 Plugin. Install globally:\n *\n * ```js\n * import Vue from 'vue';\n * import { PageMcpPlugin } from '@page-mcp/vue2';\n *\n * Vue.use(PageMcpPlugin, { name: 'my-app', version: '1.0' });\n * ```\n *\n * After installation, `this.$pageMcp` is available in all components:\n * - `this.$pageMcp.host` — PageMcpHost instance\n * - `this.$pageMcp.client` — PageMcpClient instance\n * - `this.$pageMcp.bus` — EventBus instance\n */\nexport const PageMcpPlugin = {\n install(Vue: Vue2Constructor, options: PageMcpPluginOptions): void {\n const bus = options.bus ?? new EventBus();\n const host = new PageMcpHost({ name: options.name, version: options.version, bus });\n const client = new PageMcpClient({ bus });\n const skills = Extensions.createSkillsClient(client);\n const hostInfo: HostInfo = { name: options.name, version: options.version };\n\n host.start();\n client.connect();\n\n const injection: PageMcpInjection = { host, client, skills, bus, hostInfo };\n\n // Make $pageMcp available in all components\n Vue.prototype.$pageMcp = injection;\n\n // Install the auto-registration mixin\n Vue.mixin(pageMcpAutoRegisterMixin);\n },\n};\n\n// ------ Mixin ------\n\n/**\n * Mixin that auto-registers tools/resources/skills defined in component options.\n *\n * ```js\n * export default {\n * pageMcpTools: [\n * {\n * name: 'search',\n * description: 'Search products',\n * parameters: { type: 'object', properties: { q: { type: 'string' } } },\n * handler: async (args) => this.searchProducts(args.q),\n * }\n * ],\n * pageMcpResources: [...],\n * pageMcpSkills: [...],\n * }\n * ```\n */\nconst pageMcpAutoRegisterMixin: Vue2ComponentOptions = {\n created(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n if (!pageMcp) return;\n\n const { host } = pageMcp;\n this.__pageMcpRegistered = {\n tools: [],\n resources: [],\n skills: [],\n prompts: [],\n };\n\n // Register tools from component options\n const tools = this.$options.pageMcpTools;\n if (tools && Array.isArray(tools)) {\n for (const tool of tools) {\n try {\n host.registerTool(tool);\n this.__pageMcpRegistered.tools.push(tool.name);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register resources from component options\n const resources = this.$options.pageMcpResources;\n if (resources && Array.isArray(resources)) {\n for (const resource of resources) {\n try {\n host.registerResource(resource);\n this.__pageMcpRegistered.resources.push(resource.uri);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register skills from component options\n const skills = this.$options.pageMcpSkills;\n if (skills && Array.isArray(skills)) {\n for (const skill of skills) {\n try {\n host.registerSkill(skill);\n this.__pageMcpRegistered.skills.push(skill.name);\n } catch {\n // Already registered\n }\n }\n }\n\n // Register prompts from component options\n const prompts = this.$options.pageMcpPrompts;\n if (prompts && Array.isArray(prompts)) {\n for (const prompt of prompts) {\n try {\n host.registerPrompt(prompt);\n this.__pageMcpRegistered.prompts.push(prompt.name);\n } catch {\n // Already registered\n }\n }\n }\n },\n beforeDestroy(this: Vue2Instance) {\n const pageMcp = this.$pageMcp;\n const registered = this.__pageMcpRegistered;\n if (!pageMcp || !registered) return;\n const { host } = pageMcp;\n\n for (const name of registered.tools) {\n try { host.unregisterTool(name); } catch { /* noop */ }\n }\n for (const uri of registered.resources) {\n try { host.unregisterResource(uri); } catch { /* noop */ }\n }\n for (const name of registered.skills) {\n try { host.unregisterSkill(name); } catch { /* noop */ }\n }\n for (const name of registered.prompts) {\n try { host.unregisterPrompt(name); } catch { /* noop */ }\n }\n },\n};\n\n/**\n * Standalone mixin for manual use (without the plugin).\n * Useful when you want to use the mixin pattern explicitly.\n */\nexport { pageMcpAutoRegisterMixin as pageMcpMixin };\n\n// ------ Re-exports ------\n\nexport {\n Extensions,\n PageMcpHost,\n PageMcpClient,\n EventBus,\n} from '@page-mcp/core';\n\nexport type {\n ToolDefinition,\n ToolInfo,\n ResourceDefinition,\n ResourceInfo,\n SkillDefinition,\n SkillInfo,\n SkillGetResult,\n SkillExecutionResult,\n SkillExecutionContext,\n PromptDefinition,\n PromptInfo,\n HostInfo,\n} from '@page-mcp/core';\n"],"mappings":"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","names":["Extensions","PageMcpHost","PageMcpClient","EventBus"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@page-mcp/vue2",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Vue 2 adapter for Page MCP SDK — Plugin + Mixin",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -28,13 +28,13 @@
28
28
  ],
29
29
  "peerDependencies": {
30
30
  "vue": ">=2.6.0 <3.0.0",
31
- "@page-mcp/core": "^1.0.0"
31
+ "@page-mcp/core": "^2.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "vue": "^2.7.0",
35
35
  "tsup": "^8.0.0",
36
36
  "typescript": "^5.4.0",
37
- "@page-mcp/core": "^1.0.0"
37
+ "@page-mcp/core": "^2.0.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup",