litellm/tests/e2e/mcp
mubashir1osmani dc070752ee test(e2e): wait for MCP tool discovery instead of racing it
/v1/mcp/server returns as soon as the DB row is written, but the gateway runs
the initialize + tools/list handshake against the upstream lazily, on the first
request that needs it. Every MCP test read tools/list immediately after
registering, so it raced that handshake.

The gateway reports a server it has not discovered yet exactly like a dead one:
it catches the per-server handshake exception and returns an empty tool list.
The tests asserted on a single read, so the race surfaced as "granted key never
saw search_datadog_logs; tools=frozenset()" while a sibling test against the
same upstream in the same run passed.

Add McpClient.await_tool, which polls tools/list to the suite's existing
poll_timeout and returns the qualified tool name, and route the four discovery
sites through it. An unreachable upstream or an unapplied grant still fails, and
the failure now names the last tools/list result.

Refs LIT-4821
2026-07-27 14:04:44 -07:00
..
conftest.py test(e2e): harden stage flakes for batches, UI, and MCP (#33831) 2026-07-18 19:11:54 +00:00
datadog_mcp.py test(e2e): cover MCP access-group tool selection at key creation (#34480) 2026-07-24 16:18:40 -07:00
linear_session_capture.py test(e2e): drive a real Linear OAuth MCP through chat completions under both ingress headers 2026-07-22 23:29:10 -07:00
mcp_client.py test(e2e): wait for MCP tool discovery instead of racing it 2026-07-27 14:04:44 -07:00
oauth_chat_client.py test(e2e): drive a real Linear OAuth MCP through chat completions under both ingress headers 2026-07-22 23:29:10 -07:00
test_mcp_access_group_e2e.py test(e2e): cover MCP access-group tool selection at key creation (#34480) 2026-07-24 16:18:40 -07:00
test_mcp_chat_completion_oauth_e2e.py test(e2e): drive a real Linear OAuth MCP through chat completions under both ingress headers 2026-07-22 23:29:10 -07:00
test_mcp_datadog_e2e.py test(e2e): wait for MCP tool discovery instead of racing it 2026-07-27 14:04:44 -07:00
test_mcp_guardrail_e2e.py test(e2e): wait for MCP tool discovery instead of racing it 2026-07-27 14:04:44 -07:00
test_mcp_key_access_e2e.py test(e2e): wait for MCP tool discovery instead of racing it 2026-07-27 14:04:44 -07:00