{"record":{"id":"2ed97fa749a42e0d","repo":"Mintplex-Labs/anything-llm","slug":"mcp-server-command-or-url-is-required","errorCode":null,"errorMessage":"MCP server command or url is required","messagePattern":"MCP server command or url is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/utils/MCP/hypervisor/index.js","lineNumber":452,"sourceCode":"        return new SSEClientTransport(url, {\n          requestInit: {\n            headers: server.headers,\n          },\n        });\n    }\n  }\n\n  /**\n   * @private Start a single MCP server by its server definition from the JSON file\n   * @param {string} name - The name of the MCP server to start\n   * @param {Object} server - The server definition\n   * @returns {Promise<boolean>}\n   */\n  async #startMCPServer({ name, server }) {\n    if (!name) throw new Error(\"MCP server name is required\");\n    if (!server) throw new Error(\"MCP server definition is required\");\n    const serverType = this.#parseServerType(server);\n    if (!serverType) throw new Error(\"MCP server command or url is required\");\n\n    this.#validateServerDefinitionByType(name, server, serverType);\n    this.log(`Attempting to start MCP server: ${name}`);\n    const mcp = new Client({ name: name, version: \"1.0.0\" });\n    const transport = await this.#setupServerTransport(server, serverType);\n\n    // Add connection event listeners\n    transport.onclose = () => this.log(`${name} - Transport closed`);\n    transport.onerror = (error) =>\n      this.log(`${name} - Transport error:`, error);\n    transport.onmessage = (message) =>\n      this.log(`${name} - Transport message:`, message);\n\n    // Connect and await the connection with a timeout\n    this.mcps[name] = mcp;\n    const connectionPromise = mcp.connect(transport);\n\n    let timeoutId;","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/MCP/hypervisor/index.js#L434-L470","documentation":"#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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add either \"command\" (stdio, local process) or \"url\" (http/remote) to the entry","Check for exact key spelling — the parser only recognizes \"command\" and \"url\"","For stdio servers make sure \"command\" is not nested inside another object","Re-boot MCP servers after fixing the JSON"],"exampleFix":"// before\n{ \"my-server\": { \"cmd\": \"npx\", \"args\": [\"-y\", \"server-memory\"] } }\n\n// after\n{ \"my-server\": { \"command\": \"npx\", \"args\": [\"-y\", \"server-memory\"] } }","handlingStrategy":"validation","validationCode":"function hasTransportKey(server) {\n  return Object.prototype.hasOwnProperty.call(server, 'command') ||\n         Object.prototype.hasOwnProperty.call(server, 'url');\n}\nif (!hasTransportKey(entry)) throw new Error('MCP server needs a \"command\" (stdio) or \"url\" (http) key');","typeGuard":"function isStartableServer(server) {\n  return typeof server?.command === 'string' || typeof server?.url === 'string';\n}","tryCatchPattern":"try {\n  await hypervisor.bootMCPServers();\n} catch (err) {\n  if (err.message === 'MCP server command or url is required') {\n    // show which entry lacks command/url and link to the config docs\n  }\n  throw err;\n}","preventionTips":["Require exactly one of command/url in the entry form","Only the literal keys 'command' and 'url' are recognized — avoid aliases like cmd/endpoint","Schema-validate the JSON so key typos fail loudly at save time, not boot time"],"tags":["mcp","config-validation","missing-field","transport"],"backgroundTag":"missing-config-field","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"}