Principle:8beeeaaat Touchdesigner mcp Stateless Streamable HTTP
| Knowledge Sources | |
|---|---|
| Domains | HTTP_Transport, Server_Lifecycle |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
A stateless HTTP transport pattern where every MCP request is served by a fresh server instance from a factory, with no protocol-level sessions or session IDs, and with DNS-rebinding protection built into the Express app.
Description
Under MCP protocol revision 2026-07-28, protocol-level sessions were removed: there is no Mcp-Session-Id header, and GET/DELETE on the endpoint return 405. The stateless streamable HTTP pattern embraces this by creating a new McpServer per request via a factory, served by createMcpHandler which speaks the 2026-07-28 revision and transparently falls back to stateless 2025-era serving on the same endpoint. The Express app is created by the SDK's createMcpExpressApp which adds DNS-rebinding protection for localhost. The manager owns the HTTP server lifecycle: start mounts the handler on `/mcp` and a health check on `/health`; stop closes the MCP handler first (ending open subscription streams) then the HTTP server.
Usage
Use this principle when serving MCP over HTTP and you want horizontal scalability (any request can go to any worker) without session affinity.
Theoretical Basis
// Abstract algorithm (NOT real implementation)
async function start(config, factory, logger) {
handler = createMcpHandler(() => factory()); // per-request server
app = createMcpExpressApp({ host: config.host }); // DNS rebinding guard
app.all(config.endpoint, (req, res) => handler(req, res, req.body));
app.get("/health", (_, res) => res.json({ status: "ok" }));
server = app.listen(config.port, config.host);
}
async function stop() {
await handler.close(); // end subscription streams first
await server.close();
}
Key properties:
- No session state: every request is independent.
- Protocol-era fallback: 2026 and 2025 clients share one endpoint.
- Graceful shutdown: handler closed before HTTP server.