Mintplex-Labs/anything-llm · error · Error

MCP server "${name}": missing required "url" for ${server.ty

Error message

MCP server "${name}": missing required "url" for ${server.type || "sse"} transport

What it means

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.

Source

Thrown at server/utils/MCP/hypervisor/index.js:376

   * - Will throw an error if the server definition is invalid
   * @param {string} name - The name of the MCP server
   * @param {Object} server - The server definition
   * @param {MCPServerTypes} type - The server type
   * @returns {void}
   */
  #validateServerDefinitionByType(name, server, type) {
    if (type === "http") {
      // "type" is optional for http servers - when omitted, SSE is assumed
      // (see createHttpTransport). An explicit unknown value is a config error.
      if (
        server.type !== undefined &&
        !["sse", "streamable", "http"].includes(server.type)
      ) {
        throw new Error("MCP server type must have sse or streamable value.");
      }

      if (!server.url) {
        throw new Error(
          `MCP server "${name}": missing required "url" for ${server.type || "sse"} transport`
        );
      }

      try {
        new URL(server.url);
      } catch {
        throw new Error(`MCP server "${name}": invalid URL "${server.url}"`);
      }
      return;
    }

    if (type === "stdio") {
      if (
        Object.prototype.hasOwnProperty.call(server, "args") &&
        !Array.isArray(server.args)
      )
        throw new Error("MCP server args must be an array");

View on GitHub (pinned to 526360e320)

Solutions

  1. Add the "url" field to the http server entry with the full MCP endpoint URL.
  2. If you intended a local process server, use "command" (and "args") instead of url — that routes to stdio validation.
  3. Check for key typos — the key must be exactly "url".
  4. Re-run after fixing; the message names which server entry failed.

Example fix

// before
{
  "myServer": {
    "type": "streamable",
    "headers": { "Authorization": "Bearer x" }
  }
}

// after
{
  "myServer": {
    "type": "streamable",
    "url": "https://mcp.example.com/mcp",
    "headers": { "Authorization": "Bearer x" }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

function validateHttpServerUrl(name, server) {
  if (!server.url || typeof server.url !== 'string') {
    throw new Error(`MCP server '${name}' is http-typed but missing a string 'url'.`);
  }
}

Type guard

/** @param {{command?:unknown, url?:unknown}} s */
function isStdioServer(s) { return typeof s.command === 'string'; }
function isHttpServer(s) { return !isStdioServer(s) && typeof s.url === 'string' && s.url.length > 0; }

Try / catch

try {
  // start MCP server
} catch (e) {
  if (/missing required "url"/.test(e.message)) {
    throw new Error('Add a url to the http MCP server, or switch to a command-based stdio server.');
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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'.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/5c2f3ae2c222fe57. Report an issue: GitHub.