Codex + GitHub
Status: Documentation only. Not run: Codex CLI is not installed, and the server needs a GitHub account and token.
GitHub's remote MCP server in Codex. Codex reads the token from an environment variable you name, so the token never
sits in config.toml.
| Field | Value |
|---|---|
| Client and version | Codex CLI. No version stated in the docs; latest GitHub release on 2026-11-20 was rust-v0.171.0. Not installed or run |
| Server | GitHub MCP Server (remote), published by GitHub |
| URL | Read-only, used below: https://api.githubcopilot.com/mcp/readonly. With write tools: https://api.githubcopilot.com/mcp/ |
| Transport | Streamable HTTP |
| Authentication | Personal access token read from an environment variable named by bearer_token_env_var |
| Read or write | Read and write. Read-only with the /readonly URL or the X-MCP-Readonly header |
| Cost, limits, account | GitHub account and token required. Plan needs not stated in GitHub's guide; not verified |
| Sources | https://github.com/github/github-mcp-server/blob/main/docs/installation-guides/install-codex.md; https://github.com/github/github-mcp-server/blob/main/docs/remote-server.md; https://learn.chatgpt.com/docs/extend/mcp?surface=cli |
| Last checked | 2026-11-20 |
Set it up
Start read-only, and keep the token out of commands and config files. Codex reads the token from an environment
variable named in bearer_token_env_var, so the config holds only the variable's name.
-
Put the token in an environment variable without typing it into a command. In bash or zsh,
read -rsasks for it and does not echo it or save it in history:read -rs GITHUB_PAT_TOKEN && export GITHUB_PAT_TOKEN -
Add the server to
~/.codex/config.tomlwith the read-only URL:[mcp_servers.github] url = "https://api.githubcopilot.com/mcp/readonly" bearer_token_env_var = "GITHUB_PAT_TOKEN"Or the shell equivalent from GitHub's Codex guide, with the read-only URL:
codex mcp add github --url https://api.githubcopilot.com/mcp/readonly --bearer-token-env-var GITHUB_PAT_TOKEN
GitHub's guide uses https://api.githubcopilot.com/mcp/, which includes write tools. Switch to it only after you have
read which tools it adds. Not run: Codex is not installed here.
OpenAI's docs say that if no credential source resolves, Codex can connect without authentication. With GitHub, an unset variable means no token is sent, so expect the server to refuse; check the variable is set in the same shell.
How to check it (from the docs)
- In the Codex TUI, run
/mcpand check thatgithublists its tools. - GitHub's guide: a
401 Unauthorizedmeans the token expired or was revoked; "server not listed" means a wrong table name or TOML syntax (it must be[mcp_servers.github]); missing tools usually mean missing token scopes. - Not run here: we have no Codex output to show.