[mcp] fix: reject bad-version notifications - #257
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe change reorders JSON-RPC request validation in ChangesJSON-RPC Version Validation Ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
-32600 Invalid Requestwithid: nullfor bad-version notifications across direct handling, stdio, and HTTP/rpcVerification
PYTHONPATH=src pytest tests/mcp/test_server.py::test_mcp_initialized_notification_with_bad_version_is_invalid_request tests/mcp/test_http_api.py::test_http_rpc_bad_version_notification_returns_invalid_request_envelope -qfailed with directNoneand HTTP202PYTHONPATH=src pytest tests/mcp/test_server.py::test_mcp_stdio_bad_version_notification_is_invalid_request_error -qfailed with zero stdout lines under the old handler orderPYTHONPATH=src pytest tests/mcp/test_server.py::test_mcp_initialized_notification_with_bad_version_is_invalid_request tests/mcp/test_server.py::test_mcp_stdio_bad_version_notification_is_invalid_request_error tests/mcp/test_http_api.py::test_http_rpc_bad_version_notification_returns_invalid_request_envelope -q-> 3 passedPYTHONPATH=src pytest tests/mcp/test_server.py tests/mcp/test_http_api.py -q-> 300 passedPYTHONPATH=src pytest tests -q-> 1016 passed, 11 skippedmkdocs build --strict-> passed with known Material for MkDocs warningpre-commit run --all-files --show-diff-on-failure-> passedPYTHONPATH=src pytest tests/test_package_metadata.py -q-> 13 passedLocal Review
Summary by CodeRabbit
Bug Fixes
jsonrpcversion other than"2.0"now return a clearInvalid Requesterror instead of being silently ignored.id: null.Documentation
Tests