{"record":{"id":"16835fdeaf88996f","repo":"FlowiseAI/Flowise","slug":"command-serverparams-command-is-not-allowed","errorCode":null,"errorMessage":"Command '${serverParams.command}' is not allowed. Permitted: ${allowedCommands.join(', ') || '(none)'}","messagePattern":"Command '(.+?)' is not allowed\\. Permitted: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MCP/core.ts","lineNumber":435,"sourceCode":" */\nexport const validateMCPServerConfig = (serverParams: any): void => {\n    // Validate the entire server configuration\n    if (!serverParams || typeof serverParams !== 'object') {\n        throw new Error('Invalid server configuration')\n    }\n\n    if (serverParams.cwd != null) {\n        throw new Error('cwd parameter is not allowed in MCP server configuration')\n    }\n\n    // Command allowlist - operator-controlled via CUSTOM_MCP_ALLOWED_COMMANDS (empty = none allowed)\n    const allowedCommands = (process.env.CUSTOM_MCP_ALLOWED_COMMANDS ?? '')\n        .split(',')\n        .map((s) => s.trim())\n        .filter(Boolean)\n\n    if (serverParams.command && !allowedCommands.includes(serverParams.command)) {\n        throw new Error(`Command '${serverParams.command}' is not allowed. Permitted: ${allowedCommands.join(', ') || '(none)'}`)\n    }\n\n    // Validate arguments if present\n    if (serverParams.args && Array.isArray(serverParams.args)) {\n        validateArgsForLocalFileAccess(serverParams.args)\n        validateCommandInjection(serverParams.args)\n\n        // Validate command-specific dangerous flags\n        if (serverParams.command) {\n            validateCommandFlags(serverParams.command, serverParams.args)\n        }\n    }\n\n    // Validate environment variables\n    if (serverParams.env) {\n        validateEnvironmentVariables(serverParams.env)\n    }\n}","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MCP/core.ts#L417-L453","documentation":"Thrown by validateMCPServerConfig when serverParams.command is truthy but not present in CUSTOM_MCP_ALLOWED_COMMANDS. The allow-list is comma-split from that env var; default empty means no command is permitted. The message names the rejected command and lists the currently permitted set (or '(none)').","triggerScenarios":"validateMCPServerConfig receives a serverParams with command set (e.g. 'node', 'npx', 'python', 'docker') and CUSTOM_MCP_ALLOWED_COMMANDS does not contain it. Reachable from Supergateway (hardcoded 'node') and any custom stdio MCP node.","commonSituations":"Default deploy with no allow-list configured; operator allow-listed 'nodejs' instead of 'node'; command pulled from user input that the operator did not anticipate.","solutions":["Add the exact command string to CUSTOM_MCP_ALLOWED_COMMANDS (e.g. CUSTOM_MCP_ALLOWED_COMMANDS=node,npx).","Restart the worker so the env var is re-read.","If the command is user-controlled, restrict the input to the allow-list at the UI layer."],"exampleFix":"# before\n# CUSTOM_MCP_ALLOWED_COMMANDS=\n\n# after\nCUSTOM_MCP_ALLOWED_COMMANDS=node","handlingStrategy":"validation","validationCode":"const allowed = (process.env.CUSTOM_MCP_ALLOWED_COMMANDS ?? '').split(',').map(s => s.trim()).filter(Boolean)\nif (serverParams.command && !allowed.includes(serverParams.command)) {\n  throw new Error(`Add '${serverParams.command}' to CUSTOM_MCP_ALLOWED_COMMANDS or pick an allowed command: ${allowed.join(', ') || '(none)'}`)\n}","typeGuard":"const commandAllowed = (command: string): boolean => {\n  const allowed = (process.env.CUSTOM_MCP_ALLOWED_COMMANDS ?? '').split(',').map(s => s.trim()).filter(Boolean)\n  return allowed.includes(command)\n}","tryCatchPattern":"try {\n  validateMCPServerConfig(serverParams)\n} catch (e) {\n  if (e.message.startsWith('Command ') && e.message.includes('is not allowed')) {\n    // add the command to CUSTOM_MCP_ALLOWED_COMMANDS, restart worker\n  }\n  throw e\n}","preventionTips":["Configure CUSTOM_MCP_ALLOWED_COMMANDS at deploy time with every command the deployment uses.","Restart the worker after editing env so the new allow-list takes effect.","Restrict user-chosen command inputs to the allow-list in the UI."],"tags":["mcp","security","configuration","allow-list"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}