AAK-MCP-STATELESS-003: Sticky-session / shared-store dependency in MCP deployment
- Severity
- MEDIUM
- Category
- MCP Configuration (
mcp-config) - Scanner
agent_audit_kit/scanners/mcp_stateless_migration.py- Auto-fixable
- No.
- SARIF name
McpStickySessionDependency
What it detects
An MCP server's deployment manifest requires sticky routing (nginx ip_hash, Kubernetes sessionAffinity: ClientIP, Traefik / ALB sticky cookies) or its handler code reads a shared session store keyed by a per-connection id used across requests. The 2026-07-28 stateless transport guarantees that any MCP request can land on any server instance — sticky routing and gateway deep-packet-inspection to keep a client pinned to one pod stop being safe assumptions.
How to fix
Remove sticky-session affinity from the gateway and Kubernetes service. Move per-request state into an external store keyed on an out-of-band identity (auth subject) rather than a per-connection session id. Re-test horizontal scaling without affinity before the 2026-07-28 cutover.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-MCP-STATELESS-003
Limitations
Looks for nginx ip_hash; or sticky cookie|route|learn, Kubernetes sessionAffinity: ClientIP, stickiness.enabled = true and a Traefik sticky: cookie block in .yaml, .yml, .conf and .toml files and in Caddyfile that mention MCP or belong to a project that declares an MCP SDK, and, in such a project, source lookups of session_store, sessions, state_by_session or per_session_state indexed by session_id, sid or mcp_session_id. Pinning clients some other way, such as nginx hash $http_mcp_session_id consistent;, is not matched. A source file over 512 KB, a config file over 1 MB or a manifest over 2 MB is not read.
References
- CSA AI Controls Matrix (AICM): IVS-04, BCR-04
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-STATELESS-003.md: the page then shows that text, with the registry reference appended under it.