You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MCP client: a call made from a handler can be refused for the permit its parent still holds #1772
An MCP client call made from inside a handler that answers the result of another call (an elicitation handler, for example) can fail with java.io.IOException: MCP transport closed or call limit exceeded when maxConcurrentCalls is 1. It happens at random: McpModernClientTestCase.anElicitationHandlerMayCallWithOneSlot failed on CI in 2 of 4 runs and never locally.
McpModernHttpTransport hands the final response to its subscriber from inside the worker's operation, and the worker frees its admission permit only after the operation returns (McpWorkers.work). The SDK runs the handler on another thread as soon as it has the response, so the handler's nested call can try to take the single permit while the outer worker is still cleaning up, and McpWorkers.admit refuses it at once.
Proposed fix
Let a call free its permit before it hands over its final response: McpWorkers.submit takes an operation that receives a release callback (idempotent; the permit is still freed when the call ends), and McpModernHttpTransport calls it just before emitting a JSON reply or the matching event of a stream.
Delivered by #1771 (merged to 3.0), third commit 'Free the permit of an MCP call before handing over its answer (#1772)'. The PR text only named #1770, so GitHub didn't link it. Closing by hand.
Activity
Free the permit of an MCP call before handing over its answer (#1772)
Free the permit of an MCP call before handing over its answer (#1772)
Free the permit of an MCP call before handing over its answer (#1772)
jlouvel commentedon Nov 30, 2026
Delivered by #1771 (merged to 3.0), third commit 'Free the permit of an MCP call before handing over its answer (#1772)'. The PR text only named #1770, so GitHub didn't link it. Closing by hand.