{"record":{"id":"7ebe385a38fc3380","repo":"Mintplex-Labs/anything-llm","slug":"mcp-server-type-must-have-sse-or-streamable-value","errorCode":null,"errorMessage":"MCP server type must have sse or streamable value.","messagePattern":"MCP server type must have sse or streamable value\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/MCP/hypervisor/index.js","lineNumber":372,"sourceCode":"  }\n\n  /**\n   * Validate the server definition by type\n   * - 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 (","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/MCP/hypervisor/index.js#L354-L390","documentation":"The MCP hypervisor validates every entry in the MCP servers JSON before connecting. For http-type servers the optional \"type\" field must be one of \"sse\", \"streamable\", or \"http\" (the message names sse/streamable; http is also accepted). Any other explicit value for server.type throws during #validateServerDefinitionByType at boot.","triggerScenarios":"An entry in mcp_servers.json has \"type\": \"websocket\", \"SSE\" (wrong case), \"stdio\" on a url-based server, or any string outside the allowlist; #parseServerType then classified it as http via the type field and validation rejected the value.","commonSituations":"Hand-editing the MCP servers JSON and guessing a type value; copying a config snippet from docs of a different MCP client; case-sensitive value typos; leftover experimental type values.","solutions":["Set \"type\" to \"streamable\" (modern servers) or \"sse\" (legacy) in the server entry, or remove the \"type\" key entirely to default to SSE","Validate the JSON with the same allowlist (sse|streamable|http) before saving","Confirm the server actually speaks the chosen transport (StreamableHTTP vs SSE endpoint)","Restart the server / re-boot MCP servers after fixing the JSON"],"exampleFix":"// before (mcp_servers.json)\n{ \"my-server\": { \"type\": \"websocket\", \"url\": \"https://example.com/mcp\" } }\n\n// after\n{ \"my-server\": { \"type\": \"streamable\", \"url\": \"https://example.com/mcp\" } }","handlingStrategy":"validation","validationCode":"const VALID_HTTP_TYPES = ['sse', 'streamable', 'http'];\nfunction validateMcpEntry(name, server) {\n  if (server.type !== undefined && !VALID_HTTP_TYPES.includes(server.type))\n    throw new Error(`Server \"${name}\": type must be one of ${VALID_HTTP_TYPES.join('|')} or omitted.`);\n}","typeGuard":"function isValidHttpType(server) {\n  return server.type === undefined || ['sse', 'streamable', 'http'].includes(server.type);\n}","tryCatchPattern":"try {\n  await hypervisor.bootMCPServers();\n} catch (err) {\n  if (err.message.includes('must have sse or streamable')) {\n    // flag the offending entry in mcp_servers.json for the user\n  }\n  throw err;\n}","preventionTips":["Validate mcp_servers.json against a schema before saving it in the UI","Offer type as a dropdown (sse/streamable) instead of free text","Run the same allowlist check in CI for checked-in MCP configs"],"tags":["mcp","config-validation","http-transport","hypervisor"],"backgroundTag":"invalid-config-value","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"}