litellm/tests/test_litellm/proxy/_experimental/mcp_server
shin-bot-litellm 1477b4b46b
fix(tests): Add missing mocks for MCP IP filtering and updated APIs (#20652)
Fixes 15 failing tests in the MCP test suite:

1. **OAuth discoverable endpoints** (test_discoverable_endpoints.py):
   - Added autouse fixture to mock IPAddressUtils.get_mcp_client_ip
   - This bypasses IP-based access control which was blocking server lookup
   - Fixes: test_authorize_*, test_token_*, test_oauth_*, test_register_*

2. **A2A endpoints** (test_a2a_endpoints.py):
   - Fixed mock path for add_litellm_data_to_request
   - Was patching litellm_pre_call_utils but function is called from common_request_processing

3. **MCP guardrail handler** (test_mcp_guardrail_handler.py):
   - Updated tests to match new handler behavior
   - Handler now passes tools (not texts) to guardrail
   - Handler checks for mcp_tool_name (not messages array)

4. **MCP path-based segregation** (test_user_api_key_auth_mcp.py):
   - Added client_ip to get_auth_context unpacking (7 values now)
   - get_auth_context was updated to include client_ip

5. **MCP registry** (test_mcp_management_endpoints.py):
   - Added mock for get_filtered_registry (not just get_registry)
   - Registry endpoint uses get_filtered_registry for IP filtering

Co-authored-by: Shin <shin@openclaw.ai>
2026-02-07 11:30:49 -08:00
..
auth fix(tests): Add missing mocks for MCP IP filtering and updated APIs (#20652) 2026-02-07 11:30:49 -08:00
guardrail_translation fix(tests): Add missing mocks for MCP IP filtering and updated APIs (#20652) 2026-02-07 11:30:49 -08:00
test_discoverable_endpoints.py fix(tests): Add missing mocks for MCP IP filtering and updated APIs (#20652) 2026-02-07 11:30:49 -08:00
test_jwt_mcp_enforcement.py [Bug] Ensure MCP permissions are enforced when using JWT Auth (#20383) 2026-02-03 19:13:13 -08:00
test_jwt_mcp_simple.py [Bug] Ensure MCP permissions are enforced when using JWT Auth (#20383) 2026-02-03 19:13:13 -08:00
test_mcp_cost_calculator.py [Feat] Add MCP Cost Tracking (#12385) 2025-07-07 21:08:10 -07:00
test_mcp_custom_fields.py feat: add UI support for configuring meta URLs 2026-01-02 15:07:37 +09:00
test_mcp_metadata_preservation.py Feat/mcp preserve tool metadata calltoolresult (#17561) 2025-12-05 16:15:22 -08:00
test_mcp_server.py filter_server_ids_by_ip 2026-02-07 10:08:20 -08:00
test_mcp_server_manager.py CI/CD: Increase retries and stabilize litellm_mapped_tests_core (#19826) 2026-01-26 17:00:18 -08:00
test_mcp_stale_session.py fix: MCP "Session not found" error on VSCode reconnect (#20298) 2026-02-02 14:15:31 -08:00
test_openapi_to_mcp_generator.py Revert "Stabilise mock tests" 2026-01-17 06:26:18 +09:00
test_rest_endpoints.py filter_server_ids_by_ip 2026-02-07 10:08:20 -08:00
test_semantic_tool_filter.py Fix litellm/tests/test_litellm/proxy/_experimental/mcp_server/test_semantic_tool_filter.py tests 2026-02-03 15:01:10 +05:30
test_ui_session_utils.py fix: mcp deepcopy error 2025-12-16 07:02:07 +09:00