Configure persistence for MCP Gateway
MCP involves multi-step, stateful interactions. Without persistence, requests from the same session might land on different servers, resulting in session lookup failures, such as "Session not found".
NetScaler® uses MCP session identifiers to enforce persistence, ensuring reliability and correctness for multi-step MCP interactions. It ensures that all requests belonging to a single MCP session are consistently routed to the same backend MCP server using session-aware persistence. As a result, no client-side changes are required, because NetScaler:
-
Ensures session continuity.
-
Prevents backend state loss.
-
Improves reliability of
tool/execution.
Configure persistence by using the CLI
Configure rule-based persistence on the load balancing virtual server using MCP-specific expressions.
set lb vserver lb_app1_mcp SSL 0.0.0.0 0 -persistenceType RULE -rule "http.req.header(\"Mcp-Session-Id\")" -resRule "http.res.header(\"Mcp-Session-Id\")"
Validation
-
Initiate an MCP session.
-
Repeat the tool calls using the same session.
-
Verify whether the same backend server handles all the requests.
Troubleshooting
Session errors
Check the persistence rule.
Uneven load
Review the timeout settings and backend capacity.
Non-sticky behavior
Verify the header and session extraction configuration.