-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
I'm need to deploy my MCP Server in a multi-node environment (always has 2 or more server) with StreamableHTTPServerTransport
. On the initialization fase everything occurs normally, but, when a request is made to other node of the cluster I'm getting an error because this node doesn't have the client (it interpret that the connection was not initialized).
To Reproduce
Steps to reproduce the behavior:
- Use as base the 'simpleStreamableHttp' example
- Change the
eventStorage
to be persistent (fileDisk, Redis, Memcached, etc.) - Start, locally, 2 instances of the server in different ports
- Create, configure and start a NGINX server that make the redirect for those instances
- Using MCP Inspector try to connect and use any tool (Greet for example)
- You will receive an error
Expected behavior
As described in the documentation any node should respond to the client without problems.
Logs
MCP error -32001: Error POSTing to endpoint (HTTP 400): {"jsonrpc":"2.0","error":{"code":-32000,"message":"Bad Request: No valid session ID provided"},"id":null}
Additional context
I've made a workaround for this issue saving the initialize body in one instance and using it for re-initialize in the other instance (without the knowledge of the client) - but it don't seen right.
It could be:
- a problem in the documentation
- a problem in the implementation
- a problem of interpretation of my own