Dockerfile sets ENV MCP_SESSION_MODE="stateless", but .env.example carries a commented # MCP_SESSION_MODE=stateful, whose comment documents the value set as stateful | stateless (default: stateful). The container and the same code run via bunx, npm start, or from source therefore resolve to different session modes — stateless in Docker, stateful everywhere else, since the framework schema defaults to auto and auto resolves to stateful.
Related: cyanheads/mcp-ts-core#376
Proposal
Make stateless this server's single, explicit default across every surface, so the mode no longer depends on how the server was launched.
Philosophy: the session store should be opt-in, not the posture you get by forgetting to set an env var.
This server holds no per-session state. Stateless removes the session store and the per-session McpServer allocation, and lets the process scale horizontally.
Scope
.env.example — set MCP_SESSION_MODE=stateless as the active, uncommented default.
- Correct the documented value set to
auto | stateful | stateless, noting that auto resolves to stateful. The current text omits auto, which is the schema default.
Dockerfile — keep ENV MCP_SESSION_MODE="stateless"; it becomes a restatement of the documented default rather than an override of it.
- Declare the mode in
src/ once createApp accepts it (see the dependency below), so the posture is stated in code rather than carried only by deployment env.
Out of scope
- Changing the framework's own schema default. That is client-visible protocol behavior and is tracked upstream.
- Auth or tenancy changes.
MCP_SESSION_MODE is independent of MCP_AUTH_MODE.
Dependencies
DockerfilesetsENV MCP_SESSION_MODE="stateless", but.env.examplecarries a commented# MCP_SESSION_MODE=stateful, whose comment documents the value set asstateful | stateless (default: stateful). The container and the same code run viabunx,npm start, or from source therefore resolve to different session modes — stateless in Docker, stateful everywhere else, since the framework schema defaults toautoandautoresolves tostateful.Related: cyanheads/mcp-ts-core#376
Proposal
Make stateless this server's single, explicit default across every surface, so the mode no longer depends on how the server was launched.
Philosophy: the session store should be opt-in, not the posture you get by forgetting to set an env var.
This server holds no per-session state. Stateless removes the session store and the per-session
McpServerallocation, and lets the process scale horizontally.Scope
.env.example— setMCP_SESSION_MODE=statelessas the active, uncommented default.auto | stateful | stateless, noting thatautoresolves tostateful. The current text omitsauto, which is the schema default.Dockerfile— keepENV MCP_SESSION_MODE="stateless"; it becomes a restatement of the documented default rather than an override of it.src/oncecreateAppaccepts it (see the dependency below), so the posture is stated in code rather than carried only by deployment env.Out of scope
MCP_SESSION_MODEis independent ofMCP_AUTH_MODE.Dependencies
createAppsessionModeoption; the.env.exampleandDockerfilehalf of this issue can land without it)