Repository navigation
fix(mcp): connect to servers without tool capabilities - #6019
Conversation
fd4da3c to
99c6770
Compare
99c6770 to
ca3c855
Compare
ca3c855 to
db5839e
Compare
Re-bin
left a comment
There was a problem hiding this comment.
Resource-only and prompt-only MCP servers can now connect without an unsupported tools/list call. Initialization capabilities are authoritative; servers advertising tools retain the existing pagination and registration path. Protocol-shaped fixtures and the real-SDK combined checks cover the capability boundary. Existing toolsets and schemas are unchanged, but newly usable catalogs necessarily add tools when connected, so zero cache impact is not claimed for that first expansion. No configuration or stored-data migration.
Fresh final-base MCP/connection/tool-validation tests: 294 passed; exact-head CI passed on its first execution. Independent main Windows timeout observations are retained in the review record and are not claimed fixed by this MCP change; merge remains gated on green main checks as well.
connect_mcp_servers()always callstools/listafter initialization. A valid server that exposes only resources or prompts advertises no tools capability and can reject that request withMethod not found, aborting the connection before its resources or prompts are discovered.Only request tool discovery when the initialize result advertises the tools capability. Existing tool pagination and advertised-tool failure handling remain intact, while resource-only and prompt-only servers can reach their existing discovery paths.
Validation:
116 passed.uv run --no-sync pytest tests/tools tests/agent/test_mcp_connection.py tests/agent/test_mcp_reconnect_crash.py tests/agent/test_mcp_transient_retry.py -q:1140 passed, 66 skippedon Windows / Python 3.13.git diff --checkpassed.ServerandClientSessionover in-memory streams. Resource-only and prompt-only servers both failed to connect before the fix; afterward both connected and their registered wrappers executed successfully. Only the stdio transport factory was replaced.AI assistance: Codex assisted with implementation, regression tests, and local verification.