{"record":{"id":"8fb31d9f860dd46e","repo":"Mintplex-Labs/anything-llm","slug":"mcp-server-name-invalid-url-server-url","errorCode":null,"errorMessage":"MCP server \"${name}\": invalid URL \"${server.url}\"","messagePattern":"MCP server \"(.+?)\": invalid URL \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/MCP/hypervisor/index.js","lineNumber":384,"sourceCode":"      // \"type\" is optional for http servers - when omitted, SSE is assumed\n      // (see createHttpTransport). An explicit unknown value is a config error.\n      if (\n        server.type !== undefined &&\n        ![\"sse\", \"streamable\", \"http\"].includes(server.type)\n      ) {\n        throw new Error(\"MCP server type must have sse or streamable value.\");\n      }\n\n      if (!server.url) {\n        throw new Error(\n          `MCP server \"${name}\": missing required \"url\" for ${server.type || \"sse\"} transport`\n        );\n      }\n\n      try {\n        new URL(server.url);\n      } catch {\n        throw new Error(`MCP server \"${name}\": invalid URL \"${server.url}\"`);\n      }\n      return;\n    }\n\n    if (type === \"stdio\") {\n      if (\n        Object.prototype.hasOwnProperty.call(server, \"args\") &&\n        !Array.isArray(server.args)\n      )\n        throw new Error(\"MCP server args must be an array\");\n    }\n    return;\n  }\n\n  /**\n   * Setup the server transport by type and server definition\n   * @param {Object} server - The server definition\n   * @param {MCPServerTypes} type - The server type","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/MCP/hypervisor/index.js#L366-L402","documentation":"After confirming an http MCP server has a url, the hypervisor runs it through the URL constructor (new URL(server.url)). If parsing throws, this templated error names the offending server and url. It catches syntactically invalid URLs, not unreachable ones — connectivity is checked later at connect time.","triggerScenarios":"url values like \"localhost:3000/mcp\" (no scheme), \"https//example.com/mcp\" (missing colon), URLs with spaces or unencoded characters, or a bare hostname such as \"example.com\".","commonSituations":"Copy-pasting an endpoint without the https:// prefix; missing the colon in the scheme; passing a server name or host instead of a full URL; unencoded query characters in the path.","solutions":["Use a full absolute URL with scheme, e.g. \"https://example.com/mcp\" or \"http://localhost:3000/mcp\"","URL-encode any spaces or special characters in the path","Paste the URL into a browser or curl to confirm it is syntactically well-formed","Re-boot MCP servers after fixing the JSON"],"exampleFix":"// before\n{ \"my-server\": { \"type\": \"streamable\", \"url\": \"example.com/mcp\" } }\n\n// after\n{ \"my-server\": { \"type\": \"streamable\", \"url\": \"https://example.com/mcp\" } }","handlingStrategy":"validation","validationCode":"function assertValidUrl(name, url) {\n  try { new URL(url); }\n  catch { throw new Error(`Server \"${name}\": \"${url}\" is not a valid URL — include the scheme (https://)`); }\n}","typeGuard":"function isParsableUrl(value) {\n  try { new URL(value); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  await hypervisor.bootMCPServers();\n} catch (err) {\n  if (err.message.includes('invalid URL')) {\n    // extract the URL from the message and highlight the field\n  }\n  throw err;\n}","preventionTips":["Test URLs with new URL() in the form/UI at entry time","Auto-prepend https:// when the user omits a scheme","Reject URLs containing spaces or unencoded characters before saving"],"tags":["mcp","config-validation","url-parsing","http-transport"],"backgroundTag":"invalid-url-format","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}