Merge pull request #9642 from BerriAI/litellm_mcp_improvements_expose_sse_urls

[Feat] - MCP improvements, add support for using SSE MCP servers
This commit is contained in:
Ishaan Jaff 2025-03-29 19:37:57 -07:00 committed by GitHub
commit f5c0afcf96
25 changed files with 1220 additions and 30 deletions

View file

@ -0,0 +1,16 @@
from typing import TYPE_CHECKING, Optional
from pydantic import BaseModel, ConfigDict
from typing_extensions import TypedDict
class MCPInfo(TypedDict, total=False):
server_name: str
logo_url: Optional[str]
class MCPSSEServer(BaseModel):
name: str
url: str
mcp_info: Optional[MCPInfo] = None
model_config = ConfigDict(arbitrary_types_allowed=True)

View file

@ -1644,6 +1644,33 @@ class StandardLoggingUserAPIKeyMetadata(TypedDict):
user_api_key_end_user_id: Optional[str]
class StandardLoggingMCPToolCall(TypedDict, total=False):
name: str
"""
Name of the tool to call
"""
arguments: dict
"""
Arguments to pass to the tool
"""
result: dict
"""
Result of the tool call
"""
mcp_server_name: Optional[str]
"""
Name of the MCP server that the tool call was made to
"""
mcp_server_logo_url: Optional[str]
"""
Optional logo URL of the MCP server that the tool call was made to
(this is to render the logo on the logs page on litellm ui)
"""
class StandardBuiltInToolsParams(TypedDict, total=False):
"""
Standard built-in OpenAItools parameters
@ -1674,6 +1701,7 @@ class StandardLoggingMetadata(StandardLoggingUserAPIKeyMetadata):
requester_ip_address: Optional[str]
requester_metadata: Optional[dict]
prompt_management_metadata: Optional[StandardLoggingPromptManagementMetadata]
mcp_tool_call_metadata: Optional[StandardLoggingMCPToolCall]
applied_guardrails: Optional[List[str]]