docs/installation-guides/install-codex.md
The remote GitHub MCP server is hosted by GitHub at
https://api.githubcopilot.com/mcp/and supports Streamable HTTP.
Edit ~/.codex/config.toml (shared by CLI and IDE extension) and add:
[mcp_servers.github]
url = "https://api.githubcopilot.com/mcp/"
# Replace with your real PAT (least-privilege scopes). Do NOT commit this.
bearer_token_env_var = "GITHUB_PAT_TOKEN"
You can also add it via the Codex CLI:
codex mcp add github --url https://api.githubcopilot.com/mcp/
For security, avoid hardcoding your token. One common approach:
.env fileGITHUB_PAT_TOKEN=ghp_your_token_here
echo -e ".env" >> .gitignore
Use this if you prefer a local, self-hosted instance instead of the remote HTTP server, please refer to the OpenAI documentation for configuration.
After starting Codex (CLI or IDE):
/mcp in the TUI or use the IDE MCP panel; confirm github shows tools.[mcp_servers.github].After setup, Codex can interact with GitHub directly. It will use the default tool set automatically but can be configured. Try these example prompts:
Repository Operations:
Pull Requests:
Actions & Workflows:
Gists:
Tip: Use
/mcpin the Codex UI to see all available GitHub tools and their descriptions.
Minimal useful scopes (adjust as needed):
repo (general repository operations)workflow (if you want Actions workflow access)read:org (if accessing org-level resources)project (for classic project boards)gist (if using gist tools)Use the principle of least privilege: add scopes only when a tool request fails due to permission.
| Issue | Possible Cause | Fix |
|---|---|---|
| Authentication failed | Missing/incorrect PAT scope | Regenerate PAT; ensure repo scope present |
| 401 Unauthorized (remote) | Token expired/revoked | Create new PAT; update bearer_token_env_var |
| Server not listed | Wrong table name or syntax error | Use [mcp_servers.github]; validate TOML |
| Tools missing / zero tools | Insufficient PAT scopes | Add needed scopes (workflow, gist, etc.) |
| Token in file risks leakage | Committed accidentally | Rotate token; add file to .gitignore |
https://api.githubcopilot.com/mcp/