XjG ddlZddlZddlmZddlmZddlZddlmZm Z ddl m Z ddl m Z ddlmZddlmZddlmZdd lmZej.eZe d ed ed eeeeeze efdffd Zy)N)AsyncGenerator)asynccontextmanager)MemoryObjectReceiveStreamMemoryObjectSendStream)ValidationError) deprecated)connect) Subprotocol)SessionMessagezThe WebSocket client transport is deprecated and will be removed in mcp 2.0. WebSocket was never part of the MCP specification; use the streamable HTTP transport (`streamable_http_client`) instead.urlreturnc.Ktjd\}tjd\}t|tdg4d{fd}fd}tj4d{}|j ||j |||f|j jdddd{dddd{y77j7#1d{7swY)xYw7 #1d{7swYyxYww)aa WebSocket client transport for MCP, symmetrical to the server version. Deprecated: this transport will be removed in mcp 2.0. WebSocket was never part of the MCP specification; use the streamable HTTP transport instead. Connects to 'url' using the 'mcp' subprotocol, then yields: (read_stream, write_stream) - read_stream: As you read from this stream, you'll receive either valid JSONRPCMessage objects or Exception objects (when validation fails). - write_stream: Write JSONRPCMessage objects to this stream to send them over the WebSocket to the server. rmcp) subprotocolsNc~K4d{23d{} tjj|}t|}j |d{N7T7K7 #t $r$}j |d{7Yd}~|d}~wwxYw6dddd{7y#1d{7swYyxYww)z Reads text messages from the WebSocket, parses them as JSON-RPC messages, and sends them into read_stream_writer. N)typesJSONRPCMessagemodel_validate_jsonr sendr)raw_textmessagesession_messageexcread_stream_writerwss h/mnt/ssd/data/Dropbox/adrian/vault-secondbrain/venv/lib/python3.12/site-packages/mcp/client/websocket.py ws_readerz#websocket_client..ws_reader;s * ; ;&(;;(;"'"6"6"J"J8"T*8*A055oFFF  ;;G*;055c:::; ') ; ; ; ; ;sB=AB=B(BA!BB(>A%A#A%B(B=!B#A%% B.B B B B( BB( B=!B$"B=(B:.B1 /B:6B=c*K4d{23d{}|jjddd}jtj|d{T7Z7Q7 6dddd{7y#1d{7swYyxYww)zt Reads JSON-RPC messages from write_stream_reader and sends them to the server. NTjson)by_aliasmode exclude_none)r model_dumprrdumps)rmsg_dictwrite_stream_readerrs r ws_writerz#websocket_client..ws_writerJs + 8 8-@88/.66AA4V\koApH''$**X"6777  888.A 8 8 8 8 8swBA%BA>A+A'A+AA>A) A>%B'A+)A>+A>, B7A:8B>BB B B)anyiocreate_memory_object_stream ws_connectr create_task_group start_soon cancel_scopecancel) r read_stream write_streamrr'tgrr&rs @@@rwebsocket_clientr2sD',&G&G&J# (-(I(I!(L%L%#[-?,@A%%%%R ; 8**, % % MM) $ MM) $ - - OO " " $ % %9%%%%%%8 % % % % %9%%%%%%%%sA DC#D%D:C%;D>AC) D C'D DC>D%D'D)C; /C20C; 7D>DDD DD)rloggingcollections.abcr contextlibrr(anyio.streams.memoryrrpydanticrtyping_extensionsrwebsockets.asyncio.clientr r*websockets.typingr mcp.typesrmcp.shared.messager getLogger__name__loggerstrtuple Exceptionr2rrEs ** R$(;)-   8 $ dF% F% #NY$> ?AWXfAg gh F%  F%rD