xmcp 1.2.0 → 1.4.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.
@@ -0,0 +1,10 @@
1
+ import type { Icon } from "@modelcontextprotocol/server";
2
+ /** Metadata shared by tools, prompts, and resources. */
3
+ export interface ComponentMetadata {
4
+ /** Icons that clients may display for this component. */
5
+ icons?: Icon[];
6
+ /** Labels exposed as _meta["xmcp/tags"]. */
7
+ tags?: string[];
8
+ /** Set false to skip registration. Defaults to true. */
9
+ enabled?: boolean;
10
+ }
@@ -8,6 +8,9 @@ declare module "xmcp/plugins/x402" {
8
8
  type PaidHandler = import("../plugins/x402/index").PaidHandler;
9
9
  }
10
10
  declare module "xmcp/cloudflare" {
11
+ const image: typeof import("../runtime/utils/content").image;
12
+ const audio: typeof import("../runtime/utils/content").audio;
13
+ const embeddedResource: typeof import("../runtime/utils/content").embeddedResource;
11
14
  const apiKeyAuthMiddleware: typeof import("../runtime/platforms/cloudflare/middlewares/api-key").cloudflareApiKeyAuthMiddleware;
12
15
  const jwtAuthMiddleware: typeof import("../runtime/platforms/cloudflare/middlewares/jwt").cloudflareJwtAuthMiddleware;
13
16
  type JWTAuthMiddlewareConfig = import("../runtime/platforms/cloudflare/middlewares/jwt").CloudflareJWTAuthMiddlewareConfig;
@@ -1,7 +1,10 @@
1
+ import type { ComponentMetadata } from "./component";
1
2
  export type { GetPromptResult, PromptMessage, } from "@modelcontextprotocol/server";
2
- export type PromptMetadata = {
3
+ export type PromptMetadata = ComponentMetadata & {
3
4
  name: string;
4
5
  title: string;
5
6
  description: string;
6
7
  role?: string;
8
+ /** Metadata exposed in prompts/list. */
9
+ _meta?: Record<string, unknown>;
7
10
  };
@@ -1,5 +1,9 @@
1
+ import type { ComponentMetadata } from "./component";
1
2
  import { UIMetadata } from "./ui-meta";
2
- export interface ResourceMetadata {
3
+ import type { CompleteResourceTemplateCallback } from "@modelcontextprotocol/server";
4
+ /** Completion callbacks keyed by the resource's URI template parameters. */
5
+ export type ResourceCompletions = Record<string, CompleteResourceTemplateCallback>;
6
+ export interface ResourceMetadata extends ComponentMetadata {
3
7
  name: string;
4
8
  title?: string;
5
9
  description?: string;
@@ -1,3 +1,4 @@
1
+ import type { ComponentMetadata } from "./component";
1
2
  import { z } from "zod/v3";
2
3
  import type { ZodType as ZodTypeV4, infer as inferV4 } from "zod";
3
4
  import type { CreateMessageRequestParamsBase, CreateMessageResult, ElicitResult as McpElicitResult } from "@modelcontextprotocol/server";
@@ -16,7 +17,7 @@ export interface ToolAnnotations {
16
17
  openWorldHint?: boolean;
17
18
  [key: string]: any;
18
19
  }
19
- export interface ToolMetadata {
20
+ export interface ToolMetadata extends ComponentMetadata {
20
21
  /** Unique identifier for the tool */
21
22
  name: string;
22
23
  /** Human-readable description */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xmcp",
3
3
  "description": "The MCP framework",
4
- "version": "1.2.0",
4
+ "version": "1.4.0",
5
5
  "author": {
6
6
  "name": "xmcp",
7
7
  "email": "support@xmcp.dev",
@@ -44,6 +44,10 @@
44
44
  "require": "./dist/index.js",
45
45
  "default": "./dist/index.js"
46
46
  },
47
+ "./node": {
48
+ "types": "./dist/node.d.ts",
49
+ "node": "./dist/node.js"
50
+ },
47
51
  "./host-bridge": {
48
52
  "types": "./dist/host-bridge.d.ts",
49
53
  "import": "./dist/host-bridge.js",
@@ -71,6 +75,9 @@
71
75
  },
72
76
  "typesVersions": {
73
77
  "*": {
78
+ "node": [
79
+ "dist/node.d.ts"
80
+ ],
74
81
  "host-bridge": [
75
82
  "dist/host-bridge.d.ts"
76
83
  ],
@@ -162,7 +169,7 @@
162
169
  "analyze": "cross-env GENERATE_STATS=true pnpm build && pnpm tsx scripts/analyze-rspack-stats.ts",
163
170
  "bench": "tsx bench/run.mts",
164
171
  "test:config": "pnpm --dir ../compiler test:config",
165
- "test:adapters": "node --import tsx --test src/runtime/adapters/fastify/__tests__/*.test.ts",
172
+ "test:adapters": "node --import tsx --test src/runtime/adapters/*/__tests__/*.test.ts",
166
173
  "test:runtime": "node --import tsx --test src/runtime/utils/__tests__/*.test.ts src/runtime/utils/ui/__tests__/*.test.ts"
167
174
  }
168
175
  }