Skip to content

feat(config): default MCP_SESSION_MODE to stateless across env, Docker, and src #11

Description

@cyanheads

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions