Skip to content

mcp: add an sse event size cap - #1205

Open
yarolegovich wants to merge 6 commits into
mainfrom
yarolegovich/add-request-size-checks
Open

mcp: add an sse event size cap#1205
yarolegovich wants to merge 6 commits into
mainfrom
yarolegovich/add-request-size-checks

Conversation

@yarolegovich

Copy link
Copy Markdown
Member

update sse I/O code to limit the amount of memory a single non-terminated event can take

@yarolegovich
yarolegovich force-pushed the yarolegovich/add-request-size-checks branch from 6112a13 to a433a9f Compare August 28, 2026 07:01
Comment thread mcp/event.go Outdated
Comment on lines +68 to +70
// defaultMaxEventSize bounds the number of bytes buffered for a single SSE
// event before the input gets rejected.
const defaultMaxEventSize = 16 << 20 // 16 MiB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not we allow the possibility to override this value?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initially was thinking about hiding it under mcp_go_debug, together with json depth check, but thinking about it it's going to be more consistent if we expose this as a config and omit mcp go debug for the depth check, I can't imagine a legitimate need for very deep nesting

guglielmo-san
guglielmo-san previously approved these changes Aug 31, 2026
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.

2 participants