这是indexloc提供的服务,不要输入任何密码
Skip to content

FastMCP Server should allow a configurable ping #1212

@DinoChiesa

Description

@DinoChiesa

Enhancement Description

With either the now-deprecated SSE or with HTTP Streaming, a ping from server to client is helpful in keeping the connection alive and healthy.

The underlying MCP library includes a send_ping method for server-to-client ping.

Some other frameworks, like punkpeye/fastmcp offer an easy way to configure the server's ping behavior with an interval.

I have a case where I'd like to use THIS library and get configurable ping, easily.

Ideally I will be able to use something like this to tell it to do the right thing:

    mcp.run(
        transport="http", host="0.0.0.0", port=port, path="/mcp", stateless_http=True, ping=5000
    )

This solves the problem in which a client drops a connection unnecessarily.

The alternative would be for the client to behave well and ping the server and maintain the session. Not all clients can do that. This makes the session more resilient.

Use Case

No response

Proposed Implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions