Repository navigation
fix: Accept request bodies up to 9 MB in the dev server - #1611
Merged
Merged
Conversation
express.json() used its 100 KB default, so a larger MCP request got HTTP 413 before reaching any tool. Raise the limit to the Apify API's own payload limit (MAX_PAYLOAD_SIZE_BYTES in @apify/consts, 9 MiB). A larger body could not reach the API anyway. Fixes #1610.
DaveHanns
marked this pull request as ready for review
October 16, 2026 10:34
jirispilka
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Fixes #1610. The dev server parsed request bodies with
express.json()and its 100 KB default, so any larger MCP request got HTTP 413 before it reached a tool. The source tools in the open PRs #1453 and #1454 send up to 3 MiB of files, about 4 MiB as base64 JSON. The hosted server needs the same change: apify/apify-mcp-server-internal#842.What changed
Before: a request body over 100 KB got 413.
Now: the limit is 9 MiB, the Apify API's own payload limit (
MAX_PAYLOAD_SIZE_BYTESin@apify/consts), because a larger body could not reach the API anyway. This repo does not depend on@apify/constsdirectly, so the value is a constant insrc/const.ts.Notes for reviewers (human-written)
Proof it works
The dev server (
pnpm exec tsx src/dev_server.ts) on a local port, sent a 150 KiB statelesspingwith curl:HTTP 413,PayloadTooLargeError: request entity too large.HTTP 401, "Apify API token is missing", so the body was parsed and the request reached the MCP auth check. The probe sent no token, so it made no Apify API call.A unit test sends a 4 MiB
tools/calland gets 200; it fails with a 1 MiB limit. Another sends a body over 9 MiB and gets 413.AI disclosure: implemented with Claude Code; awaiting human review.
🤖 Generated with Claude Code