Repository navigation
fix(mcp): harden stdio framing, notifications, and tool parameter handling - #564
Merged
Merged
Conversation
…dling - Frame stdin as bytes and decode UTF-8 properly (no more byte-as-char), recover from stray '}'/garbage with a -32700 parse error, cap message size. - Do not respond to notifications; notifications/cancelled no longer stops the server (only shutdown/EOF); tools/call without a name returns -32602. - find_affected_tests: use file stem, escape LIKE wildcards, cap files. - Clamp limit/depth/min_lines, cap review_diff size. - cora.install requires confirm:true to write and validates agent names. - Remove unused since/branch params from cora.get_debt schema. - AGENT.md: tool count 15 -> 18. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: ajianaz <[email protected]>
ajianaz
added a commit
that referenced
this pull request
Oct 8, 2026
) Covers security hardening (#563, #572, #573), fixes (#553, #561, #562, #564, #565, #574-#576), and the ignore-pattern semantic changes from #577 that can alter which files existing configs exclude. Signed-off-by: ajianaz <[email protected]> Co-authored-by: ajianaz <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
What
Fixes the MCP stdio server framing and JSON-RPC protocol handling, and hardens several tool handlers (
src/mcp/server.rs,src/mcp/tools.rs).Why
byte as char, corrupting multi-byte UTF-8;brace_depthcould go negative on a stray}and never recover; there was no message size cap.notifications/cancelledshut the whole server down.tools/callwith a missing name fell through to "Unknown tool".find_affected_testsused the file extension instead of the stem and passed unescaped LIKE wildcards; several params were unbounded.cora.installran withyes: trueover MCP with no confirmation;cora.get_debtadvertisedsince/branchbut ignored them.How
Framer: accumulates bytes, decodes UTF-8 per message, supports newline-delimited and pretty-printed objects, resets and returns-32700on stray}/garbage/invalid UTF-8/truncated input, caps messages at 16 MiB (oversized messages are skipped and the stream resyncs).idnever get a response;notifications/*handled silently; onlyshutdown(or EOF) stops the server.tools/callwith missing/empty name returns-32602.Path::file_stem,LIKE ... ESCAPE,filescapped at 200,limit<=500,depth<=10,min_lines<=100000,review_diffdiff capped at 1 MiB.cora.install: requiresconfirm: trueto write (not needed forlist/dry_run) and validatesagentsagainst the known set.cora.get_debt: removed unusedsince/branchfrom the schema. Tool count stays 18.AGENT.md: 15 -> 18 tools.Testing
cargo test --features tree-sitterpassescargo fmt --all -- --checkpassescargo clippy --all-targets --features tree-sitter -- -D warningspassescargo build --release --features tree-sitterpasses (not run; debug build/clippy/test clean)serve()with Japanese/emoji split byte-by-byte, pretty-printed JSON, stray}, garbage lines, invalid UTF-8, truncated EOF, oversized message, notification without id,notifications/cancelled,shutdown, and missing tool name.Tool tests cover the file-stem candidates, LIKE escaping against real SQLite,
filescap, param clamping, diff cap, install confirm/agent validation, and the 18-tool count.Related Issues
None.
Checklist
fix/,feat/,docs/,chore/,refactor/,test/,perf/,security/)develop🤖 Generated with Claude Code