{"record":{"id":"4a88b85151a693e2","repo":"FlowiseAI/Flowise","slug":"mcp-server-config-is-required","errorCode":null,"errorMessage":"MCP Server Config is required","messagePattern":"MCP Server Config is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/tools/MCP/CustomMCP/CustomMCP.ts","lineNumber":135,"sourceCode":"        const tools = await this.getTools(nodeData, options)\n\n        const _mcpActions = nodeData.inputs?.mcpActions\n        let mcpActions = []\n        if (_mcpActions) {\n            try {\n                mcpActions = typeof _mcpActions === 'string' ? JSON.parse(_mcpActions) : _mcpActions\n            } catch (error) {\n                console.error('Error parsing mcp actions:', error)\n            }\n        }\n\n        return tools.filter((tool: any) => mcpActions.includes(tool.name))\n    }\n\n    async getTools(nodeData: INodeData, options: ICommonObject): Promise<Tool[]> {\n        const mcpServerConfig = nodeData.inputs?.mcpServerConfig as string\n        if (!mcpServerConfig) {\n            throw new Error('MCP Server Config is required')\n        }\n\n        let sandbox: ICommonObject = {}\n        const workspaceId = options?.searchOptions?.workspaceId?._value || options?.workspaceId\n\n        if (mcpServerConfig.includes('$vars')) {\n            const appDataSource = options.appDataSource as DataSource\n            const databaseEntities = options.databaseEntities as IDatabaseEntity\n            // If options.workspaceId is not set, create a new options object with the workspaceId for getVars.\n            const optionsWithWorkspaceId = options.workspaceId ? options : { ...options, workspaceId }\n            const variables = await getVars(appDataSource, databaseEntities, nodeData, optionsWithWorkspaceId)\n            sandbox['$vars'] = prepareSandboxVars(variables)\n        }\n\n        let canonicalConfig\n        try {\n            canonicalConfig = JSON.parse(mcpServerConfig)\n        } catch (e) {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/tools/MCP/CustomMCP/CustomMCP.ts#L117-L153","documentation":"Thrown by CustomMCP.getTools when nodeData.inputs.mcpServerConfig is falsy. The Custom MCP node takes an inline JSON server config (command/args/env for stdio, or url/headers for SSE) typed as a string in the node input. Without it there is nothing to substitute variables into or pass to MCPToolkit, so getTools aborts immediately.","triggerScenarios":"The MCP Server Config input textarea is empty; the config is wired from a $var that doesn't resolve; the node was imported from a template that left the field blank. The check runs before variable substitution, so even a config consisting only of {{$vars.x}} is non-empty and passes.","commonSituations":"Saving a flow before pasting the server config; a flow template that expects the user to fill the config; variable reference typo ($var instead of $vars) that leaves the literal text but no real config behind it.","solutions":["Paste a valid MCP server config JSON into the MCP Server Config input (e.g. {\"url\":\"https://...\",\"headers\":{...}} or {\"command\":\"npx\",\"args\":[...]}).","If using variables, ensure the referenced $vars entry exists in the workspace.","Validate the config JSON.parse-es before running the flow.","Confirm the input isn't bound to an empty upstream node output."],"exampleFix":"// before\nnodeData.inputs = { mcpServerConfig: '' }\n// after\nnodeData.inputs = { mcpServerConfig: JSON.stringify({ command:'npx', args:['-y','@modelcontextprotocol/server-filesystem','./'] }) }","handlingStrategy":"validation","validationCode":"function parseMcpConfig(raw: string): object {\n  if (!raw || !raw.trim()) throw new Error('mcpServerConfig input is empty')\n  try { return JSON.parse(raw) } catch (e) { throw new Error(`mcpServerConfig is not valid JSON: ${(e as Error).message}`) }\n}","typeGuard":"function isMcpServerConfigShape(v: unknown): v is { url?: string; headers?: Record<string,string>; command?: string; args?: string[]; env?: Record<string,string> } {\n  return !!v && typeof v === 'object' && (('url' in v) || ('command' in v))\n}","tryCatchPattern":null,"preventionTips":["Paste a JSON config (object form) into the MCP Server Config input.","JSON.parse-validate the config before saving the flow.","Ensure referenced $vars exist so the field isn't left effectively empty.","Distinguish CustomMCP (inline config) from CustomMcpServerTool (DB record id)."],"tags":["mcp","custom-mcp","config","validation","required-field"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}