Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Merge branch 'litellm_internal_staging' into litellm_agent365_mcp_guardrail

yuchengb1c357339043
diff --cc litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
index c912c69bf6a,bafe33d0a6b..5b0bcc254b2
--- a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py
@@@ -2483,16 -2497,7 +2502,16 @@@ async def _build_oauth_protected_resour
if obo_response is not None:
return obo_response
+ agent_365_issuers: Final = agent_365_authorization_servers(mcp_server, None) if mcp_server else ()
+ if mcp_server is not None and agent_365_issuers:
+ agent_365_metadata: Final[_ProtectedResourceMetadata] = {
+ "authorization_servers": agent_365_issuers,
+ "resource": resource_url,
+ "scopes_supported": agent_365_scopes_supported(mcp_server, None),
+ }
+ return agent_365_metadata
+
- if explicitly_named and mcp_server is not None and mcp_server.advertises_gateway_authorization_server:
+ if mcp_server is not None and mcp_server.advertises_gateway_authorization_server:
return {
"authorization_servers": [f"{request_base_url}/mcp"],
"resource": resource_url,
diff --cc litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
index 7ccd6307373,3291d5effc2..35b8aece527
--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
@@@ -5191,14 -5360,8 +5366,14 @@@ class MCPServerManager
verbose_logger.info("Successfully fetched %s tools from server %s", len(prefixed_tools), server.name)
return prefixed_tools
+ def get_listed_tool(self, server: MCPServer, name: str) -> MCPTool | None:
+ listed: Final = self._listed_tools_by_server_id.get(server.server_id)
+ if not listed:
+ return None
+ return listed.get(name) or listed.get(strip_known_server_prefix(name, server))
+
def _create_prefixed_prompts(
- self, prompts: list[Prompt], server: MCPServer, add_prefix: bool = True
+ self, prompts: Sequence[Prompt], server: MCPServer, add_prefix: bool = True
) -> list[Prompt]:
"""
Create prefixed prompts and update prompt mapping.
diff --cc litellm/proxy/_experimental/mcp_server/server.py
index bf9e1f1567f,fc87db69e16..545df2ba25b
--- a/litellm/proxy/_experimental/mcp_server/server.py
+++ b/litellm/proxy/_experimental/mcp_server/server.py
@@@ -56,7 -56,7 +56,8 @@@ from litellm.proxy._experimental.mcp_se
)
from litellm.proxy._experimental.mcp_server.oauth_utils import (
_redact_mcp_resource_url,
+ get_byok_www_authenticate,
+ get_passthrough_resource_metadata_url,
get_passthrough_www_authenticate,
get_route_relative_request_path,
well_known_root_suffix,