Skip to content

[BUG] MCP session 404 in multi worker production environment #189

Open
@sqrt676

Description

@sqrt676

Issue: 404 session not found error due to session not shared across instances behind load balancer

Hi,

I've implemented an MCP server and during local testing with the mcp_use client in SSE configuration, everything works as expected.

However, after deploying the code to production, I started encountering a 404 session not found error.

Upon inspecting the logs, I realized that the root cause is that the session is being created on one instance, but since the application is running behind a load balancer, requests are distributed across different instances/pods. This causes the session lookup to fail when subsequent requests hit a different instance than the one where the session was initially created.

Is there any recommended way to persist or share session state across instances, or any guidance for running MCP server behind a load balancer in a multi-instance environment?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions