MCPcopy
hub / github.com/github/github-mcp-server / fetchTokenScopesForHost

Function fetchTokenScopesForHost

internal/ghmcp/server.go:437–446  ·  view source on GitHub ↗

fetchTokenScopesForHost fetches the OAuth scopes for a token from the GitHub API. It constructs the appropriate API host URL based on the configured host.

(ctx context.Context, token, host string)

Source from the content-addressed store, hash-verified

435// fetchTokenScopesForHost fetches the OAuth scopes for a token from the GitHub API.
436// It constructs the appropriate API host URL based on the configured host.
437func fetchTokenScopesForHost(ctx context.Context, token, host string) ([]string, error) {
438 apiHost, err := utils.NewAPIHost(host)
439 if err != nil {
440 return nil, fmt.Errorf("failed to parse API host: %w", err)
441 }
442
443 fetcher := scopes.NewFetcher(apiHost, scopes.FetcherOptions{})
444
445 return fetcher.FetchTokenScopes(ctx, token)
446}

Callers 1

RunStdioServerFunction · 0.85

Calls 3

FetchTokenScopesMethod · 0.95
NewAPIHostFunction · 0.92
NewFetcherFunction · 0.92

Tested by

no test coverage detected