diff --git a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py index e9ec8de83dd..2b36577f2d9 100644 --- a/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py +++ b/litellm/proxy/_experimental/mcp_server/discoverable_endpoints.py @@ -420,6 +420,20 @@ async def callback(code: str, state: str): ) +def _html_safe_json(value: object) -> str: + """ + JSON-serialize a value for safe embedding inside HTML ', + state="normal_state", + ) + + # Payload must be escaped: < -> \u003c, > -> \u003e (safe for + assert '\\u003c/script\\u003e' in body + assert '\\u003cimg' in body +