litellm/tests/test_litellm/proxy/_experimental/mcp_server
Ishaan Jaff 19024e0602
[Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788)
* add has_client_credentials

* MCPOAuth2TokenCache

* init MCP Oauth2 constants

* MCPOAuth2TokenCache

* resolve_mcp_auth

* test fixes

* docs fix

* address greptile review: min TTL, env-configurable constants, tests, docs

- Fix zero-TTL edge case: floor at MCP_OAUTH2_TOKEN_CACHE_MIN_TTL (10s)
- Make all MCP OAuth2 constants env-configurable via os.getenv()
- Move test file to follow 1:1 mapping convention (test_oauth2_token_cache.py)
- Add MCP OAuth doc page (mcp_oauth.md) with M2M and PKCE sections
- Update FAQ in mcp.md to reflect M2M support
- Add E2E test script and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix mypy lint

* fix oauth2

* remove old files

* docs fix

* address greptile comments

* fix: atomic lock creation + validate JSON response shape

- Use dict.setdefault() for atomic per-server lock creation
- Add isinstance(body, dict) check before accessing token response fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: replace asserts with proper guards, wrap HTTP errors with context

- Replace `assert` statements with `if/raise ValueError` (asserts can be
  disabled with python -O in production)
- Wrap `httpx.HTTPStatusError` to provide a clear error message with
  server_id and status code
- Add tests for HTTP error and non-dict JSON response error paths
- Remove unused imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 17:35:11 -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 [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -08:00
test_mcp_server_manager.py [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -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_oauth2_token_cache.py [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -08:00
test_openapi_to_mcp_generator.py Revert "Stabilise mock tests" 2026-01-17 06:26:18 +09:00
test_rest_endpoints.py [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -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