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
unified-mcp-server: make the response sink per-request (AsyncLocalStorage) #409
send() (bin/unified-mcp-server.mjs:110) writes every response to process.stdout. That is correct for stdio, where one process serves one client, and impossible for HTTP, where one process serves many clients concurrently and each response must go back down its own request.
This is the prerequisite for the HTTP transport — nothing user-visible changes.
What
Carry the response sink per-request with AsyncLocalStorage:
Chosen over threading a sink argument through handleRequest() because all 15 response call sites funnel through send/sendResult/sendError — the async-local approach leaves every one of them untouched, so the diff is three functions rather than fifteen call sites plus a signature change.
Acceptance
stdio path byte-identical in behaviour; existing tests unchanged and passing
send() falls back to stdout when no sink is set (i.e. stdio mode)
a unit test proves two concurrent handleRequest calls with different sinks do not cross responses
Activity