{"record":{"id":"93cf98c8826bd0a4","repo":"openai/codex","slug":"mcp-server-url-server-url-must-include-a-host","errorCode":null,"errorMessage":"MCP server URL `{server_url}` must include a host","messagePattern":"MCP server URL `(.+?)` must include a host","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/rmcp-client/src/perform_oauth_login.rs","lineNumber":458,"sourceCode":"}\n\nfn resolve_redirect_uri(server: &Server, callback_url: Option<&str>) -> Result<String> {\n    let Some(callback_url) = callback_url else {\n        return local_redirect_uri(server);\n    };\n    Url::parse(callback_url)\n        .with_context(|| format!(\"invalid MCP OAuth callback URL `{callback_url}`\"))?;\n    Ok(callback_url.to_string())\n}\n\nfn callback_id_from_server_url(server_url: &str) -> Result<String> {\n    // Native Codex callback IDs intentionally hash the complete MCP URL (minus its fragment)\n    // with SHA-256. Python connector callback IDs use SHAKE-256 over the origin and are distinct.\n    let mut parsed =\n        Url::parse(server_url).with_context(|| format!(\"invalid MCP server URL `{server_url}`\"))?;\n    parsed\n        .host_str()\n        .ok_or_else(|| anyhow!(\"MCP server URL `{server_url}` must include a host\"))?;\n    parsed.set_fragment(None);\n\n    let digest = Sha256::digest(parsed.as_str().as_bytes());\n    Ok(URL_SAFE_NO_PAD.encode(&digest[..9]))\n}\n\nfn append_callback_id_to_redirect_uri(redirect_uri: &str, callback_id: &str) -> Result<String> {\n    let mut parsed = Url::parse(redirect_uri)\n        .with_context(|| format!(\"invalid redirect URI `{redirect_uri}`\"))?;\n    let path = parsed.path();\n    let new_path = if path.ends_with('/') {\n        format!(\"{path}{callback_id}\")\n    } else {\n        format!(\"{path}/{callback_id}\")\n    };\n    parsed.set_path(&new_path);\n    Ok(parsed.to_string())\n}","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/rmcp-client/src/perform_oauth_login.rs#L440-L476","documentation":"Error \"MCP server URL `{server_url}` must include a host\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/rmcp-client/src/perform_oauth_login.rs:458 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}