test: isolate optional SDK role dependencies
This commit is contained in:
parent
43eed45404
commit
7664bb1010
6 changed files with 209 additions and 9 deletions
|
|
@ -89,8 +89,8 @@ import {
|
|||
McpUiToolMeta,
|
||||
} from "./types";
|
||||
export * from "./types";
|
||||
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./app";
|
||||
import { RESOURCE_URI_META_KEY } from "./app";
|
||||
export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "./constants";
|
||||
import { RESOURCE_URI_META_KEY } from "./constants";
|
||||
export { PostMessageTransport } from "./message-transport";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import {
|
|||
type Transport,
|
||||
} from "@modelcontextprotocol/client";
|
||||
import { EmptyResultSchema } from "@modelcontextprotocol/core";
|
||||
export { RESOURCE_MIME_TYPE, RESOURCE_URI_META_KEY } from "./constants";
|
||||
import { EventDispatcher } from "./events";
|
||||
export { EventDispatcher } from "./events";
|
||||
import { PostMessageTransport } from "./message-transport";
|
||||
|
|
@ -158,7 +159,6 @@ export {
|
|||
* }
|
||||
* ```
|
||||
*/
|
||||
export const RESOURCE_URI_META_KEY = "ui/resourceUri";
|
||||
|
||||
/**
|
||||
* MIME type for MCP UI resources.
|
||||
|
|
@ -167,7 +167,6 @@ export const RESOURCE_URI_META_KEY = "ui/resourceUri";
|
|||
*
|
||||
* Used by {@link server-helpers!registerAppResource `registerAppResource`} as the default MIME type for app resources.
|
||||
*/
|
||||
export const RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
|
||||
|
||||
/**
|
||||
* Options for configuring {@link App `App`} behavior.
|
||||
|
|
|
|||
5
src/constants.ts
Normal file
5
src/constants.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/** Legacy metadata key associating an MCP tool with its App resource. */
|
||||
export const RESOURCE_URI_META_KEY = "ui/resourceUri";
|
||||
|
||||
/** MIME type for MCP App HTML resources. */
|
||||
export const RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
|
||||
20
src/core-types.ts
Normal file
20
src/core-types.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import {
|
||||
CallToolResultSchema,
|
||||
ContentBlockSchema,
|
||||
EmbeddedResourceSchema,
|
||||
ImplementationSchema,
|
||||
RequestIdSchema,
|
||||
ResourceLinkSchema,
|
||||
ToolSchema,
|
||||
} from "@modelcontextprotocol/core";
|
||||
import type { z } from "zod/v4";
|
||||
|
||||
// Infer shared wire types from the public role-neutral schemas so declarations
|
||||
// used by every entrypoint do not acquire a client or server package edge.
|
||||
export type CallToolResult = z.infer<typeof CallToolResultSchema>;
|
||||
export type ContentBlock = z.infer<typeof ContentBlockSchema>;
|
||||
export type EmbeddedResource = z.infer<typeof EmbeddedResourceSchema>;
|
||||
export type Implementation = z.infer<typeof ImplementationSchema>;
|
||||
export type RequestId = z.infer<typeof RequestIdSchema>;
|
||||
export type ResourceLink = z.infer<typeof ResourceLinkSchema>;
|
||||
export type Tool = z.infer<typeof ToolSchema>;
|
||||
|
|
@ -32,13 +32,12 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
RESOURCE_URI_META_KEY,
|
||||
RESOURCE_MIME_TYPE,
|
||||
McpUiResourceCsp,
|
||||
McpUiResourceMeta,
|
||||
McpUiToolMeta,
|
||||
McpUiClientCapabilities,
|
||||
} from "../app.js";
|
||||
} from "../spec.types.js";
|
||||
import { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE } from "../constants.js";
|
||||
import type {
|
||||
ClientCapabilities,
|
||||
McpServer,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import type {
|
|||
RequestId,
|
||||
ResourceLink,
|
||||
Tool,
|
||||
} from "@modelcontextprotocol/client";
|
||||
} from "./core-types";
|
||||
|
||||
/**
|
||||
* Current protocol version supported by this SDK.
|
||||
|
|
|
|||
Loading…
Reference in a new issue