Repository navigation
Reject coerced MCP approvals and keep malformed input from terminating stdio - #3
Merged
Merged
Conversation
…hema On top of the strict-boolean and envelope validation already on this branch: - initialize answers with the client's protocol version when supported (2025-11-25, 2025-06-18, 2025-03-26, 2024-11-05), else the newest. - authorize_install_command declares readOnlyHint, title and outputSchema. - Unknown tool names are -32602 (invalid params), as the MCP spec requires. - 116 tests pass (21 new across this branch). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GFY8tiYGqCiEEE36EPdjo
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.
The MCP tool converts allow_review with bool(), so the string "false" grants permission to proceed on REVIEW. Non-object JSON messages can also terminate the stdio server, and malformed params are not consistently rejected.
Require a real boolean for allow_review, a nonempty string command and a supported policy. Validate request envelopes, IDs and params before dispatch; ignore notifications without executing a tool; and support ping. Valid true/false approvals retain their existing behavior.
Validation: 14 of the initial 16 regression cases failed before the fix. The final suite passes all 113 tests, including 18 new validation and stdio-continuity cases. Tests use mocked command decisions and do not execute installs. One existing FastAPI/Starlette test-client deprecation warning remains.
Not merged or released to PyPI.