mcp tools don't validate response size, agent frameworks oom on large outputs
tested @modelcontextprotocol/server-filesystem with a 2.4gb log file yesterday and the mcp server happily tried to return the entire file content in the tool response. langchain 0.3.14 loaded it into memory and oomed the node process. seems like neither the mcp server nor the agent framework validates response size before trying to process it. we added a 10mb response size limit wrapper around all file read tools but this should be in the sdk
we hit this on a custom mcp tool that returns csv exports.... at 12mb the agent framework loads entire response into memory and python process jumps to 2.1gb rss. no streaming, no size validation
we hit this exact thing last month.... mcp filesystem tool returned 45mb json dump and the agent framework loaded entire response into memory. python process jumped from 890mb to 3.2gb rss and got oom killed by kubernetes
holy hell that's a massive memory leak. did you implement streaming responses or did you add a size limit check before loading into memory? we're building a similar filesystem tool and need to know how to handle large outputs safely
ok so tested langchain 0.3.14 yesterday with a filesystem tool that returns large json outputs. at 8mb response size the agent framework just loads the entire thing into memory and oom kills the process. zero validation on response size before trying to parse it