A race error in the PHP MCP kit sent results to incorrect requests
In a test with parallel calls, 21 results went to an incorrect request and 22 were empty.
A developer found that a live MCP server gave the result of one tool call to a different call. MCP, the Model Context Protocol, is a standard that connects AI agents to tools. The server used the PHP kit, version 0.8.1. The cause is a race: 2 requests of one session write the same session data, and one write erases the other.
How it works
The kit keeps a session for each client. It puts each result in a queue in the session data. Then it reads the queue to make the answer. Each request works on a copy of the session data and writes all of it back. Thus 2 requests at one time can erase or interchange a result.
The numbers
In the FrankenPHP test, 21 results were for a different request and 22 were empty. The php-fpm test gave the same error. The logs showed no error. The same calls in sequence were always correct.
What is not known
The text gives no test of the changed releases. The change in the kit had 3 pull requests, which are code changes that are sent for a check, and 2 releases. The author also describes a different server that keeps no session.
Insight: A session that a server does not need is a risk
A study of 9 November 2026 names the stateful session server as one of 5 MCP patterns. This error is in that pattern. The author also describes a server that keeps no session. Each session is data that parallel agents share, thus it is possibly safer to keep no session unless the server must have one. Check this for each server that you operate.
Sources
Posted