From fbe4d08ad09a7635d79b483c1eb81dc5140434b0 Mon Sep 17 00:00:00 2001 From: Nilay <118994073+NilayYadav@users.noreply.github.com> Date: Mon, 15 Jun 2026 23:56:41 +0530 Subject: [PATCH] fix validation error for stdio mcp (#6341) --- studio/backend/routes/mcp_servers.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/studio/backend/routes/mcp_servers.py b/studio/backend/routes/mcp_servers.py index 37d99a222e..80cd8e1437 100644 --- a/studio/backend/routes/mcp_servers.py +++ b/studio/backend/routes/mcp_servers.py @@ -77,13 +77,17 @@ def _validate_url(url: str) -> str: return trimmed parsed = urlparse(trimmed) if parsed.scheme not in ("http", "https"): - detail = ( - "MCP server address must start with http:// or https:// " - "(for example https://example.com/mcp)." - ) - # Host-scoped wording: self-hosted hosts can opt in via the env var. if _looks_like_command(trimmed): - detail += " Running a local command is not enabled on this server." + detail = ( + "Local commands aren't enabled on this server. To allow them, " + "set UNSLOTH_STUDIO_ALLOW_STDIO_MCP=1 and restart Studio, or use " + "an http:// or https:// URL instead." + ) + else: + detail = ( + "MCP server address must start with http:// or https:// " + "(for example https://example.com/mcp)." + ) raise HTTPException(status_code = 400, detail = detail) if not parsed.netloc: raise HTTPException(status_code = 400, detail = "url is missing a host")