Sequence · Diagram Design
One tool call: the transport queues it, the worker runs it, the transport answers
One tools/call through the server, from the client to the worker and back
Five actors: the MCP client, the transport, the worker, the protocol and the registry. Eight numbered steps show one tools/call: the client sends it, the transport queues it in the worker with a limit of 64, the worker asks the protocol to answer it, the protocol checks the era, the _meta and the tool name, the worker checks the arguments and runs the tool from the registry, the registry returns a result or an error, the worker hands the reply to the transport with a limit of 40 000 characters, and the transport writes one stdout line or an HTTP 200. The worker is busy from step 3 to step 7, so the next call waits in the queue.
MCP client
the agent
Transport
stdio / HTTP
Worker
worker.py
Protocol
protocol.py
Registry
registry.py
1 tools/call
2 submit (max 64)
3 answer(message)
4 era, _meta, tool
5 check args, run
6 dict or error
7 reply
8 stdout or HTTP 200
worker busy from step 3 to step 7: the next call waits in the queue
1 stdio.py:38 · http_transport.py:143
2 stdio.py:43 · http_transport.py:154
3 worker.py:72 · protocol.py:191
4 protocol.py:100-105, 168-171
5 worker.py:155-158
6 worker.py:159-168
7 worker.py:72, 161-163 · 40 000 chars at most
8 stdio.py:12 · http_transport.py:162
ping and tools/list skip the queue (stdio.py:45)
cancel on stdio: the reader sets the flag (worker.py:93)
cancel on HTTP, modern era: the client closes (http_transport.py:155-159)