Skip to content

Listing tools with streamablehttp_client (with OAuth) is much slower when compared to the Inspector #1204

@keurcien

Description

@keurcien

Question

I have been trying to get an MCP client to communicate with Notion's MCP server using this simple code snippet:

async with streamablehttp_client("https://mcp.notion.com/mcp", auth=oauth_auth) as (read, write, _):

    async with ClientSession(read, write) as session:
        await session.initialize()
        tools = await session.list_tools()
        print(f"Available tools: {[tool.name for tool in tools.tools]}")
        resources = await session.list_resources()
        print(f"Available resources: {[r.uri for r in resources.resources]}")

        tool_result = await session.call_tool(name="search", arguments={"query": "John Doe"})

Works perfectly, but it takes 10 seconds for the session to initialize, 10 other seconds for listing tools, 10 seconds for listing resources, and 10 seconds for the tool call as well. When connecting the MCP Inspector to the same MCP server, everything shows up instantly (less than a second), for each execution.

Is this normal (maybe Node vs Python?) or is there something we can do about it?

Additional Context

python 3.11
mcp==1.12.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions