Skip to content

Add Limits and Maximum Payload Size#8

Merged
caleb-mabry merged 12 commits intomainfrom
feature/page-size-and-limit
Feb 23, 2026
Merged

Add Limits and Maximum Payload Size#8
caleb-mabry merged 12 commits intomainfrom
feature/page-size-and-limit

Conversation

@caleb-mabry
Copy link
Copy Markdown

@caleb-mabry caleb-mabry commented Feb 11, 2026

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_URI environment variable such as postgresql://myusername:mypassword@127.0.0.1:5432/mydb

uv sync
uv 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.

@caleb-mabry caleb-mabry marked this pull request as ready for review February 17, 2026 17:17
@caleb-mabry caleb-mabry merged commit 3c4d57f into main Feb 23, 2026
1 check passed
@caleb-mabry caleb-mabry deleted the feature/page-size-and-limit branch February 23, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants