UNPKG

xmcp

Version:

The TypeScript MCP framework

15 lines (14 loc) • 1.07 kB
import type { McpServer } from "@modelcontextprotocol/server"; import type { McpMiddleware, McpToolMetadata } from "@/types/mcp-middleware"; import { type McpToolHandler } from "./transformers/tool"; export declare function normalizeMcpMiddleware(value: unknown): McpMiddleware[]; /** Tool middleware stays inside SDK input/output validation and tool-error handling. */ export declare function wrapToolWithMiddleware(handler: McpToolHandler, metadata: McpToolMetadata, middleware: readonly McpMiddleware[]): McpToolHandler; /** * McpServer installs listing/completion handlers lazily during registration and * has no public handler getter. Decorate that public registration seam only * while registering components, then restore it even if registration fails. * This retains SDK catalog/URI/completion behavior and runs the chain once, * including ResourceTemplate list/read/complete callbacks and generated UI resources. */ export declare function registerWithMcpMiddleware(server: McpServer, middleware: readonly McpMiddleware[], register: () => void): void;