diff --git a/litellm/types/router.py b/litellm/types/router.py index 217364c48b7..44985a28c66 100644 --- a/litellm/types/router.py +++ b/litellm/types/router.py @@ -100,6 +100,7 @@ class RetryPolicy(BaseModel): RateLimitErrorRetries: int | None = None ContentPolicyViolationErrorRetries: int | None = None InternalServerErrorRetries: int | None = None + NotFoundErrorRetries: int | None = None class UpdateRouterConfig(BaseModel): diff --git a/mcp_servers.json b/mcp_servers.json index 3dd21c0d65f..88d454e1dff 100644 --- a/mcp_servers.json +++ b/mcp_servers.json @@ -1,4 +1,11 @@ { + "github": { + "http_url": "https://api.githubcopilot.com/mcp/", + "description": "GitHub MCP server for repository operations, issues, pull requests, and workflow management.", + "env": { + "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PERSONAL_ACCESS_TOKEN}" + } + }, "zapier": { "sse_url": "https://mcp.zapier.com/api/mcp" }, diff --git a/tests/router_unit_tests/test_router_helper_utils.py b/tests/router_unit_tests/test_router_helper_utils.py index c883890f5f6..fcdcb8a0526 100644 --- a/tests/router_unit_tests/test_router_helper_utils.py +++ b/tests/router_unit_tests/test_router_helper_utils.py @@ -1352,6 +1352,7 @@ def test_track_deployment_metrics(model_list): "ContentPolicyViolationError", 7, ), + (litellm.exceptions.NotFoundError, "NotFoundError", 0), ], ) def test_get_num_retries_from_retry_policy( @@ -1375,6 +1376,26 @@ def test_get_num_retries_from_retry_policy( assert calc_num_retries == num_retries +def test_get_num_retries_from_retry_policy_not_found_error(model_list): + """Test NotFoundError retry policy mapping.""" + from litellm.router import RetryPolicy + from litellm.router_utils.get_retry_from_policy import get_num_retries_from_retry_policy + + backup_retry_policy = RetryPolicy(NotFoundErrorRetries=9) + exception = litellm.NotFoundError( + message="test", + llm_provider="openai", + model="gpt-5-mini", + ) + + calc_num_retries = get_num_retries_from_retry_policy( + exception=exception, + retry_policy=backup_retry_policy, + ) + + assert calc_num_retries == 9 + + @pytest.mark.parametrize( "exception_type, exception_name, allowed_fails", [ diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py index 9a741a3f861..ac7a782307e 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py @@ -103,6 +103,21 @@ class TestMCPRegistryFile: missing = expected - names assert not missing, f"Missing well-known servers: {missing}" + def test_root_mcp_servers_file_contains_github(self): + repo_root = os.path.abspath( + os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "..") + ) + config_path = os.path.join(repo_root, "mcp_servers.json") + assert os.path.exists(config_path), f"Config not found at {config_path}" + + with open(config_path, "r") as f: + data = json.load(f) + + assert "github" in data, "Root MCP config should include a GitHub server entry" + github_config = data["github"] + assert github_config.get("http_url") or github_config.get("sse_url") + assert "github" in (github_config.get("description") or "").lower() + def test_env_vars_structure(self, registry_path): with open(registry_path, "r") as f: data = json.load(f)