fix: narrow OpenAI audio format dict to Literal for ty (#3936)

This commit is contained in:
Jeremiah Lowin 2026-04-14 13:09:54 -04:00 committed by GitHub
commit 8c020adfc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@
import json
from collections.abc import Iterator, Sequence
from typing import Any, get_args
from typing import Any, Literal, get_args
from mcp import ClientSession, ServerSession
from mcp.shared.context import LifespanContextT, RequestContext
@ -48,7 +48,7 @@ except ImportError as e:
) from e
# OpenAI only supports wav and mp3 for input audio
_OPENAI_AUDIO_FORMATS: dict[str, str] = {
_OPENAI_AUDIO_FORMATS: dict[str, Literal["wav", "mp3"]] = {
"audio/wav": "wav",
"audio/x-wav": "wav",
"audio/mp3": "mp3",

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any, cast
from typing import TYPE_CHECKING, Any
from urllib.parse import urlparse
from mcp.server.auth.handlers.token import TokenErrorResponse
@ -789,7 +789,7 @@ class OAuthProvider(
)
protected_routes = create_protected_resource_routes(
resource_url=self._resource_url,
authorization_servers=[cast(AnyHttpUrl, self.issuer_url)],
authorization_servers=[self.issuer_url],
scopes_supported=supported_scopes,
)
oauth_routes.extend(protected_routes)