fix(oauth): advertise only default scopes in protected resource metadata by SamMorrowDrums · Pull Request #3251 · github/github-mcp-server · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion docs/streamable-http.md
11 changes: 5 additions & 6 deletions pkg/http/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ const (
OAuthProtectedResourcePrefix = "/.well-known/oauth-protected-resource"
)

// SupportedScopes lists every OAuth scope that an MCP tool may require. HTTP
// protected-resource metadata advertises this full set so clients can step up
// authorization for tools excluded from the default grant.
// SupportedScopes lists every OAuth scope that an MCP tool may require.
var SupportedScopes = scopes.SupportedOAuthScopes()

// DefaultScopes are requested by stdio OAuth unless the operator explicitly
// supplies --oauth-scopes. High-risk scopes such as delete_repo require opt-in.
// DefaultScopes are advertised in protected-resource metadata and requested by
// stdio OAuth unless the operator explicitly supplies --oauth-scopes. Other
// scopes require opt-in through a per-tool authorization challenge.
var DefaultScopes = scopes.DefaultOAuthScopes()

// Config holds the OAuth configuration for the MCP server.
Expand Down Expand Up @@ -128,7 +127,7 @@ func (h *AuthHandler) metadataHandler() http.Handler {
Resource: resourceURL,
AuthorizationServers: []string{authorizationServerURL},
ResourceName: "GitHub MCP Server",
ScopesSupported: SupportedScopes,
ScopesSupported: DefaultScopes,
BearerMethodsSupported: []string{"header"},
}

Expand Down
32 changes: 29 additions & 3 deletions pkg/http/oauth/oauth_test.go
Loading