n8n-io/n8n · error · Error

MCP server "${serverName}" not configured in ${claudeConfigP

Error message

MCP server "${serverName}" not configured in ${claudeConfigPath} (${scope})

What it means

stageMcpConfigFromClaudeJson found ~/.claude.json but neither the project-scoped blocks (under projects[<scope>].mcpServers) nor the global mcpServers object contained the requested serverName. The message tells you which scopes were searched and that the lookup fell back to global.

Source

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

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');
}

/**
 * Stage an MCP config for one build directly from a lane URL + API key, with no
 * dependency on `~/.claude.json`. Used by the fused `--build-via-mcp` path where
 * the eval CLI mints an MCP key per build user and points `claude` at that
 * lane's MCP server. Returns the temp config path; removed on process exit, or
 * earlier via unlinkStagedMcpConfig.
 */
export function stageLaneMcpConfig(opts: {
	serverName: string;
	url: string;
	apiKey: string;
}): string {
	const block = {

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Run `claude mcp list` (or inspect ~/.claude.json) to confirm the exact serverName spelling and which scope it lives under.
  2. Pass the correct project scope(s) in the projectScopes argument so the lookup matches.
  3. Add the missing server to claude code under the expected project scope using `claude mcp add`.
Defensive patterns

Strategy: validation

Validate before calling

const parsed = claudeConfigSchema.parse(readJson(p, 'cfg'));
const scopes = ['project-a', 'project-b'];
const found = scopes.map(s => parsed.projects?.[s]?.mcpServers?.[name]).find(Boolean)
  ?? parsed.mcpServers?.[name];
if (!found) throw new Error(`configure server ${name} in claude code first`);

Type guard

const hasMcpBlock = (v: unknown): v is Record<string, unknown> =>
  typeof v === 'object' && v !== null && !Array.isArray(v);

Prevention

When it happens

Trigger: Passing a serverName that is misspelled or not yet added to claude code; the server is configured under a different project scope than the ones passed in projectScopes.

Common situations: Typo in serverName; running the builder from a different working directory whose project scope wasn't included; the MCP server was added in claude code but not saved.

Related errors


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