Skip to content

Getting "Unknown SSE event: keepalive" when trying to use virtual servers #689

@hiteshsom

Description

@hiteshsom

I created 2 virtual servers from a local hosted MCP server. Basically divided 4 tools among 2 virtual servers.

Original MCP server url
http://localhost:8005/sse

I am able to see the tools it has access to and also able to call the tools.

I used this code


import asyncio
from fastmcp import Client, FastMCP

client = Client("http://localhost:8005/sse")



async def main():
    async with client:
        # Basic server interaction
        await client.ping()
        
        # List available operations
        tools = await client.list_tools()
        resources = await client.list_resources()
        prompts = await client.list_prompts()

        print("Available tools:")
        for tool in tools:
            print(tool.name)
        print()
        
        # Execute operations
        result = await client.call_tool("add", {"a": 1, "b": 2})
        print("Addition of 1 + 2:")
        print(result.content[0].text)

        # Execute operations
        result = await client.call_tool("subtract", {"a": 1, "b": 2})
        print("Subtraction of 1 - 2:")
        print(result.content[0].text)


        

asyncio.run(main())

It works fine.

Now I try to use below code


import asyncio
from fastmcp import Client, FastMCP
from fastmcp.client.auth import BearerAuth

client = Client("http://localhost:4444/servers/2/sse", auth="<token>")


async def main():
    async with client:

        await client.ping()

        # List available operations
        tools = await client.list_tools()
        # resources = await client.list_resources()
        # prompts = await client.list_prompts()

        for tool in tools:
            print(tool.name)
        
        # Execute operations
        result = await client.call_tool("add", {"a": 1, "b":2})
        print("Sine of 1:")
        print(result.content[0].text)
        

asyncio.run())

But getting this output

Unknown SSE event: keepalive
Unknown SSE event: keepalive
Unknown SSE event: keepalive
Unknown SSE event: keepalive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions