Skip to content

Commit 9b747a6

Browse files
jamesmontemagnoCopilotgpeal
authored
Add installation guide for OpenAI Codex (#1340)
* Add installation guide for OpenAI Codex * updates based on feedback * Remove optional Docker requirement from installation guide for OpenAI Codex * Remove Docker-related troubleshooting and references from installation guide * Update docs/installation-guides/install-codex.md Co-authored-by: Copilot <[email protected]> * Update docs/installation-guides/install-codex.md * Apply suggestions from code review * Update docs/installation-guides/install-codex.md Co-authored-by: Gabriel Peal <[email protected]> * updates on feedback --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Gabriel Peal <[email protected]>
1 parent bb722f1 commit 9b747a6

File tree

2 files changed

+113
-0
lines changed

2 files changed

+113
-0
lines changed

docs/installation-guides/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This directory contains detailed installation instructions for the GitHub MCP Se
77
- **[Claude Applications](install-claude.md)** - Installation guide for Claude Web, Claude Desktop and Claude Code CLI
88
- **[Cursor](install-cursor.md)** - Installation guide for Cursor IDE
99
- **[Google Gemini CLI](install-gemini-cli.md)** - Installation guide for Google Gemini CLI
10+
- **[OpenAI Codex](install-codex.md)** - Installation guide for OpenAI Codex
1011
- **[Windsurf](install-windsurf.md)** - Installation guide for Windsurf IDE
1112

1213
## Support by Host Application
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Install GitHub MCP Server in OpenAI Codex
2+
3+
## Prerequisites
4+
5+
1. OpenAI Codex (MCP-enabled) installed / available
6+
2. A [GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new)
7+
8+
> The remote GitHub MCP server is hosted by GitHub at `https://api.githubcopilot.com/mcp/` and supports Streamable HTTP.
9+
10+
## Remote Configuration
11+
12+
Edit `~/.codex/config.toml` (shared by CLI and IDE extension) and add:
13+
14+
```toml
15+
[mcp_servers.github]
16+
url = "https://api.githubcopilot.com/mcp/"
17+
# Replace with your real PAT (least-privilege scopes). Do NOT commit this.
18+
bearer_token_env_var = "GITHUB_PAT_TOKEN"
19+
```
20+
21+
You can also add it via the Codex CLI:
22+
23+
```cli
24+
codex mcp add github --url https://api.githubcopilot.com/mcp/
25+
```
26+
27+
<details>
28+
<summary><b>Storing Your PAT Securely</b></summary>
29+
<br>
30+
31+
For security, avoid hardcoding your token. One common approach:
32+
33+
1. Store your token in `.env` file
34+
```
35+
GITHUB_PAT_TOKEN=ghp_your_token_here
36+
```
37+
38+
2. Add to .gitignore
39+
```bash
40+
echo -e ".env" >> .gitignore
41+
```
42+
</details>
43+
44+
## Local Docker Configuration
45+
46+
Use this if you prefer a local, self-hosted instance instead of the remote HTTP server, please refer to the [OpenAI documentation for configuration](https://developers.openai.com/codex/mcp).
47+
48+
## Verification
49+
50+
After starting Codex (CLI or IDE):
51+
1. Run `/mcp` in the TUI or use the IDE MCP panel; confirm `github` shows tools.
52+
2. Ask: "List my GitHub repositories".
53+
3. If tools are missing:
54+
- Check token validity & scopes.
55+
- Confirm correct table name: `[mcp_servers.github]`.
56+
57+
## Usage
58+
59+
After setup, Codex can interact with GitHub directly. It will use the default tool set automatically but can be [configured](../../README.md#default-toolset). Try these example prompts:
60+
61+
**Repository Operations:**
62+
- "List my GitHub repositories"
63+
- "Show me recent issues in [owner/repo]"
64+
- "Create a new issue in [owner/repo] titled 'Bug: fix login'"
65+
66+
**Pull Requests:**
67+
- "List open pull requests in [owner/repo]"
68+
- "Show me the diff for PR #123"
69+
- "Add a comment to PR #123: 'LGTM, approved'"
70+
71+
**Actions & Workflows:**
72+
- "Show me recent workflow runs in [owner/repo]"
73+
- "Trigger the 'deploy' workflow in [owner/repo]"
74+
75+
**Gists:**
76+
- "Create a gist with this code snippet"
77+
- "List my gists"
78+
79+
> **Tip**: Use `/mcp` in the Codex UI to see all available GitHub tools and their descriptions.
80+
81+
## Choosing Scopes for Your PAT
82+
83+
Minimal useful scopes (adjust as needed):
84+
- `repo` (general repository operations)
85+
- `workflow` (if you want Actions workflow access)
86+
- `read:org` (if accessing org-level resources)
87+
- `project` (for classic project boards)
88+
- `gist` (if using gist tools)
89+
90+
Use the principle of least privilege: add scopes only when a tool request fails due to permission.
91+
92+
## Troubleshooting
93+
94+
| Issue | Possible Cause | Fix |
95+
|-------|----------------|-----|
96+
| Authentication failed | Missing/incorrect PAT scope | Regenerate PAT; ensure `repo` scope present |
97+
| 401 Unauthorized (remote) | Token expired/revoked | Create new PAT; update `bearer_token_env_var` |
98+
| Server not listed | Wrong table name or syntax error | Use `[mcp_servers.github]`; validate TOML |
99+
| Tools missing / zero tools | Insufficient PAT scopes | Add needed scopes (workflow, gist, etc.) |
100+
| Token in file risks leakage | Committed accidentally | Rotate token; add file to `.gitignore` |
101+
102+
## Security Best Practices
103+
1. Never commit tokens into version control
104+
3. Rotate tokens periodically
105+
4. Restrict scopes up front; expand only when required
106+
5. Remove unused PATs from your GitHub account
107+
108+
## References
109+
- Remote server URL: `https://api.githubcopilot.com/mcp/`
110+
- Release binaries: [GitHub Releases](https://github.com/github/github-mcp-server/releases)
111+
- OpenAI Codex MCP docs: https://developers.openai.com/codex/mcp
112+
- Main project README: [Advanced configuration options](../../README.md)

0 commit comments

Comments
 (0)