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.

43 lines 1.89 kB
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import type { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js"; export interface RpcLogEntry { serverId: string; direction: "send" | "receive"; timestamp: string; message: JSONRPCMessage; } /** * Retrieve RPC log entries for the specified server. * * @param serverId - The server identifier to filter logs by * @returns All `RpcLogEntry` objects associated with `serverId` */ export declare function getRpcLogs(serverId: string): RpcLogEntry[]; /** * Retrieve all stored RPC log entries. * * @returns A shallow copy of the array of `RpcLogEntry` objects representing all logs */ export declare function getAllRpcLogs(): RpcLogEntry[]; /** * Subscribe to receive RPC log entries as they are published. * * @param listener - Function invoked with each new `RpcLogEntry` * @returns A function that unsubscribes the listener when called */ export declare function subscribeToRpcLogs(listener: (entry: RpcLogEntry) => void): () => void; /** * Remove stored RPC log entries for a specific server or all servers. * * @param serverId - The server identifier whose logs should be removed. If omitted, clears all logs. */ export declare function clearRpcLogs(serverId?: string): void; /** * Create a Transport wrapper that records every sent and received JSON-RPC message tagged with the given server ID. * * @param transport - The Transport instance to wrap and forward calls to * @param serverId - Identifier used to attribute created log entries to a specific server * @returns A Transport instance that forwards operations to the provided transport and records each message as a log entry with direction `send` or `receive` */ export declare function wrapTransportForLogging(transport: Transport, serverId: string): Transport; //# sourceMappingURL=rpc-logger.d.ts.map