Skip to content

Support Stateless MCP Server Connections #1844

Open
@BrandonShar

Description

@BrandonShar

Description

With the streaming http protocol, MCP servers now have the option to be stateless and not care about long-running sessions. If we don't need long-running session support, that also allows us to skip the initial connection to the MCP server that occurs in agent.run_mcp_servers() which is a little performance boost and reduces start-up coupling with any MCP servers.

I'm handling this in a project right now by overriding the MCPServerHTTP's aenter method and running everything except for the client initialize and set logging methods.

I'm happy to put up a PR for this, but I wanted to see if you'd have interest in the idea first. I think the simplest way to handle it would be an additional argument on the MCPServerHTTP class called something like stateless or maybe something more obvious like skip_initial_connection.

References

No response

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