@zhin.js/mcp-feature 1.1.13 → 1.1.15

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.
@@ -21,7 +21,11 @@ declare module '@zhin.js/plugin-runtime' {
21
21
  addMcp(localName: string, definition: McpDefinition<TConfig>): void;
22
22
  }
23
23
  }
24
+ export type McpDefiner<TConfig> = (definition: Omit<McpDefinition<TConfig>, '$feature'>) => Readonly<McpDefinition<TConfig>>;
24
25
  export declare function defineMcp<TConfig = unknown>(definition: Omit<McpDefinition<TConfig>, '$feature'>): Readonly<McpDefinition<TConfig>>;
26
+ export declare namespace defineMcp {
27
+ var withConfig: <TConfig = unknown>() => McpDefiner<TConfig>;
28
+ }
25
29
  export declare function parseMcpDefinition(value: unknown): McpDefinition;
26
30
  export declare function assertMcpClient(value: unknown, source: string): asserts value is McpClientInstance;
27
31
  export {};
package/lib/definition.js CHANGED
@@ -5,6 +5,12 @@ export function defineMcp(definition) {
5
5
  }
6
6
  return Object.freeze({ ...definition, $feature: mcpBrand });
7
7
  }
8
+ /**
9
+ * Fix the plugin config type first, then define the MCP client.
10
+ */
11
+ defineMcp.withConfig = function withConfig() {
12
+ return (definition) => defineMcp(definition);
13
+ };
8
14
  export function parseMcpDefinition(value) {
9
15
  if (!value || typeof value !== 'object')
10
16
  throw invalidMcp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/mcp-feature",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Convention-based MCP client Feature for Zhin Plugin Runtime",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -16,8 +16,8 @@
16
16
  "src"
17
17
  ],
18
18
  "dependencies": {
19
- "@zhin.js/feature-kit": "1.1.12",
20
- "@zhin.js/plugin-runtime": "1.1.20"
19
+ "@zhin.js/feature-kit": "1.1.14",
20
+ "@zhin.js/plugin-runtime": "1.1.22"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "^26.1.2",
package/src/definition.ts CHANGED
@@ -27,6 +27,10 @@ declare module '@zhin.js/plugin-runtime' {
27
27
  }
28
28
  }
29
29
 
30
+ export type McpDefiner<TConfig> = (
31
+ definition: Omit<McpDefinition<TConfig>, '$feature'>,
32
+ ) => Readonly<McpDefinition<TConfig>>;
33
+
30
34
  export function defineMcp<TConfig = unknown>(
31
35
  definition: Omit<McpDefinition<TConfig>, '$feature'>,
32
36
  ): Readonly<McpDefinition<TConfig>> {
@@ -36,6 +40,13 @@ export function defineMcp<TConfig = unknown>(
36
40
  return Object.freeze({ ...definition, $feature: mcpBrand });
37
41
  }
38
42
 
43
+ /**
44
+ * Fix the plugin config type first, then define the MCP client.
45
+ */
46
+ defineMcp.withConfig = function withConfig<TConfig = unknown>(): McpDefiner<TConfig> {
47
+ return (definition) => defineMcp(definition);
48
+ };
49
+
39
50
  export function parseMcpDefinition(value: unknown): McpDefinition {
40
51
  if (!value || typeof value !== 'object') throw invalidMcp();
41
52
  const definition = value as Partial<McpDefinition>;