Skip to content

MCPServerSse connection status #1297

@jaydeepk

Description

@jaydeepk

Hi

How do I determine if my MCPServerSse instance is still connected to my MCP server .
I tried doing something like this

 async def check_mcp_server_is_connected(self):
        try:
            await asyncio.wait_for(self.mcp_server.list_tools(), timeout=5.0)
            return True
        except Exception as ex:
            return False

This works but is there a better way?
I could catch a more specific exception...but is there a better way to do this?

Thanks
Jaydeep

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions