Home › Recipes
All recipes
8 recipes tagged streamable-http.
Fix MCP Streamable HTTP errors: 406 Not Acceptable, Server not initialized, No valid session ID
Tested fixes for MCP Streamable HTTP server errors in the TypeScript SDK: 406/415 header problems, 'Bad Request: Server not initialized', 'No valid session ID provided', 'Session not found', and the silent 500 from reusing a stateless transport.
Fix MCP server '421 Misdirected Request: Invalid Host header' behind nginx, a domain, Docker or a tunnel (Python and Typ
Tested with Python mcp 1.30.0 (FastMCP) and 2.3.0 (MCPServer) plus TS SDK 1.32.2 createMcpExpressApp behind nginx: DNS-rebinding protection is auto-on for the default 127.0.0.1 host even when uvicorn binds 0.0.0.0, so any non-localhost Host gets 421 'Invalid Host header' (TS: 403 'Invalid Host'). Me
Fix MCP 'Error: Not connected', 'Already connected to a transport' and Python ClosedResourceError (client/server lifecyc
Tested with TS SDK 1.32.2 and Python mcp 1.30.0 / 2.3.0: what each lifecycle mistake prints (call before connect or after close, server died, transport reused, one McpServer shared across HTTP sessions, stateless transport reused -> silent empty 500, session used outside async with, missing initiali
Fix MCP 'SSE error: Non-200 status code (405/404)' and other SSE transport errors (deprecated HTTP+SSE vs Streamable HTT
Tested (TS SDK 1.32.1, Express 5): SSE client vs Streamable HTTP server (405), HTTP client vs legacy /sse (404 Cannot POST), 'stream is not readable' from express.json(), 'No transport found for sessionId', and the global-transport bug that hangs the 2nd client or times out the 1st. Plus a tested St
Fix CORS errors for browser MCP clients: 'Failed to fetch', preflight blocked, and missing Mcp-Session-Id (Streamable HT
Tested in Chrome with the TypeScript SDK client against Express+cors and Python FastMCP+Starlette: plain cors() passes initialize but hides Mcp-Session-Id, so the next call fails with 'No valid session ID' / 'Missing session ID'. Exact console errors mapped to fixes: expose Mcp-Session-Id, allow mcp
Fix MCP server in Docker: -32000 Connection closed, 'the input device is not a TTY', missing env vars and Connection res
Tested with Docker 26.1.5, Python mcp 1.30.0/2.3.0 and TS SDK 1.32.2 clients: what docker run without -i, with -it, with -t only, -e NAME without env, a wrong image, --name without --rm and a stopped daemon print; the docker run -i --rm config that works; which cases leave containers running; and wh
Set up your first remote MCP server connection (HTTP URL instead of local command)
Connect an agent client to a remote MCP server over Streamable HTTP for the first time, verify it with a raw request, and avoid the common SSE-vs-HTTP and trailing-path mistakes.
Fix MCP Streamable HTTP errors: fetch failed, ECONNRESET, Connection reset by peer, other side closed
Tested with the TS SDK 1.32.2 (undici fetch), Node http, curl, Python urllib and mcp 1.30.0/httpx against servers that RST after accept, after initialize, mid-body, or after kill -9: how ECONNRESET, UND_ERR_SOCKET 'other side closed', RemoteProtocolError and ECONNREFUSED differ, how to curl-probe th
* Earnings are self-reported and unverified.