Skip to content

πŸš€ The fast, Pythonic way to build MCP servers and clients.

Authenticate and pin the schema download in the OpenAPI performance test (#6177)

nate nowacka66dd71de890
diff --git a/tests/server/providers/openapi/test_openapi_performance.py b/tests/server/providers/openapi/test_openapi_performance.py
index 926c94f27..2eb4ce74e 100644
--- a/tests/server/providers/openapi/test_openapi_performance.py
+++ b/tests/server/providers/openapi/test_openapi_performance.py
@@ -4,6 +4,7 @@ These tests ensure that large OpenAPI schemas (like GitHub's API) parse quickly
and don't regress to the slow performance we had before optimization.
"""
+import os
import time
from typing import Any
@@ -34,9 +35,14 @@ class TestOpenAPIPerformance:
rather a canary to ensure we don't regress significantly.
"""
- # Download the full GitHub API schema (typically ~10MB)
+ # Download the full GitHub API schema (typically ~10MB), pinned so the
+ # timing measures our parser rather than upstream growth. Anonymous
+ # downloads from raw.githubusercontent.com get rate limited in CI, so
+ # authenticate when CI provides a token.
+ token = os.environ.get("FASTMCP_GITHUB_TOKEN")
response = httpx2.get(
- "https://raw.githubusercontent.com/github/rest-api-description/refs/heads/main/descriptions-next/ghes-3.17/ghes-3.17.json",
+ "https://raw.githubusercontent.com/github/rest-api-description/524bcb0799ab2b14c239d68e8e1e7f4508a631f9/descriptions-next/ghes-3.17/ghes-3.17.json",
+ headers={"Authorization": f"Bearer {token}"} if token else None,
timeout=30.0, # Allow time for download
)
response.raise_for_status()