Add Limits and Maximum Payload Size#8
Merged
caleb-mabry merged 12 commits intomainfrom Feb 23, 2026
Merged
Conversation
daochidq
approved these changes
Feb 23, 2026
daochidq
approved these changes
Feb 23, 2026
ryohang
approved these changes
Feb 23, 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.
Purpose
Add a limit to all calls. Also add a max payload size so the server does not flood our API with too much data.
Test this yourself?
Provide a
DATABASE_URIenvironment variable such aspostgresql://myusername:mypassword@127.0.0.1:5432/mydbuv syncuv run postgres-mcp --transport streamable-http(Connect with
http://localhost:8000/mcp)uv run postgres-mcp --transport sse(Connect with
http://localhost:8000/sse)What happens if...
I don't specify pageSize?
Returns first 100 rows (default_page_size)
I request more than 500 rows?
API validation rejects the request (max_page_size limit)
My query already has LIMIT 1000?
Your LIMIT is respected, pagination is not applied
However, if result exceeds 1MB payload size, you'll get an error
My 100 rows exceed 1MB?
Query executes but returns error: "Query result payload too large: X.XXMb exceeds maximum allowed size of 1MB"
Error suggests using LIMIT/OFFSET, filtering, or refining the query
I need to paginate through results?
First page: pageSize=100, offset=0
Second page: pageSize=100, offset=100
Third page: pageSize=100, offset=200, etc.