{"record":{"id":"07e5881cffa76b4d","repo":"openai/codex","slug":"executor-owned-mcp-server-server-name-cannot-u","errorCode":null,"errorMessage":"executor-owned MCP server `{server_name}` cannot use hosted ChatGPT authentication; configure executor-owned credentials instead","messagePattern":"executor-owned MCP server `(.+?)` cannot use hosted ChatGPT authentication; configure executor-owned credentials instead","errorType":"validation","errorClass":"StartupOutcomeError","httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/rmcp_client.rs","lineNumber":1081,"sourceCode":"\n#[allow(clippy::too_many_arguments)]\n#[instrument(level = \"trace\", skip_all, fields(server_name = %server_name))]\nasync fn make_rmcp_client(\n    server_name: &str,\n    server: EffectiveMcpServer,\n    store_mode: OAuthCredentialsStoreMode,\n    keyring_backend_kind: AuthKeyringBackendKind,\n    runtime_context: McpRuntimeContext,\n    resolved_environment: std::result::Result<Option<Arc<Environment>>, String>,\n    runtime_auth_provider: Option<SharedAuthProvider>,\n    protocol_mode: McpProtocolMode,\n) -> Result<RmcpClient, StartupOutcomeError> {\n    let config = server.config().clone();\n    if matches!(config.auth, McpServerAuth::ChatGpt)\n        && !config.is_local_environment()\n        && !has_explicit_http_authorization(&config)\n    {\n        return Err(StartupOutcomeError::from(anyhow!(\n            \"executor-owned MCP server `{server_name}` cannot use hosted ChatGPT authentication; configure executor-owned credentials instead\"\n        )));\n    }\n    let resolved_environment =\n        resolved_environment.map_err(|err| StartupOutcomeError::from(anyhow!(err)))?;\n    let is_local_environment = config.is_local_environment();\n    let oauth_credential_name = config.oauth_credential_name(server_name);\n    let McpServerConfig { transport, .. } = config;\n\n    match transport {\n        McpServerTransportConfig::Stdio {\n            command,\n            args,\n            env,\n            env_vars,\n            cwd,\n        } => {\n            let command_os: OsString = command.into();","sourceCodeStart":1063,"sourceCodeEnd":1099,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/rmcp_client.rs#L1063-L1099","documentation":"make_rmcp_client refuses to start a server configured with auth = \"chatgpt\" that runs in a non-local (executor-owned) environment and has no explicit HTTP Authorization header. Hosted ChatGPT credentials are bound to the host session and cannot be handed to a remote executor, so the combination is rejected at startup rather than failing authentication later with an opaque 401.","triggerScenarios":"An MCP server entry with McpServerAuth::ChatGpt whose effective environment is remote/executor-owned (cloud execution, exec-server on another machine) and no Authorization entry under http_headers/env_http_headers and no bearer token: for example promoting a working local ChatGPT-auth MCP server to a cloud executor without changing its auth.","commonSituations":"Enterprise rollouts moving MCP execution to remote environments; app-server connected to an exec-server on a different OS; default auth left on 'chatgpt' when the server moved off the local environment.","solutions":["Give the server executor-owned credentials: set bearer_token_env_var or an Authorization entry under http_headers/env_http_headers in its config","Or run the server in the local environment (drop the remote environment setting) so hosted ChatGPT auth applies","Or switch to an OAuth credential the executor can obtain itself (oauth_credential_name)"],"exampleFix":"# before: ChatGPT-hosted auth on a remote executor\n[mcp_servers.foo]\nurl = \"https://foo.example/mcp\"\nauth = \"chatgpt\"\n\n# after: executor-owned credential\n[mcp_servers.foo]\nurl = \"https://foo.example/mcp\"\nbearer_token_env_var = \"FOO_MCP_TOKEN\"","handlingStrategy":"validation","validationCode":"// Reject auth/environment combos make_rmcp_client will refuse\nfn will_fail_auth_check(cfg: &McpServerConfig) -> bool {\n    matches!(cfg.auth, McpServerAuth::ChatGpt)\n        && !cfg.is_local_environment()\n        && !has_explicit_http_authorization(cfg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit MCP configs for auth = 'chatgpt' whenever a server moves to a remote/executor environment","Default remote servers to bearer_token_env_var or OAuth credentials owned by the executor","Treat any auth scheme tied to the host session as local-only"],"tags":["mcp","codex","authentication","chatgpt-auth","executor","remote-environment","config"],"backgroundTag":"unsupported-authentication-method","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}