Hive
fix(server): prevent Model Context Protocol response timeouts
GitHub issue · Closed
What changed
Pinned the emcp dependency to the upstream commit that keeps request responses on the original transport request, and added a controller regression test for sessions with stale event-stream registrations.
Why
Tuist’s hosted Model Context Protocol endpoint could intermittently leave agent clients waiting for a timeout even after the server handled the tool call. The symptom was a slow first call followed by a fast retry.
Root cause
The released emcp package could route a request response to a stored Server-Sent Events process identifier. If that identifier pointed to a closed process, the original request received an empty accepted response and the client kept waiting until its own timeout fired.
Approach
The dependency is temporarily pinned to the upstream fix commit until a released package includes the change. The upstream fix is tracked in PJUllrich/emcp#5. The new regression test initializes a session, registers a stale event-stream process, and verifies that a normal tools/list request still receives the response inline.
Impact
Agent clients should no longer see intermittent tool-call timeouts caused by stale event-stream registrations. The dependency pin should be reverted back to a released package once the upstream fix is published.
Validation
mix format mix.exs test/tuist_web/controllers/mcp_controller_test.exsmix test test/tuist_web/controllers/mcp_controller_test.exspassed with 9 tests and 0 failures.
Investigate, reproduce, or fix this item in an isolated repository. Each Flight preserves its outcome and agent session.
Start a Flight and preserve its objective, outcome, and session here.
No GitHub comments yet.