{"record":{"id":"5c2f3ae2c222fe57","repo":"Mintplex-Labs/anything-llm","slug":"mcp-server-name-missing-required-url-for","errorCode":null,"errorMessage":"MCP server \"${name}\": missing required \"url\" for ${server.type || \"sse\"} transport","messagePattern":"MCP server \"(.+?)\": missing required \"url\" for (.+?) transport","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/MCP/hypervisor/index.js","lineNumber":376,"sourceCode":"   * - Will throw an error if the server definition is invalid\n   * @param {string} name - The name of the MCP server\n   * @param {Object} server - The server definition\n   * @param {MCPServerTypes} type - The server type\n   * @returns {void}\n   */\n  #validateServerDefinitionByType(name, server, type) {\n    if (type === \"http\") {\n      // \"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\");","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/MCP/hypervisor/index.js#L358-L394","documentation":"Thrown by #validateServerDefinitionByType when a server is classified as http but has no url field. The url is mandatory for both SSE and streamable transports because createHttpTransport does `new URL(server.url)`. The message names the server and the transport (server.type, defaulting to 'sse') so the offending entry is identifiable.","triggerScenarios":"A server config entry detected as http (has headers or a type field but no command) yet missing the url key. Detection (determineServerType) keys off command→stdio and url→http, so an http-typed entry without a url is internally inconsistent.","commonSituations":"Defining an http/streamable MCP server with only headers/type but forgetting url; copy-paste error omitting the url line; mixing up stdio (command-based) and http (url-based) config shapes; YAML/JSON key typo like 'Url' or 'endpoint' instead of 'url'.","solutions":["Add the \"url\" field to the http server entry with the full MCP endpoint URL.","If you intended a local process server, use \"command\" (and \"args\") instead of url — that routes to stdio validation.","Check for key typos — the key must be exactly \"url\".","Re-run after fixing; the message names which server entry failed."],"exampleFix":"// before\n{\n  \"myServer\": {\n    \"type\": \"streamable\",\n    \"headers\": { \"Authorization\": \"Bearer x\" }\n  }\n}\n\n// after\n{\n  \"myServer\": {\n    \"type\": \"streamable\",\n    \"url\": \"https://mcp.example.com/mcp\",\n    \"headers\": { \"Authorization\": \"Bearer x\" }\n  }\n}","handlingStrategy":"validation","validationCode":"function validateHttpServerUrl(name, server) {\n  if (!server.url || typeof server.url !== 'string') {\n    throw new Error(`MCP server '${name}' is http-typed but missing a string 'url'.`);\n  }\n}","typeGuard":"/** @param {{command?:unknown, url?:unknown}} s */\nfunction isStdioServer(s) { return typeof s.command === 'string'; }\nfunction isHttpServer(s) { return !isStdioServer(s) && typeof s.url === 'string' && s.url.length > 0; }","tryCatchPattern":"try {\n  // start MCP server\n} catch (e) {\n  if (/missing required \"url\"/.test(e.message)) {\n    throw new Error('Add a url to the http MCP server, or switch to a command-based stdio server.');\n  }\n  throw e;\n}","preventionTips":["http/streamable/sse servers need a url; stdio servers need a command — never mix.","Use exactly the key 'url' (case-sensitive).","Validate config entries with a schema before starting the hypervisor.","The error message names the offending server — use it to locate the entry."],"tags":["mcp","configuration","validation","missing-field","transport"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}