UNPKG

mcp-ts-template

Version:

A production-grade TypeScript template for building robust Model Context Protocol (MCP) servers, featuring built-in observability with OpenTelemetry, advanced error handling, comprehensive utilities, and a modular architecture.

48 lines 1.89 kB
/** * @fileoverview Defines a wrapper around the McpServer class to provide * extended functionality, such as metadata introspection, without needing * to access private properties of the underlying SDK class. * @module src/mcp-server/core/managedMcpServer */ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; type RegisterToolParameters = Parameters<McpServer["registerTool"]>; type ToolSpec = RegisterToolParameters[1]; type ToolImplementation = RegisterToolParameters[2]; type RegisteredToolReturn = ReturnType<McpServer["registerTool"]>; type ServerIdentity = ConstructorParameters<typeof McpServer>[0]; type McpServerOptions = NonNullable<ConstructorParameters<typeof McpServer>[1]>; /** * A wrapper around the McpServer that captures registration metadata * to make it available for status endpoints and other diagnostics. * It acts as a full pass-through for all McpServer functionality. */ export declare class ManagedMcpServer extends McpServer { private readonly storedTools; readonly serverIdentity: ServerIdentity; readonly serverOptions?: McpServerOptions; constructor(identity: ServerIdentity, options?: McpServerOptions); registerTool(name: string, spec: ToolSpec, implementation: ToolImplementation): RegisteredToolReturn; /** * Retrieves the metadata for all registered tools. */ getTools(): { name: string; description?: string; inputSchema: unknown; outputSchema?: unknown; }[]; /** * Gets the server's name from its identity. */ get name(): string; /** * Gets the server's version from its identity. */ get version(): string; /** * Gets the server's capabilities from its options. */ get capabilities(): McpServerOptions["capabilities"] | undefined; } export {}; //# sourceMappingURL=managedMcpServer.d.ts.map