remove max message size (#1105)

This commit is contained in:
Inna Harper 2025-07-08 15:56:18 +01:00 • committed by GitHub
commit beacd6e009
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,8 +46,6 @@ from mcp.types import (
logger = logging.getLogger(__name__)
# Maximum size for incoming messages
MAXIMUM_MESSAGE_SIZE = 4 * 1024 * 1024 # 4MB
# Header names
MCP_SESSION_ID_HEADER = "mcp-session-id"
@ -329,13 +327,6 @@ class StreamableHTTPServerTransport:
# Parse the body - only read it once
body = await request.body()
if len(body) > MAXIMUM_MESSAGE_SIZE:
response = self._create_error_response(
"Payload Too Large: Message exceeds maximum size",
HTTPStatus.REQUEST_ENTITY_TOO_LARGE,
)
await response(scope, receive, send)
return
try:
raw_message = json.loads(body)