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.

57 lines 2.3 kB
/** * SSE Connection Manager * * @deprecated SSEClientTransport is deprecated in the official MCP SDK as of spec version 2025-11-25. * Use StreamableHttpConnectionManager instead, which provides the same SSE functionality * through a unified endpoint. * * **This class is maintained for backward compatibility** and will continue to work. * * Migration guide: * ```typescript * // Old (still works, but deprecated) * import { SseConnectionManager } from 'mcp-use'; * const manager = new SseConnectionManager(url); * * // New (recommended) * import { StreamableHttpConnectionManager } from 'mcp-use'; * const manager = new StreamableHttpConnectionManager(url); * ``` * * **Important:** StreamableHTTP still supports SSE for notifications - it just uses * a single /mcp endpoint instead of separate POST and SSE endpoints. No functionality is lost. * * @see https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http * @see StreamableHttpConnectionManager for the recommended alternative */ import type { SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js"; import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js"; import { ConnectionManager } from "./base.js"; export declare class SseConnectionManager extends ConnectionManager<SSEClientTransport> { private readonly url; private readonly opts?; private _transport; private reinitializing; /** * Create an SSE connection manager. * * @param url The SSE endpoint URL. * @param opts Optional transport options (auth, headers, etc.). */ constructor(url: string | URL, opts?: SSEClientTransportOptions); /** * Spawn a new `SSEClientTransport` and wrap it with 404 handling. * Per MCP spec, clients MUST re-initialize when receiving 404 for stale sessions. */ protected establishConnection(): Promise<SSEClientTransport>; /** * Re-initialize the transport with a new session * This is called when the server returns 404 for a stale session */ private reinitialize; /** * Close the underlying transport and clean up resources. */ protected closeConnection(_connection: SSEClientTransport): Promise<void>; } //# sourceMappingURL=sse.d.ts.map