[Python] FastMCP SSE port control

Discussão em 'Python' iniciado por Stack, Maio 5, 2025.

  1. Stack

    Stack Membro Participativo

    Is there a way to control which SSE port (not initial connection port) the sse session will land on?

    I am running regular fastmcp sse in docker and without knowing which port SSE will land it's failing to establish sse session. python sdk.

    fastmcp itself is running on say port 8000. if running in host and connecting from host everything works, after initially using port 8000 sse session is established say on 53684 and host to host nothing prevents accessing 53684.

    when running in docker and connecting from within the docker, again everything works.

    however, when running in docker and connecting from host, I can only map initial port 8000, but then I dont know what additional port(s) to map for sse session. if I map 53684, next time it appears to be using another random one.

    I imagine there must be a setting to control which port(s) the sse session will be using? to allow deployment in any environment where ports by default are unavailable, unless explicitly permitted/mapped?

    something like

    mcp_server : FastMCP = FastMCP("mycorp", port=8010, ??sse_port=???)

    Continue reading...

Compartilhe esta Página