{"record":{"id":"ce5976be37218870","repo":"sipeed/picoclaw","slug":"mcp-server-server-name-requires-a-valid-http-s","errorCode":null,"errorMessage":"MCP server ${server.name} requires a valid HTTP(S) URL.","messagePattern":"MCP server (.+?) requires a valid HTTP\\(S\\) URL\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"web/frontend/src/components/config/config-page.tsx","lineNumber":482,"sourceCode":"            const baselineServer = baselineServersByName.get(server.name)\n            const shouldValidateServer = server.enabled\n\n            if (server.type !== \"stdio\") {\n              if (shouldValidateServer && server.url === \"\") {\n                throw new Error(`MCP server ${server.name} requires a URL.`)\n              }\n\n              if (shouldValidateServer) {\n                try {\n                  const parsedURL = new URL(server.url)\n                  if (\n                    parsedURL.protocol !== \"http:\" &&\n                    parsedURL.protocol !== \"https:\"\n                  ) {\n                    throw new Error(\"invalid protocol\")\n                  }\n                } catch {\n                  throw new Error(\n                    `MCP server ${server.name} requires a valid HTTP(S) URL.`,\n                  )\n                }\n              }\n\n              const baselineHeaders = baselineServer\n                ? parseJSONObjectField(\n                    baselineServer.headersText,\n                    `Saved MCP server ${server.name} headers`,\n                  )\n                : {}\n\n              return [\n                server.name,\n                {\n                  ...deferredPatch,\n                  enabled: server.enabled,\n                  type: server.type,","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/frontend/src/components/config/config-page.tsx#L464-L500","documentation":"Validation error thrown in handleSave (web/frontend/src/components/config/config-page.tsx:482) when an enabled remote MCP server's URL either fails to parse via new URL() or parses with a protocol other than http: or https: (the internal 'invalid protocol' throw is swallowed and re-raised as this message). Only enabled remote servers are validated.","triggerScenarios":"Entering ws://server/sse or wss:// (WebSocket schemes), file:///path, a bare hostname like mcp.example.com without a scheme (unparseable by new URL), or a URL with a typo like http//example.com.","commonSituations":"Provider docs advertise a ws:// transport URL; user pastes just the host without https://; user pastes a URL with spaces or non-ASCII characters; confusion between MCP stdio servers and SSE endpoints.","solutions":["Use a full http:// or https:// URL including scheme and host, e.g. https://mcp.example.com/sse","Convert ws://host to http://host and wss://host to https://host — the MCP HTTP transport upgrades internally","Double-check for typos in the scheme (http//, http:/) and stray whitespace after trimming"],"exampleFix":"// before\nws://mcp.example.com/sse\n\n// after\nhttps://mcp.example.com/sse","handlingStrategy":"validation","validationCode":"function isHTTPUrl(value: string): boolean {\n  try {\n    const u = new URL(value.trim())\n    return u.protocol === \"http:\" || u.protocol === \"https:\"\n  } catch {\n    return false\n  }\n}\n\nif (form.mcpServers.some((s) => s.type !== \"stdio\" && s.enabled && !isHTTPUrl(s.url))) {\n  setFieldError(\"Remote MCP servers require a valid http(s) URL.\")\n  return\n}","typeGuard":"function parseHTTPUrl(value: string): URL | null {\n  try {\n    const u = new URL(value.trim())\n    return u.protocol === \"http:\" || u.protocol === \"https:\" ? u : null\n  } catch {\n    return null\n  }\n}","tryCatchPattern":"try {\n  await handleSave()\n} catch (err) {\n  if (err instanceof Error) setError(err.message)\n}","preventionTips":["Validate the URL field on blur and show a scheme hint (https://)","Auto-prepend https:// when the user types a bare host","Translate ws://→http:// and wss://→https:// at input time if providers document WebSocket endpoints"],"tags":["validation","frontend","mcp","url","protocol","config"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}