fix req changes

This commit is contained in:
Harshit28j 2026-03-21 00:35:53 +05:30
parent ba080bb88c
commit bcb18420c9
2 changed files with 13 additions and 7 deletions

View file

@ -4768,16 +4768,18 @@ class StandardLoggingPayloadSetup:
if proxy_server_request is not None:
_request_headers = proxy_server_request.get("headers", {})
if _request_headers and isinstance(_request_headers, dict):
_sensitive_x_header = re.compile(
r"^(x-litellm-api-key|x-api-key|x-goog-api-key"
r"|x-mcp-(auth|servers|access-groups)"
r"|x-mcp-.+-(authorization|x-api-key))$"
)
custom_headers = {
k: v
for k, v in _request_headers.items()
if k.lower().startswith("x-")
and v is not None
and isinstance(v, str)
and not re.match(
r"^x-mcp-.+-(authorization|x-api-key)$",
k.lower(),
)
and not _sensitive_x_header.match(k.lower())
}
if custom_headers:
clean_metadata["requester_custom_headers"] = custom_headers

View file

@ -378,9 +378,6 @@ if MCP_AVAILABLE:
body_data["litellm_trace_id"] = chain_id
body_data["litellm_session_id"] = chain_id
_scope_headers: list[tuple[bytes, bytes]] = [
(b"content-type", b"application/json"),
]
_scope_headers: list[tuple[bytes, bytes]] = [
(b"content-type", b"application/json"),
]
@ -391,6 +388,13 @@ if MCP_AVAILABLE:
_scope_headers.append(
(k.lower().encode("latin-1"), v.encode("latin-1"))
)
request = Request(
scope={
"type": "http",
"method": "POST",
"path": "/mcp/tools/call",
"headers": _scope_headers,
}
)
if user_api_key_auth is not None:
data = await add_litellm_data_to_request(