You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-12Lines changed: 47 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,22 +101,57 @@ See [Remote Server Documentation](docs/remote-server.md) on how to pass addition
101
101
3. Lastly you will need to [Create a GitHub Personal Access Token](https://github.com/settings/personal-access-tokens/new).
102
102
The MCP server can use many of the GitHub APIs, so enable the permissions that you feel comfortable granting your AI tools (to learn more about access tokens, please check out the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)).
103
103
104
-
<details><summary><b>Securely Storing Your GitHub PATs</b></summary>
104
+
<details><summary><b>Handling PATs Securely</b></summary>
105
105
106
+
## Environment Variables (Recommended)
106
107
To keep your GitHub PAT secure and reusable across different MCP hosts:
107
108
108
-
1. Save your GitHub PAT in a `.env` file
109
-
```env
110
-
GITHUB_PAT=your_token_here
111
-
```
112
-
2. Ensure `.env` is in your `.gitignore` file to prevent accidental commits.
113
-
3. Source the environment variable
114
-
```bash
115
-
source .env
116
-
```
117
-
4. You can now reference the token using `$GITHUB_PAT` (or any variable name you choose) in CLI commands or config files.
109
+
1.**Store your PAT in environment variables**
110
+
```bash
111
+
export GITHUB_PAT=your_token_here
112
+
```
113
+
Or create a `.env` file:
114
+
```env
115
+
GITHUB_PAT=your_token_here
116
+
```
117
+
118
+
2.**Protect your `.env` file**
119
+
```bash
120
+
# Add to .gitignore to prevent accidental commits
121
+
echo".env">> .gitignore
122
+
```
123
+
124
+
3.**Reference the token in configurations**
125
+
```bash
126
+
# CLI usage
127
+
claude mcp update github -e GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_PAT
128
+
129
+
# In config files (where supported)
130
+
"env": {
131
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PAT"
132
+
}
133
+
```
118
134
119
-
> Note: the syntax and support for environment variables varies by host app and IDE. Make sure to refer to their documentation for guidance on the proper method for secure token storage and environment variables.
135
+
> **Note**: Environment variable support varies by host app and IDE. Some applications (like Windsurf) require hardcoded tokens in config files.
136
+
137
+
## Token Security Best Practices
138
+
139
+
-**Minimum scopes**: Only grant necessary permissions
140
+
-`repo` - Repository operations
141
+
-`read:packages` - Docker image access
142
+
-**Separate tokens**: Use different PATs for different projects/environments
143
+
-**Regular rotation**: Update tokens periodically
144
+
-**Never commit**: Keep tokens out of version control
145
+
-**File permissions**: Restrict access to config files containing tokens
146
+
```bash
147
+
chmod 600 ~/.your-app/config.json
148
+
```
149
+
150
+
## Required Scopes
151
+
For GitHub MCP Server functionality, your PAT needs:
0 commit comments