mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-07 07:58:09 +00:00
Merge pull request #1 from Siraj637909/fix/gh-36896-notfound-retries
fix(mcp): add GitHub MCP server config
This commit is contained in:
commit
e17b4f01e1
4 changed files with 44 additions and 0 deletions
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
[
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue