n8n-io/n8n · error · Error

${claudeConfigPath} not found

Error message

${claudeConfigPath} not found

What it means

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.

Source

Thrown at packages/@n8n/instance-ai/evaluations/cli/mcp-builder.ts:105

		`${filePrefix}-${String(process.pid)}-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}.json`,
	);
	writeFileSync(tmpPath, JSON.stringify({ mcpServers: { [serverName]: block } }), { mode: 0o600 });
	stagedConfigPaths.add(tmpPath);
	return tmpPath;
}

/**
 * Stage an MCP config by extracting the named server block from the user's
 * `~/.claude.json` (project-scoped first, then global). Used by the standalone
 * builder, where the MCP server is configured out-of-band by the operator.
 */
export function stageMcpConfigFromClaudeJson(
	serverName: string,
	projectScopes: readonly string[],
): string {
	const claudeConfigPath = join(homedir(), '.claude.json');
	if (!existsSync(claudeConfigPath)) {
		throw new Error(`${claudeConfigPath} not found`);
	}
	const parsed = claudeConfigSchema.parse(readJson(claudeConfigPath, 'Claude Code config'));

	const projectScopedBlock = projectScopes
		.map((scope) => parsed.projects?.[scope]?.mcpServers?.[serverName])
		.find((block) => block !== undefined);
	const block = projectScopedBlock ?? parsed.mcpServers?.[serverName];
	if (block === undefined) {
		const scope = projectScopes.length
			? `project-scope under ${projectScopes.map((s) => `"${s}"`).join(', ')} or global`
			: 'global (no project scopes)';
		throw new Error(`MCP server "${serverName}" not configured in ${claudeConfigPath} (${scope})`);
	}

	return writeMcpConfig(serverName, block, 'n8n-mcp-config');
}

/**

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Install and run claude code once so it creates ~/.claude.json, then configure the MCP server in it.
  2. If you already have the config elsewhere, copy/symlink it to ~/.claude.json.
  3. 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.
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
const p = join(homedir(), '.claude.json');
if (!existsSync(p)) throw new Error(`Missing ${p}; run claude code once or use --build-via-mcp`);

Prevention

When it happens

Trigger: 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.

Common situations: CI runners without claude code installed; fresh developer machines; containers where HOME is set to a non-standard path.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/26abd031d06f2542. Report an issue: GitHub.