fix(mcp): support MCP 2.x timeouts 🤖🤖🤖 - #314
Conversation
Preserve MCP 1.x compatibility by adapting the timeout type at the SDK boundary. Fixes NVIDIA-NeMo#262 Signed-off-by: Srinivas Venkatanarayanan <nikola.tesla195@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe MCP client detects the installed SDK major version and adapts session read timeouts for MCP 1.x and 2.x. SSE, stdio, and streamable HTTP transports use the adapted value. Tests cover both timeout contracts. ChangesMCP timeout compatibility
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to MCP clients now pass read timeouts in the representation required by MCP 1.x or 2.x across supported transports, preventing MCP 2.x session initialization failures. No current merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Normalize SDK tool fields and streamable HTTP transport tuples, and keep the real test server compatible across MCP 1.x and 2.x. Refs NVIDIA-NeMo#262 Signed-off-by: Srinivas Venkatanarayanan <nikola.tesla195@gmail.com>
|
Thanks for the contribution! |
What does this PR do?
ClientSessionread timeouts for the MCP 1.x and 2.x contracts.Tool.inputSchemaandTool.input_schemaduring tool discovery.MCPServerrename.mcp.types.Tooland both transport tuple shapes.Related issues
Closes #262
Validation
tests/test_mcppassed, 107 tests.tests/test_mcppassed, 107 tests, including real stdio and streamable HTTP invocation.tests/test_mcppassed, 107 tests, including real stdio and streamable HTTP invocation.uv run ruff check .uv run ruff format --check .uv run python scripts/check_license_headers.pyclient.pyand the bundled server;tool.pystill reports existing errors on untouched lines.Checklist
uv run ruff check .anduv run ruff format --check .pass)uv run pytest)🤖🤖🤖