{"record":{"id":"730ccd573c2a9823","repo":"Hmbown/CodeWhale","slug":"mcp-server-name-not-found-730ccd","errorCode":null,"errorMessage":"MCP server '{name}' not found","messagePattern":"MCP server '(.+?)' not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/ui/handlers.rs","lineNumber":485,"sourceCode":"            mcp::set_server_enabled(&path, &name, false)\n                .map(|()| message = Some(format!(\"Disabled MCP server '{name}'\")))\n        }\n        crate::tui::app::McpUiAction::Remove { name } => {\n            changed = true;\n            mcp::remove_server_config(&path, &name)\n                .map(|()| message = Some(format!(\"Removed MCP server '{name}'\")))\n        }\n        crate::tui::app::McpUiAction::Login { name, scopes } => {\n            let result = async {\n                let cfg = mcp::load_config_with_workspace_and_plugins(\n                    &path,\n                    &app.workspace,\n                    app.plugin_registry.as_ref(),\n                )?;\n                let server = cfg\n                    .servers\n                    .get(&name)\n                    .ok_or_else(|| anyhow::anyhow!(\"MCP server '{name}' not found\"))?;\n                let explicit_scopes = (!scopes.is_empty()).then_some(scopes);\n                mcp::oauth::perform_oauth_login_for_server(\n                    &name,\n                    server,\n                    explicit_scopes,\n                    config.mcp_oauth_callback_port,\n                    config.mcp_oauth_callback_url.as_deref(),\n                )\n                .await\n            }\n            .await;\n            result.map(|()| {\n                changed = true;\n                message = Some(format!(\n                    \"Stored OAuth credentials for MCP server '{name}'. Run /mcp reload to reconnect it.\"\n                ));\n            })\n        }","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tui/ui/handlers.rs#L467-L503","documentation":"The MCP OAuth login flow reloads the MCP config (workspace + plugins) and requires the named server in cfg.servers; a miss bails 'MCP server \\u2018{name}\\u2019 not found'. The TUI shows the error instead of opening the browser OAuth flow. Note the config is loaded fresh here, so it can disagree with an older in-app server list.","triggerScenarios":"McpUiAction::Login for a name that is absent from the freshly loaded config: typo or case mismatch, server removed from the config file after the UI listed it, the plugin that supplied it disabled, or workspace config not present.","commonSituations":"Editing MCP config while the TUI is open; disabling a plugin that owned the server; stale in-app server list; wrong workspace selected.","solutions":["Re-read the MCP config and use the exact server key (map keys are case-sensitive)","Run /mcp reload or restart the TUI so the list matches the config","Check that the plugin providing the server is installed and enabled"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Rust - confirm the server exists in the freshly loaded config before login\nlet cfg = mcp::load_config_with_workspace_and_plugins(&path, &app.workspace, app.plugin_registry.as_ref())?;\nif !cfg.servers.contains_key(&name) {\n    return Err(anyhow::anyhow!(\"MCP server '{name}' not found\"));\n}\n// proceed with perform_oauth_login_for_server(...)","typeGuard":null,"tryCatchPattern":"match cfg.servers.get(&name) {\n    Some(server) => mcp::oauth::perform_oauth_login_for_server(&name, server, scopes, port, url).await,\n    None => show_hint(\"run /mcp reload; server names are case-sensitive config keys\"),\n}","preventionTips":["Run /mcp reload after editing MCP config files","Copy server names verbatim from the config, not from memory or old docs","Verify plugin-provided servers are still enabled before OAuth actions"],"tags":["mcp","oauth","login","config","not-found"],"backgroundTag":"mcp-server-not-found","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}