Skip to content

Commit 61cba4c

Browse files
fix(oauth): recognize github.com host aliases for the baked-in client
Match the default host via oauth.NormalizeHost instead of only an empty host string, so an explicit GITHUB_HOST=github.com (or api.github.com) still counts as the default and keeps zero-config baked-in login working. GHES and ghe.com users continue to bring their own --oauth-client-id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aa71962 commit 61cba4c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

cmd/github-mcp-server/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ var (
4242
// Fall back to the build-time baked-in client (official releases) when none is
4343
// configured explicitly. The baked-in app is registered on github.com, so it is
4444
// only applied to the default host; GHES/ghe.com users must bring their own
45-
// --oauth-client-id. The secret tracks the id, so an explicitly provided id with
46-
// no secret never picks up the baked-in secret.
47-
if oauthClientID == "" && viper.GetString("host") == "" {
45+
// --oauth-client-id. Recognizing the host via NormalizeHost means an explicit
46+
// GITHUB_HOST=github.com (or api.github.com) still counts as the default and keeps
47+
// zero-config login working. The secret tracks the id, so an explicitly provided
48+
// id with no secret never picks up the baked-in secret.
49+
if oauthClientID == "" && oauth.NormalizeHost(viper.GetString("host")) == "https://github.com" {
4850
oauthClientID = buildinfo.OAuthClientID
4951
oauthClientSecret = buildinfo.OAuthClientSecret
5052
}

0 commit comments

Comments
 (0)