Mintplex-Labs/anything-llm · error

MCP server command or url is required

Error message

MCP server command or url is required

What it means

#parseServerType classifies a server definition as stdio if it has a "command" own-property and http if it has a "url" own-property; it returns null when neither key exists. #startMCPServer turns that null into this error — the definition is structurally unusable for any transport.

Solutions

  1. Add either "command" (stdio, local process) or "url" (http/remote) to the entry
  2. Check for exact key spelling — the parser only recognizes "command" and "url"
  3. For stdio servers make sure "command" is not nested inside another object
  4. Re-boot MCP servers after fixing the JSON

Example fix

// before
{ "my-server": { "cmd": "npx", "args": ["-y", "server-memory"] } }

// after
{ "my-server": { "command": "npx", "args": ["-y", "server-memory"] } }
Defensive patterns

Strategy: validation

Validate before calling

function hasTransportKey(server) {
  return Object.prototype.hasOwnProperty.call(server, 'command') ||
         Object.prototype.hasOwnProperty.call(server, 'url');
}
if (!hasTransportKey(entry)) throw new Error('MCP server needs a "command" (stdio) or "url" (http) key');

Type guard

function isStartableServer(server) {
  return typeof server?.command === 'string' || typeof server?.url === 'string';
}

Try / catch

try {
  await hypervisor.bootMCPServers();
} catch (err) {
  if (err.message === 'MCP server command or url is required') {
    // show which entry lacks command/url and link to the config docs
  }
  throw err;
}

Prevention

When it happens

Trigger: An MCP servers entry that has only auxiliary keys (args, env) with no command or url; or the key is typo'd — "cmd", "bin", "endpoint", "base_url" instead of the exact "command"/"url" names.

Common situations: Copy-pasting a config from another client that uses different key names; deleting the command line while debugging; entries reduced to just an env block.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/2ed97fa749a42e0d. Report an issue: GitHub.

Appendix: source

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

        return new SSEClientTransport(url, {
          requestInit: {
            headers: server.headers,
          },
        });
    }
  }

  /**
   * @private Start a single MCP server by its server definition from the JSON file
   * @param {string} name - The name of the MCP server to start
   * @param {Object} server - The server definition
   * @returns {Promise<boolean>}
   */
  async #startMCPServer({ name, server }) {
    if (!name) throw new Error("MCP server name is required");
    if (!server) throw new Error("MCP server definition is required");
    const serverType = this.#parseServerType(server);
    if (!serverType) throw new Error("MCP server command or url is required");

    this.#validateServerDefinitionByType(name, server, serverType);
    this.log(`Attempting to start MCP server: ${name}`);
    const mcp = new Client({ name: name, version: "1.0.0" });
    const transport = await this.#setupServerTransport(server, serverType);

    // Add connection event listeners
    transport.onclose = () => this.log(`${name} - Transport closed`);
    transport.onerror = (error) =>
      this.log(`${name} - Transport error:`, error);
    transport.onmessage = (message) =>
      this.log(`${name} - Transport message:`, message);

    // Connect and await the connection with a timeout
    this.mcps[name] = mcp;
    const connectionPromise = mcp.connect(transport);

    let timeoutId;

View on GitHub (pinned to 3aec848f28)