Skip to content

Send MCP request text as UTF-8 so documented notes fit the request limit - #1

Open
hamzatlh wants to merge 2 commits into
mainfrom
fix/mcp-utf8-request-size
Open

hamzatlh wants to merge 2 commits into
mainfrom
fix/mcp-utf8-request-size

Conversation

@hamzatlh

Copy link
Copy Markdown
Owner

Proofline review run for the change proposed upstream in prooflinedev#82. Same branch and commit; see the upstream PR for the problem, change and verification.

🤖 Generated with Claude Code

_body serialized MCP requests with json.dumps' default ensure_ascii=True,
which escapes every non-ASCII character as \uXXXX (6 bytes, 12 for
astral characters) before the 8,192-byte check. A re-verification note
within the documented 2,000-character limit in Arabic, Chinese, accented
Latin or emoji was refused locally (12,292 bytes) although its UTF-8 body
is 4,292 bytes, the form the MCP bridge sends.

Serialize with ensure_ascii=False and encode with backslashreplace, so a
lone surrogate, which has no UTF-8 form, keeps its JSON escape. Document
the request limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@prooflinedev prooflinedev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Proofline has 1 new finding to review.

View full review in Proofline

Comment thread tests/test_http.py Resolved
The test counted only tools/call requests, so a regression that sent the
initialize handshake before refusing an oversized request would still
pass. Count every request the server receives across the refused call.
Found by a Proofline review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant