What are stateless MCP servers?
A stateful MCP server keeps a connection or anMcp-Session-Id for each client, so the server knows which requests belong together. A stateless server keeps nothing between requests: each request is an independent HTTP call, and often a new server instance handles it. This makes horizontal scaling simple, and the MCP protocol version of 2026-07-28 makes stateless servers the standard.
AgentCat needs no stateless option in any SDK. The same tracking code works on stateless HTTP, stateful HTTP, and stdio.
Track each server instance
A stateless server often creates a new server object for each request, in a factory function that your MCP library calls. Eachtrack() call tracks one instance, so the call goes inside that factory. This is the TypeScript example from its setup page:
track() call for each request costs little. Some SDKs need no extra code: in C#, WithAgentCat() tracks each server that stateless HTTP builds, and the PHP framework bridges track every server that they build.
How sessions work without server state
AgentCat does not depend on the transport to group calls into sessions. It adds asession_id parameter to each tool:
- On the first call of a task, the agent sends
start(or no value). The result starts with a text block that gives the agent a newses_ID. - The agent sends that ID on its later calls, so the calls of one task share a session, whichever server instance answers them.
- AgentCat removes the parameter before your tool runs, so your code never sees it.
resolveSessionId hook (named for the style of each language) can give it to AgentCat instead. AgentCat then derives a fixed session from your value and adds no session_id parameter.
Why identifying users matters
Sessions tell you which calls belong to one task. Identity tells you which user each session belongs to, so that you can follow one user across many tasks. On a stateless server, theidentify hook runs on each tool call of each instance, so we recommend a hook that reads the request or a cheap cache. See Identifying Users.