{"record":{"id":"4403c51c845cb7d5","repo":"n8n-io/n8n","slug":"mcp-server-servername-not-configured-in-cla","errorCode":null,"errorMessage":"MCP server \"${serverName}\" not configured in ${claudeConfigPath} (${scope})","messagePattern":"MCP server \"(.+?)\" not configured in (.+?) \\((.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/instance-ai/evaluations/cli/mcp-builder.ts","lineNumber":117,"sourceCode":"export 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/**\n * Stage an MCP config for one build directly from a lane URL + API key, with no\n * dependency on `~/.claude.json`. Used by the fused `--build-via-mcp` path where\n * the eval CLI mints an MCP key per build user and points `claude` at that\n * lane's MCP server. Returns the temp config path; removed on process exit, or\n * earlier via unlinkStagedMcpConfig.\n */\nexport function stageLaneMcpConfig(opts: {\n\tserverName: string;\n\turl: string;\n\tapiKey: string;\n}): string {\n\tconst block = {","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/instance-ai/evaluations/cli/mcp-builder.ts#L99-L135","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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`."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const parsed = claudeConfigSchema.parse(readJson(p, 'cfg'));\nconst scopes = ['project-a', 'project-b'];\nconst found = scopes.map(s => parsed.projects?.[s]?.mcpServers?.[name]).find(Boolean)\n  ?? parsed.mcpServers?.[name];\nif (!found) throw new Error(`configure server ${name} in claude code first`);","typeGuard":"const hasMcpBlock = (v: unknown): v is Record<string, unknown> =>\n  typeof v === 'object' && v !== null && !Array.isArray(v);","tryCatchPattern":null,"preventionTips":["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."],"tags":["config","mcp","lookup"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}