litellm/tests/mcp_tests
bunnysayzz 48e8b99752 fix(mcp): support YAML OpenAPI specs in MCP server
load_openapi_spec_async() hardcoded json.loads() / r.json() for both
URL and local-file paths. YAML OpenAPI specs (common in the wild,
e.g. firefly-iii, Petstore) fail with 'Expecting value: line 1 column
1' because YAML is not valid JSON.

Detect YAML via file extension (.yaml/.yml) or Content-Type header and
use yaml.safe_load(). For URLs without a YAML indicator, fall back to
YAML parsing when JSON fails (handles raw GitHub URLs that serve YAML
with text/plain Content-Type).

Added 3 new tests: local YAML file, URL with YAML Content-Type, and
URL with .yaml extension but plain text Content-Type. All 5 tests pass.

Fixes #38951

Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-09-14 13:08:08 +05:30
..
test_configs fix(mcp): preserve proxy logging and authorization coverage (#40337) 2026-09-09 02:01:01 +00:00
conftest.py Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_deflake_20260821 2026-08-27 09:17:37 +00:00
mcp_e2e_upstream_server.py test(e2e): mcp suite for key-without-access denial (#33752) 2026-07-17 16:04:43 -07:00
mcp_server.py fix(mcp): preserve proxy logging and authorization coverage (#40337) 2026-09-09 02:01:01 +00:00
test_aresponses_api_with_mcp.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_mcp_auth_header_extraction.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_auth_priority.py feat(mcp): graft v2 resolver onto _create_mcp_client (none + api_key static family) (#31058) 2026-06-24 14:53:33 -07:00
test_mcp_chat_completions.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_client_unit.py fix(mcp): follow tools/list pagination from upstream servers (#39172) 2026-09-01 14:34:14 -07:00
test_mcp_guardrails.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_mcp_hooks.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_mcp_litellm_client.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_mcp_logging.py test(mcp): drain the logging worker after each test so queued callbacks cannot leak into the next test (#38228) 2026-08-25 10:50:35 -07:00
test_mcp_server.py fix(mcp): scope allow-all servers to virtual keys (#39531) 2026-09-03 10:32:03 -07:00
test_oauth2_mcp_config.yaml [UI] M2M OAuth2 UI Flow (#20794) 2026-02-09 19:28:02 -08:00
test_openapi_spec_path_url.py fix(mcp): support YAML OpenAPI specs in MCP server 2026-09-14 13:08:08 +05:30
test_per_user_oauth_cache.py [internal copy of #28008] Support MCP OAuth passthrough and issuer-scoped JWT auth (#28356) 2026-06-02 12:22:04 -07:00
test_proxy_mcp_e2e.py fix(mcp): reject initialize with 403 when the key grants no MCP servers (#40616) 2026-09-10 14:25:30 -07:00
test_semantic_tool_filter_e2e.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00