You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: make maxTokenSize of client transport SSE event handling configurable #726
I have also been affected by this 1MB limit. Here is my business scenario:
I registered a tool used to list a resource containing a list of server endpoint information descriptions on the server side. Each resource entry includes descriptive information of varying lengths (some long, some short).
When I enter a relatively large amount of server information (currently around 0.87MB), constructing the JSON-RPC response body—according to the protocol specification, where structured data is placed in StructuredContent and the JSON-serialized data is placed in Content—exceeds the 1MB limit.
It is expected that my list will continue to grow, so this 1MB restriction does have a practical impact on me.
Of course, I could implement alternative strategies at the business level, but I similarly believe that this limit should be exposed as a configurable option.
My work involves life science research, particularly in the area of complex molecular analysis. These analyses often include sequences and corresponding analytical content that can easily exceed the 1 MB limit.
As a result, I am currently forced to fork a copy of the code and modify the restriction myself in order to continue using it.
We did design the memory event store to be somewhat production grade (that's why we set a maximum cache size in the first place), so making this configurable seems OK to me.
changed the title [-]Proposal: make cache size of the MemoryEventStore configurable[/-][+]Proposal: make maxTokenSize of client transport SSE event handling configurable[/+]on Dec 23, 2025
Ok, now that I understand this, I'm not sure configuration is the right fix: servers can still return >1MB by using more than one line of SSE data. The line buffering is arbitrary, and I'd prefer not to expose this arbitrary buffering in our API.
Having some configurable limits it's a good practice, but the error should be properly surfaced to the caller (compared to the error returned now when buffer is exceeded). Having that in place would help avoid some scenarios where a faulty/abusive server sends very large responses and crash the client process (which might be a server interacting with multiple mcp servers).
On the other side CommandTransport doesn't have that limitation (it reads the stream without a limit on the buffer) - but this could be argued that you're reading from executing another local command (which you maybe trust more than a remote server).
Short version: having that limit is good, but it should be configurable and have better errors.
@alexbumbacea my major counterpoint to that argument is that there isn't really a limit that guards the in-memory buffer: if the message is split across multiple "data:" fields then the message can still be arbitrarily large.
I think this needs more research. If none of the other SDKs have a buffer limit, I don't think we should either.
That's a fair point. I had a look over implementation of python, javascript and also mark3labs implementation and there is no such limitation.
I will proceed with modifying the PR to remove the buffer size.
Hi @alexbumbacea, it's more than a week that the latest implementation proposal has been provided on the issue, I think we're good to go with accepting it and proceeding. Would you still like to contribute? I can assign you to the issue in that case.
Activity
findleyr commentedon Dec 15, 2025
Is this actually causing you problems? Our assumption is that the in-memory event store is not really practical for production applications.
Of course, we could make this configurable, but need to understand the use-case first.
zxxf18 commentedon Dec 17, 2025
I have also been affected by this 1MB limit. Here is my business scenario:
I registered a tool used to list a resource containing a list of server endpoint information descriptions on the server side. Each resource entry includes descriptive information of varying lengths (some long, some short).
When I enter a relatively large amount of server information (currently around 0.87MB), constructing the JSON-RPC response body—according to the protocol specification, where structured data is placed in StructuredContent and the JSON-serialized data is placed in Content—exceeds the 1MB limit.
It is expected that my list will continue to grow, so this 1MB restriction does have a practical impact on me.
Of course, I could implement alternative strategies at the business level, but I similarly believe that this limit should be exposed as a configurable option.
feat: sse event limit 1M modelcontextprotocol#726
zxxf18 commentedon Dec 17, 2025
My work involves life science research, particularly in the area of complex molecular analysis. These analyses often include sequences and corresponding analytical content that can easily exceed the 1 MB limit.
As a result, I am currently forced to fork a copy of the code and modify the restriction myself in order to continue using it.
findleyr commentedon Dec 17, 2025
@jba @markus-kusano any objection to making this configurable?
We did design the memory event store to be somewhat production grade (that's why we set a maximum cache size in the first place), so making this configurable seems OK to me.
[-]sse event limit 1M and cann't changed[/-][+]Proposal: make cache size of the MemoryEventStore configurable[/+][-]Proposal: make cache size of the MemoryEventStore configurable[/-][+]Proposal: make maxTokenSize of client transport SSE event handling configurable[/+]findleyr commentedon Dec 23, 2025
In my haste, I misunderstood the report, FWIW: the issue is not about MemoryEventStore, but rather our event scanner.
Agree that we should fix this. Probably 1MB is too small a default, as well.
findleyr commentedon Dec 23, 2025
Ok, now that I understand this, I'm not sure configuration is the right fix: servers can still return >1MB by using more than one line of SSE data. The line buffering is arbitrary, and I'd prefer not to expose this arbitrary buffering in our API.
Can we just eliminate the buffering entirely?
alexbumbacea commentedon Dec 24, 2025
Having some configurable limits it's a good practice, but the error should be properly surfaced to the caller (compared to the error returned now when buffer is exceeded). Having that in place would help avoid some scenarios where a faulty/abusive server sends very large responses and crash the client process (which might be a server interacting with multiple mcp servers).
On the other side CommandTransport doesn't have that limitation (it reads the stream without a limit on the buffer) - but this could be argued that you're reading from executing another local command (which you maybe trust more than a remote server).
Short version: having that limit is good, but it should be configurable and have better errors.
findleyr commentedon Dec 31, 2025
@alexbumbacea my major counterpoint to that argument is that there isn't really a limit that guards the in-memory buffer: if the message is split across multiple "data:" fields then the message can still be arbitrarily large.
I think this needs more research. If none of the other SDKs have a buffer limit, I don't think we should either.
alexbumbacea commentedon Jan 3, 2026
That's a fair point. I had a look over implementation of python, javascript and also mark3labs implementation and there is no such limitation.
I will proceed with modifying the PR to remove the buffer size.
maciej-kisiel commentedon Jan 20, 2026
Hi @alexbumbacea, it's more than a week that the latest implementation proposal has been provided on the issue, I think we're good to go with accepting it and proceeding. Would you still like to contribute? I can assign you to the issue in that case.
alexbumbacea commentedon Jan 20, 2026
@maciej-kisiel fell free to assign it to me. There is already a proposal in #734
maciej-kisiel commentedon Jan 21, 2026
Great, thanks!
maciej-kisiel commentedon Feb 5, 2026
#734 was merged, closing this as done.