Skip to content

Commit ce7de1a

Browse files
committed
Fix stream type errors
1 parent 293da33 commit ce7de1a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

mcp_examples/common/mcp_sdk_nexus_transport.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import anyio
66
import mcp.types as types
7+
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
78
from mcp.shared.message import SessionMessage
89

910
from mcp_examples.common.mcp_server_nexus_service import (
@@ -128,7 +129,9 @@ async def _route_to_nexus(
128129
return SessionMessage(types.JSONRPCMessage(root=response))
129130

130131

131-
class AsyncioQueueStream:
132+
class AsyncioQueueStream(
133+
MemoryObjectSendStream[SessionMessage], MemoryObjectReceiveStream[SessionMessage]
134+
):
132135
def __init__(self, queue: asyncio.Queue):
133136
self.queue = queue
134137
self._closed = False

mcp_examples/nexus_transport/app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ async def create_client_session_and_call_tool_using_nexus_transport(
4343
@workflow.defn
4444
class CallToolWorkflow:
4545
def __init__(self):
46+
print("Creating nexus client in workflow...")
4647
self.nexus_client = workflow.create_nexus_client(
4748
service=MCPServerNexusService,
4849
endpoint="mcp-sequential-thinking-nexus-endpoint",
4950
)
51+
print("Nexus client created")
5052

5153
@workflow.run
5254
async def run(self):
@@ -93,6 +95,7 @@ async def _call_tool(session: ClientSession):
9395

9496

9597
if __name__ == "__main__":
98+
print("Starting app...")
9699
if "WITHOUT_WORKFLOW" in os.environ:
97100
asyncio.run(create_client_session_and_call_tool_using_standard_transport())
98101
else:

0 commit comments

Comments
 (0)