GitHub MCP server in Codex CLI: config.toml setup works, but codex mcp login github returns 404?
How do I add the GitHub MCP server at https://api.githubcopilot.com/mcp (opens external site) to Codex CLI's config.toml? Running codex mcp login github opens a 404 OAuth page even when a PAT is available in a configured environment variable. I am using Codex CLI 0.46.0.
Originally asked on GitHub: https://github.com/github/github-mcp-server/issues/1177
6 answers
Status: the issue was closed as NOT_PLANNED, so no documentation update came out of it, but a community configuration worked for Codex CLI.
In Codex CLI 0.46.0, add this to config.toml:
experimental_use_rmcp_client = true [mcp_servers.github] url = "https://api.githubcopilot.com/mcp (opens external site)" bearer_token_env_var = "YOUR_ENVIRONMENT_VARIABLE_NAME"
Keep the PAT in the environment variable named by bearer_token_env_var instead of putting the literal token in config.toml.
This lets Codex CLI use the remote streamable HTTP MCP server. The issue author noted that Codex CLI does not integrate an MCP-server-runner, so pointing it at a remote endpoint or a locally running server is needed.
Separately, several users reported that codex mcp login github opens a 404 page even when the PAT is present in the configured environment variable. The reporter who investigated suspected this is a Codex CLI-side problem rather than a github-mcp-server defect. No fix for that 404 flow appears in the thread. One user could access the GitHub MCP from Codex when the server was running in VS Code.
The same config.toml approach did not work in the Codex panel inside VS Code because the panel did not recognize the environment variables.
Did this work for you?What @adam-aggrow tried on GitHub (Partly worked)
Configured Codex CLI 0.46.0 config.toml with experimental_use_rmcp_client = true, an [mcp_servers.NAME] section pointing at https://api.githubcopilot.com/mcp (opens external site), and bearer_token_env_var. It worked for the Codex CLI, but the VS Code Codex panel did not recognize the environment variables.
Did this work for you?What @jaycoolslm tried on GitHub (Didn't work)
Ran codex mcp login github and got a 404 page during OAuth authentication.
Did this work for you?What @laenan8466 tried on GitHub (Didn't work)
Retried codex mcp login github with a PAT present in the environment variable named in .codex/config.toml; the 404 still appeared. The reporter concluded this could be a Codex CLI issue rather than a github-mcp-server issue.
Did this work for you?What @devtanna tried on GitHub (Didn't work)
Attempted to connect Codex to the GitHub HTTP streamable MCP; the login link always went to 404.
Did this work for you?What @Omnls tried on GitHub (Didn't work)
Reported the same 404 login problem with the codexDesktop edition.
Did this work for you?
Related questions
- Is there a remote GitHub MCP server I can use without Docker or a local build?
- Does github-mcp-server support GitHub Actions workflows and logs?
- How can the GitHub MCP server access a repository's wiki?
- GitHub remote MCP server fails with PAT: HTTP 404 or 400 in Claude Code and Cursor?
- Private org repos fail with 404 or Bad credentials in GitHub MCP Server even with PAT: how to fix?