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
- Run `claude mcp list` (or inspect ~/.claude.json) to confirm the exact serverName spelling and which scope it lives under.
- Pass the correct project scope(s) in the projectScopes argument so the lookup matches.
- 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
- Confirm serverName spelling against `claude mcp list` before passing it.
- Pass all plausible project scopes when calling stageMcpConfigFromClaudeJson.
- Automate MCP server registration via `claude mcp add` so the block always exists.
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
- MCP server "${cfg.name}": exactly one of "url" or "command"
- MCP server "${cfg.name}": provide either "url" or "command",
- MCP server name "${cfg.name}" is already registered
- Failed to parse ${label} at ${path}: ${msg}
- ${claudeConfigPath} not found
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4403c51c845cb7d5.
Report an issue: GitHub.