mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
fix: use stored credentials for secured mcp servers in /mcp-rest/tools/list
This commit is contained in:
parent
9cee51abb9
commit
ee0c034adb
2 changed files with 6 additions and 2 deletions
|
|
@ -49,7 +49,7 @@ if MCP_AVAILABLE:
|
|||
mcp_server_auth_headers: Optional[Dict[str, Dict[str, str]]],
|
||||
mcp_auth_header: Optional[str],
|
||||
) -> Optional[Union[Dict[str, str], str]]:
|
||||
"""Helper function to get server-specific auth header with case-insensitive matching."""
|
||||
"""Auth from request headers first; otherwise use stored credentials"""
|
||||
if mcp_server_auth_headers and server.alias:
|
||||
normalized_server_alias = server.alias.lower()
|
||||
normalized_headers = {
|
||||
|
|
@ -66,7 +66,9 @@ if MCP_AVAILABLE:
|
|||
server_auth = normalized_headers.get(normalized_server_name)
|
||||
if server_auth is not None:
|
||||
return server_auth
|
||||
return mcp_auth_header
|
||||
if mcp_auth_header:
|
||||
return mcp_auth_header
|
||||
return server.authentication_token
|
||||
|
||||
def _create_tool_response_objects(tools, server_mcp_info):
|
||||
"""Helper function to create tool response objects."""
|
||||
|
|
|
|||
|
|
@ -478,6 +478,7 @@ class TestListToolsRestAPI:
|
|||
allowed_tools = None
|
||||
mcp_info = {"server_name": "stub"}
|
||||
available_on_public_internet = True
|
||||
authentication_token = None
|
||||
|
||||
stub_server = StubServer()
|
||||
|
||||
|
|
@ -596,6 +597,7 @@ class TestCallToolRestAPI:
|
|||
allowed_tools = None
|
||||
mcp_info = {"server_name": "stub"}
|
||||
available_on_public_internet = True
|
||||
authentication_token = None
|
||||
|
||||
stub_server = StubServer()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue