Issue details
With FX_MCP_ENGINE=v2, the first call to a remote HTTP MCP server after a few idle minutes can fail with:
MCP server '<name>' ended the call: the server went away. The tool may have run.The server never receives the call.
Steps to reproduce:
- Add a remote MCP server hosted on Vercel to
~/.fx/mcp.jsonwith"type": "http". - Start fx with
FX_MCP_ENGINE=v2and call one of its tools. The call succeeds. - Wait six minutes and call the tool again.
Expected: the call reaches the server, as it does with the default engine.
Actual: the call fails with the error above.
Client.run and Client.fetchRun in src/mcp/io/http.zig use the std.http.Client keep-alive pool, which hands back an idle connection without checking it. Vercel's edge closes idle connections after about 340 seconds, so the next request goes out on a closed socket. The v1 engine sets keep_alive = false on every request. #1366 applies the same setting to v2 and adds a deterministic test that fails on main.
Reproduced with fx 0.0.14 on macOS arm64.
Trace
No response
Sensitive information
- I reviewed the information above and removed secrets and other sensitive data.
Activity
0No activity yet.