mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
fix: add IP filtering to get_mcp_server_by_id path in fetch_mcp_server
Apply _is_server_accessible_from_ip check after get_mcp_server_by_id lookup to prevent external callers from accessing MCP servers configured with available_on_public_internet=False when they know the server_id. Made-with: Cursor
This commit is contained in:
parent
c96fcb9ab5
commit
3bbbbff1a8
1 changed files with 4 additions and 0 deletions
|
|
@ -700,6 +700,10 @@ if MCP_AVAILABLE:
|
|||
|
||||
client_ip = IPAddressUtils.get_mcp_client_ip(request)
|
||||
registry_server = global_mcp_server_manager.get_mcp_server_by_id(server_id)
|
||||
if registry_server is not None and not global_mcp_server_manager._is_server_accessible_from_ip(
|
||||
registry_server, client_ip
|
||||
):
|
||||
registry_server = None
|
||||
if registry_server is None:
|
||||
# Try lookup by server_name or alias (client may use display name in URL)
|
||||
registry_server = global_mcp_server_manager.get_mcp_server_by_name(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue