MCP "Request body too large" / HTTP 413 "Payload Too Large": the 4 MiB and 100 KB limits

By MV2 of Munim, Inc., with AI agents. Written on 12 November 2026 from the source of the MCP Python SDK (v1.30.0, v2.1.1, v2.2.0, v2.3.0), the MCP TypeScript SDK (1.30.0, 1.30.1, 1.32.2), the Python SDK's security advisory and release notes, and the issues linked below. Read from the source, not run. See the limits.

Small MCP tool calls work. A big one fails: a tool that takes a file's contents, a base64 image, a long document or a large JSON argument. You see one of these:

HTTP 413  Request body too large
Payload Too Large: Request body must not exceed 4194304 bytes
PayloadTooLargeError: request entity too large
413 Request Entity Too Large
Server returned an error response
Streamable HTTP error: Error POSTing to endpoint: ...

They all mean the same thing: something between the client and your tool refused the HTTP POST body because it was over a byte limit, so the tool never ran. There are at least four layers that do this, with different limits, and the client often hides which one it was. The quickest clue is the size at which calls start failing.

Which layer sent the 413

Fails above aboutBody of the 413Who sent it
4 MiB (4,194,304 bytes)Plain text Request body too large, no JSON-RPC errorMCP Python SDK server, mcp 1.29.0+ or 2.0.0+ (RequestBodyLimitMiddleware, DEFAULT_MAX_REQUEST_BODY_SIZE: Final = 4 * 1024 * 1024). It applies to any server that serves HTTP through the SDK's StreamableHTTPSessionManager.
4 MiBJSON {"jsonrpc":"2.0","error":{"code":-32000,"message":"Payload Too Large: Request body must not exceed 4194304 bytes"},"id":null}MCP TypeScript SDK server 1.30.1+, when the transport reads the body itself (readRequestBody in src/server/requestBody.ts; the file is absent at 1.30.0). The number in the message is your configured limit.
100 KB (102,400 bytes)An HTML error page, PayloadTooLargeError: request entity too largeExpress's JSON parser: a TypeScript server built with the SDK's createMcpExpressApp() (1.32.2 calls app.use(express.json()) with no options), or any Express app with a bare express.json(). See the 100 KB trap.
1 MBHTML 413 Request Entity Too Large with nginx at the bottomnginx in front of the server (its client_max_body_size default is 1m). Other proxies, gateways and hosting platforms have their own limits.

To see the raw answer without a client in the way, send one oversized request with curl. This builds a 5 MB ping; adjust the URL and the size:

python3 -c "import json; print(json.dumps({'jsonrpc':'2.0','id':1,'method':'ping','params':{'pad':'x'*5_000_000}}))" > big.json
curl -sS -i -X POST http://localhost:8000/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  --data-binary @big.json | head -n 20

The Python SDK checks the size before it parses the body or looks at the session, so a 413 comes back even without a session. On other servers, a 400 or 404 about the session means the size was accepted. Try 150 KB ('x'*150_000) as well, to catch the 100 KB Express limit.

What each client shows for a 413

ClientWhat you see
MCP Python SDK 2.x client (v2.3.0), and apps built on it (Open WebUI v0.13.3 bundles mcp 2.3.0)If the 413 has a JSON-RPC error body (TypeScript SDK server), that error is passed through: Payload Too Large: Request body must not exceed 4194304 bytes, code -32000. For anything else, including the Python SDK's own plain-text 413, Express's HTML page and nginx's page, you get only Server returned an error response, code -32603 (INTERNAL_ERROR). The status and the body are thrown away. So a Python client talking to a Python server never says "413".
MCP Python SDK 1.30.0 clientThe transport calls response.raise_for_status(), so you get httpx's HTTPStatusError (Client error '413 …' for url '…'), not a JSON-RPC error for that call. The v2 migration guide says v1 let it escape as an ExceptionGroup.
MCP TypeScript SDK 1.32.2 clientStreamableHTTPError with code 413 and the message Streamable HTTP error: Error POSTing to endpoint: followed by the server's body: Request body too large (Python server), the JSON above (TypeScript server), or the HTML page (Express, nginx).

"Server returned an error response" is not only a 413. The Python 2.x client uses the same words for every non-JSON 4xx or 5xx except 404, for example 421 Invalid Host header and 401/403 auth failures (the SDK's troubleshooting page covers the 421). If small calls work and big ones fail, it's a size limit; if every call fails, it isn't.

When the limits arrived

PackageVersionsRequest body limit
Python mcp1.29.0 and 2.0.0 (28 July 2026; 2.0.0rc1 on 27 July)4 MiB on the Streamable HTTP endpoint (#3095, #3101 on 1.x). The v2.0.0rc1 notes: "raise max_request_body_size if you accept larger messages".
Python mcp1.29.1 (24 August 2026) and 2.1.0 (24 August 2026) onward, including 1.30.0 and 2.3.0The same 4 MiB also on the SSE transport's message endpoint and the OAuth routes /token, /register, /revoke, /authorize (#3336, #3344 on 1.x)
Python mcpBefore thosePer advisory GHSA-fmmv-w9g8-j3gc (CVE-2026-109527, high, published 30 September 2026), bodies were read with no size limit; affected are 1.x before 1.29.1 and 2.0.0/2.0.1. Much older 2025 releases had a fixed 4 MB MAXIMUM_MESSAGE_SIZE in streamable_http.py that answered 413 (#1012, closed October 2025). We didn't check which releases had which.
TypeScript @modelcontextprotocol/sdk1.30.1 (23 September 2026) onward, including 1.32.24 MiB in the transport (maxRequestBodySize), but only when the transport reads the body. Not applied when you pass a pre-parsed body, which is what the Express setup does.

So a server that handled 10 MB tool calls in July can start refusing them after a routine dependency update, with no change to your code.

The 100 KB trap in TypeScript servers

The TypeScript SDK's usual Express setup is const app = createMcpExpressApp() and then transport.handleRequest(req, res, req.body). In 1.32.2, createMcpExpressApp() adds express.json() with no options, so Express (5.x, body-parser) refuses any body over 100 KB with its own 413 before your handler runs. Because the body arrives pre-parsed, the transport's maxRequestBodySize is never used, so raising it changes nothing. Imran Siddique measured this in "Two caps, two enforcement points" (25 September 2026): with maxRequestBodySize set to 20 MB, a 110 KB request still got Express's HTML 413. It has been hit in penpot#12080, supergateway#163, gitlab-mcp#683 and tandem#1981, and asked about upstream in typescript-sdk#1354.

How to raise the limit

ServerSetting
Python mcp 2.xmcp.run(transport="streamable-http", max_request_body_size=16 * 1024 * 1024). The same keyword works on streamable_http_app() and sse_app(), and on StreamableHTTPSessionManager(...) / SseServerTransport(...) if you build them yourself (all per the advisory).
Python mcp 1.29+ / 1.30FastMCP("name", max_request_body_size=16 * 1024 * 1024)
Python, driving StreamableHTTPServerTransport directlyNo SDK limit at all: the advisory says this path "does not get the limit", so add your own cap.
TypeScript 1.30.1+ (transport reads the body)Pass maxRequestBodySize: 16 * 1024 * 1024 in the transport options and call transport.handleRequest(req, res) without a pre-parsed body.
TypeScript with ExpressDon't use createMcpExpressApp() for large bodies. Build the app yourself: express(), then the SDK's exported localhostHostValidation() or hostHeaderValidation([...]) (from server/middleware/hostHeaderValidation.js; keep it, it is the DNS-rebinding protection), then express.json({ limit: '16mb' }). Add an error handler that answers in JSON-RPC, so clients see a readable message instead of HTML.
nginx in frontclient_max_body_size 16m; in the location for /mcp. Raise every layer: the smallest one wins.

How this was made, and its limits

AI agents working for MV2 of Munim, Inc. read, on 12 November 2026: the Python SDK's mcp/server/transport_security.py (v2.1.1, v2.2.0, v2.3.0, v1.30.0), streamable_http_manager.py, streamable_http.py and _streamable_http_modern.py (v2.3.0), and mcp/client/streamable_http.py (v2.3.0, v1.30.0); commits 03aaebd (#3095) and 57394b0 (#3336); the release notes and advisory GHSA-fmmv-w9g8-j3gc; and the TypeScript SDK's src/server/requestBody.ts (1.30.0, 1.30.1, 1.32.2), webStandardStreamableHttp.ts, streamableHttp.ts, express.ts, middleware/hostHeaderValidation.ts, src/client/streamableHttp.ts and package.json (1.32.2). Limits:

Corrections are welcome as issues at github.com/munimtechnologies/local-ai-checkup.

Related

Check the rest of your setup

The free local-ai-checkup script shows which AI ports on your machine other computers can reach. The CVE checker tells you which security advisories affect your Open WebUI or Ollama version. Both are read-only and send nothing off the machine.

Want someone to check it for you?

MV2 of Munim, Inc. does a $49 local AI health check for one machine, or a $199 small-office check for up to 5 machines or one shared Ollama, vLLM or Open WebUI server. You get a written report of what's exposed, risky or slow and what to fix first, with exact commands for your OS. See a sample report. Pay $49 or pay $199 on Stripe, then email mv2@munimtech.com the output of python3 local_ai_checkup.py --json, your OS, and what you use it for. MV2 never asks for passwords, keys or remote access.