UNPKG

mcp-use

Version:

Opinionated MCP Framework for TypeScript (@modelcontextprotocol/sdk compatible) - Build MCP Agents, Clients and Servers with support for ChatGPT Apps, Code Mode, OAuth, Notifications, Sampling, Observability and more.

282 lines • 8.67 kB
export declare abstract class BaseTelemetryEvent { abstract get name(): string; abstract get properties(): Record<string, any>; } /** * Tool info for telemetry - matches ToolDefinition from server/types/tool.ts */ export interface Tool { name: string; title?: string | null; description?: string | null; /** JSON stringified schema from ToolDefinition.schema (Zod) */ input_schema?: string | null; /** JSON stringified schema from ToolDefinition.outputSchema (Zod) */ output_schema?: string | null; } /** * Resource info for telemetry - matches ResourceDefinition from server/types/resource.ts */ export interface Resource { name: string; title?: string | null; description?: string | null; /** URI pattern from ResourceDefinition.uri */ uri?: string | null; /** MIME type from ResourceDefinition.mimeType */ mime_type?: string | null; } /** * Prompt info for telemetry - matches PromptDefinition from server/types/prompt.ts */ export interface Prompt { name: string; title?: string | null; description?: string | null; /** JSON stringified args from PromptDefinition.args (InputDefinition[]) */ args?: string | null; } /** * Content info for telemetry - matches MCP SDK content structure */ export interface Content { mime_type?: string | null; text?: string | null; blob?: string | null; } export interface MCPAgentExecutionEventData { executionMethod: string; query: string; success: boolean; modelProvider: string; modelName: string; serverCount: number; serverIdentifiers: Array<Record<string, string>>; totalToolsAvailable: number; toolsAvailableNames: string[]; maxStepsConfigured: number; memoryEnabled: boolean; useServerManager: boolean; maxStepsUsed: number | null; manageConnector: boolean; externalHistoryUsed: boolean; stepsTaken?: number | null; toolsUsedCount?: number | null; toolsUsedNames?: string[] | null; response?: string | null; executionTimeMs?: number | null; errorType?: string | null; conversationHistoryLength?: number | null; } export declare class MCPAgentExecutionEvent extends BaseTelemetryEvent { private data; constructor(data: MCPAgentExecutionEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerRunEventData { transport: string; toolsNumber: number; resourcesNumber: number; promptsNumber: number; auth: boolean; name: string; description?: string | null; baseUrl?: string | null; toolNames?: string[] | null; resourceNames?: string[] | null; promptNames?: string[] | null; tools?: Tool[] | null; resources?: Resource[] | null; prompts?: Prompt[] | null; templates?: Prompt[] | null; capabilities?: Record<string, any> | null; appsSdkResources?: Resource[] | null; appsSdkResourcesNumber?: number; mcpUiResources?: Resource[] | null; mcpUiResourcesNumber?: number; mcpAppsResources?: Resource[] | null; mcpAppsResourcesNumber?: number; } /** * Interface for MCPServer data needed for telemetry tracking. * This allows the telemetry layer to extract data from an MCPServer instance * without importing the full MCPServer class (avoiding circular dependencies). */ export interface MCPServerTelemetryInfo { registeredTools: string[]; registeredPrompts: string[]; registeredResources: string[]; config: { name: string; description?: string; }; serverBaseUrl?: string; oauthProvider?: unknown; registrations: { tools: Map<string, { config: { name: string; title?: string; description?: string; schema?: unknown; outputSchema?: unknown; }; handler: unknown; }>; prompts: Map<string, { config: { name: string; title?: string; description?: string; args?: unknown; }; handler: unknown; }>; resources: Map<string, { config: { name: string; title?: string; description?: string; uri?: string; mimeType?: string; }; handler: unknown; }>; resourceTemplates: Map<string, { config: { name: string; title?: string; description?: string; }; handler: unknown; }>; }; } /** * Creates ServerRunEventData from an MCPServer-like object. * This centralizes the data extraction logic in the telemetry layer. */ export declare function createServerRunEventData(server: MCPServerTelemetryInfo, transport: string): ServerRunEventData; export declare class ServerRunEvent extends BaseTelemetryEvent { private data; constructor(data: ServerRunEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerInitializeEventData { protocolVersion: string; clientInfo: Record<string, any>; clientCapabilities: Record<string, any>; sessionId?: string | null; } export declare class ServerInitializeEvent extends BaseTelemetryEvent { private data; constructor(data: ServerInitializeEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerToolCallEventData { toolName: string; lengthInputArgument: number; success: boolean; errorType?: string | null; executionTimeMs?: number | null; } export declare class ServerToolCallEvent extends BaseTelemetryEvent { private data; constructor(data: ServerToolCallEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerResourceCallEventData { name: string; description: string | null; contents: Content[]; success: boolean; errorType?: string | null; } export declare class ServerResourceCallEvent extends BaseTelemetryEvent { private data; constructor(data: ServerResourceCallEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerPromptCallEventData { name: string; description: string | null; success: boolean; errorType?: string | null; } export declare class ServerPromptCallEvent extends BaseTelemetryEvent { private data; constructor(data: ServerPromptCallEventData); get name(): string; get properties(): Record<string, any>; } export interface ServerContextEventData { contextType: "sample" | "elicit" | "notification"; notificationType?: string | null; } export declare class ServerContextEvent extends BaseTelemetryEvent { private data; constructor(data: ServerContextEventData); get name(): string; get properties(): Record<string, any>; } export interface MCPClientInitEventData { codeMode: boolean; sandbox: boolean; allCallbacks: boolean; verify: boolean; servers: string[]; numServers: number; isBrowser: boolean; } export declare class MCPClientInitEvent extends BaseTelemetryEvent { private data; constructor(data: MCPClientInitEventData); get name(): string; get properties(): Record<string, any>; } export interface ConnectorInitEventData { connectorType: string; serverCommand?: string | null; serverArgs?: string[] | null; serverUrl?: string | null; publicIdentifier?: string | null; } export declare class ConnectorInitEvent extends BaseTelemetryEvent { private data; constructor(data: ConnectorInitEventData); get name(): string; get properties(): Record<string, any>; } /** * Raw input data for tracking server addition. * The event class will extract the necessary properties. */ export interface ClientAddServerEventInput { serverName: string; serverConfig: Record<string, any>; } export declare class ClientAddServerEvent extends BaseTelemetryEvent { private data; constructor(data: ClientAddServerEventInput); get name(): string; get properties(): Record<string, any>; private _extractHostname; } /** * Raw input data for tracking server removal. */ export interface ClientRemoveServerEventInput { serverName: string; } export declare class ClientRemoveServerEvent extends BaseTelemetryEvent { private data; constructor(data: ClientRemoveServerEventInput); get name(): string; get properties(): Record<string, any>; } //# sourceMappingURL=events.d.ts.map