Make proxy request-body limit configurable - #6298
Open
Sanskarzz wants to merge 1 commit into
Open
Conversation
Sanskarzz
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
aponcedeleonch,
blkt,
jerm-dro,
jhrozek,
rdimitrov,
reyortiz3 and
tgrunnagle
as code owners
August 13, 2026 05:34
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6298 +/- ##
==========================================
- Coverage 77.70% 77.70% -0.01%
==========================================
Files 756 756
Lines 72788 72807 +19
==========================================
+ Hits 56563 56574 +11
- Misses 16220 16228 +8
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Sanskarzz
force-pushed
the
configurable-2
branch
2 times, most recently
from
August 16, 2026 17:26
727e33c to
71fc56f
Compare
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Sanskarzz
force-pushed
the
configurable-2
branch
from
August 22, 2026 17:20
71fc56f to
f9b5153
Compare
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.
Summary
The proxy currently enforces a fixed 8 MiB request-body limit. Users cannot
raise it for legitimate large MCP payloads, such as inline images or documents,
or lower it for stricter environments.
pkg/bodylimitmiddleware configurable through RunConfig,thv run,thv proxy, andMCPServer.spec.maxRequestBodySize.rejecting negative values instead of treating them as unlimited.
workload upgrade.
Fixes #5505
Type of change
Test plan
task test)task test-e2e)task lint-fix)task build)./cmd/help/verify.sh)Generated artifacts were refreshed with
task operator-generate,task operator-manifests,task crdref-gen, andtask docs.The complete operator integration task was also run. Two unrelated OIDC
deletion-race specs failed with UID precondition errors; the focused MCPServer
integration suite passed all 82 specs.
API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.The new
MCPServer.spec.maxRequestBodySizefield is optional and additive.Existing resources retain the current 8 MiB default.
Changes
pkg/runner/{config.go,config_builder.go}pkg/runner/{middleware.go,runner.go}cmd/thv/app/{run_flags.go,proxy.go}--max-request-body-sizetothv runandthv proxy.cmd/thv-operator/api/v1beta1/mcpserver_types.gospec.maxRequestBodySizefield with admission validation.cmd/thv-operator/controllers/mcpserver_runconfig.gopkg/workloads/upgrade/applier.goDoes this introduce a user-facing change?
Yes. Users can configure the maximum inbound MCP proxy request-body size in
bytes through:
thv run --max-request-body-sizethv proxy --max-request-body-sizeMCPServer.spec.maxRequestBodySizeOmitting the setting or specifying zero retains the 8 MiB default. Negative
values are rejected.
Implementation plan
Approved implementation plan
MaxRequestBodySizeto the shared RunConfig and expose a validatingbuilder option.
pkg/bodylimit, resolving zero to its existing 8 MiB default.while preserving the order of every other middleware.
documentation.
Special notes for reviewers
RunConfig.MaxRequestBodySizeis authoritative. Existing serializedbody-limit entries are replaced and duplicates are removed while preserving
the order of all other middleware.
management API's 1 MiB limit, the auth server's 64 KiB limit, and vMCP's fixed
8 MiB limit are unchanged.
pkg/bodylimitmiddleware; it does not add anotherrequest-limiting implementation.