Does MCP ClientSession support concurrent tool calls? Clarification on multiplexing and scalability? #582
-
Pre-submission Checklist
Discussion TopicI'm building a high-throughput AI agent platform using the MCP Go SDK where multiple concurrent requests need to call MCP tools. I need clarification on how ClientSession handles concurrent requests. Current Setup What I Need to Understand
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
(1) Calls are concurrent, and (2) for HTTP transports, this means multiple concurrent HTTP requests. By default, we use http.DefaultClient, but you can configure this with client options for the HTTP transports. Regarding scalability, I strongly recommend testing for your use case. You may find https://github.com/modelcontextprotocol/go-sdk/tree/31e97ad69edad679c726449c4584353502965cf5/examples/client/loadtest to be a good starting point (though looking at that, each worker has a distinct client session; perhaps we should update it to also make concurrent requests on a single session). |
Beta Was this translation helpful? Give feedback.
(1) Calls are concurrent, and (2) for HTTP transports, this means multiple concurrent HTTP requests. By default, we use http.DefaultClient, but you can configure this with client options for the HTTP transports.
Regarding scalability, I strongly recommend testing for your use case. You may find https://github.com/modelcontextprotocol/go-sdk/tree/31e97ad69edad679c726449c4584353502965cf5/examples/client/loadtest to be a good starting point (though looking at that, each worker has a distinct client session; perhaps we should update it to also make concurrent requests on a single session).