{"record":{"id":"26abd031d06f2542","repo":"n8n-io/n8n","slug":"claudeconfigpath-not-found","errorCode":null,"errorMessage":"${claudeConfigPath} not found","messagePattern":"(.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/mcp-builder.ts","lineNumber":105,"sourceCode":"\t\t`${filePrefix}-${String(process.pid)}-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}.json`,\n\t);\n\twriteFileSync(tmpPath, JSON.stringify({ mcpServers: { [serverName]: block } }), { mode: 0o600 });\n\tstagedConfigPaths.add(tmpPath);\n\treturn tmpPath;\n}\n\n/**\n * Stage an MCP config by extracting the named server block from the user's\n * `~/.claude.json` (project-scoped first, then global). Used by the standalone\n * builder, where the MCP server is configured out-of-band by the operator.\n */\nexport function stageMcpConfigFromClaudeJson(\n\tserverName: string,\n\tprojectScopes: readonly string[],\n): string {\n\tconst claudeConfigPath = join(homedir(), '.claude.json');\n\tif (!existsSync(claudeConfigPath)) {\n\t\tthrow new Error(`${claudeConfigPath} not found`);\n\t}\n\tconst parsed = claudeConfigSchema.parse(readJson(claudeConfigPath, 'Claude Code config'));\n\n\tconst projectScopedBlock = projectScopes\n\t\t.map((scope) => parsed.projects?.[scope]?.mcpServers?.[serverName])\n\t\t.find((block) => block !== undefined);\n\tconst block = projectScopedBlock ?? parsed.mcpServers?.[serverName];\n\tif (block === undefined) {\n\t\tconst scope = projectScopes.length\n\t\t\t? `project-scope under ${projectScopes.map((s) => `\"${s}\"`).join(', ')} or global`\n\t\t\t: 'global (no project scopes)';\n\t\tthrow new Error(`MCP server \"${serverName}\" not configured in ${claudeConfigPath} (${scope})`);\n\t}\n\n\treturn writeMcpConfig(serverName, block, 'n8n-mcp-config');\n}\n\n/**","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/mcp-builder.ts#L87-L123","documentation":"stageMcpConfigFromClaudeJson reads ~/.claude.json to extract an MCP server block. If the file does not exist, it throws immediately — the function cannot proceed without that config because the operator is expected to have configured the server out-of-band in Claude Code.","triggerScenarios":"Running the standalone MCP builder on a machine that has never run `claude` (so ~/.claude.json was never created); running under a user whose HOME differs from where claude wrote its config.","commonSituations":"CI runners without claude code installed; fresh developer machines; containers where HOME is set to a non-standard path.","solutions":["Install and run claude code once so it creates ~/.claude.json, then configure the MCP server in it.","If you already have the config elsewhere, copy/symlink it to ~/.claude.json.","If you cannot use claude code config, switch to the fused `--build-via-mcp` path which mints a key from a lane URL and does not require ~/.claude.json."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { join } from 'node:path';\nconst p = join(homedir(), '.claude.json');\nif (!existsSync(p)) throw new Error(`Missing ${p}; run claude code once or use --build-via-mcp`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Document the prerequisite (claude code installed and run once) in the builder's README.","In CI, either install claude code and seed the config or use the --build-via-mcp path that bypasses it.","Detect the missing file early and print actionable guidance."],"tags":["config","mcp","filesystem","setup"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}