File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 22import logging
33from collections .abc import AsyncGenerator
44from contextlib import asynccontextmanager
5+ from typing import Any
56
67import anyio
78from anyio .streams .memory import MemoryObjectReceiveStream , MemoryObjectSendStream
1718@asynccontextmanager
1819async def websocket_client (
1920 url : str ,
21+ headers : dict [str , Any ] | None = None ,
2022) -> AsyncGenerator [
2123 tuple [
2224 MemoryObjectReceiveStream [types .JSONRPCMessage | Exception ],
@@ -48,7 +50,7 @@ async def websocket_client(
4850 write_stream , write_stream_reader = anyio .create_memory_object_stream (0 )
4951
5052 # Connect using websockets, requesting the "mcp" subprotocol
51- async with ws_connect (url , subprotocols = [Subprotocol ("mcp" )]) as ws :
53+ async with ws_connect (url , subprotocols = [Subprotocol ("mcp" )], additional_headers = headers ) as ws :
5254
5355 async def ws_reader ():
5456 """
You can’t perform that action at this time.
0 commit comments