Skip to content

Commit 3caf1ca

Browse files
Add support for GITHUB_ACCESS_TOKEN env var
- Support GITHUB_ACCESS_TOKEN as the primary environment variable - Keep GITHUB_PERSONAL_ACCESS_TOKEN as deprecated fallback - GITHUB_ACCESS_TOKEN takes precedence when both are set - Update error message to mention both variables - All existing tests pass Co-authored-by: SamMorrowDrums <[email protected]>
1 parent 47f59e8 commit 3caf1ca

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/github-mcp-server/main.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ var (
3232
Short: "Start stdio server",
3333
Long: `Start a server that communicates via standard input/output streams using JSON-RPC messages.`,
3434
RunE: func(_ *cobra.Command, _ []string) error {
35-
token := viper.GetString("personal_access_token")
35+
// Check for GITHUB_ACCESS_TOKEN first (preferred), then fall back to
36+
// GITHUB_PERSONAL_ACCESS_TOKEN (deprecated but still supported)
37+
token := viper.GetString("access_token")
3638
if token == "" {
37-
return errors.New("GITHUB_PERSONAL_ACCESS_TOKEN not set")
39+
token = viper.GetString("personal_access_token")
40+
}
41+
if token == "" {
42+
return errors.New("GITHUB_ACCESS_TOKEN or GITHUB_PERSONAL_ACCESS_TOKEN not set")
3843
}
3944

4045
// If you're wondering why we're not using viper.GetStringSlice("toolsets"),

0 commit comments

Comments
 (0)