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

Function newDotcomHost

pkg/utils/api.go:61–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61func newDotcomHost() (APIHost, error) {
62 baseRestURL, err := url.Parse("https://api.github.com/")
63 if err != nil {
64 return APIHost{}, fmt.Errorf("failed to parse dotcom REST URL: %w", err)
65 }
66
67 gqlURL, err := url.Parse("https://api.github.com/graphql")
68 if err != nil {
69 return APIHost{}, fmt.Errorf("failed to parse dotcom GraphQL URL: %w", err)
70 }
71
72 uploadURL, err := url.Parse("https://uploads.github.com")
73 if err != nil {
74 return APIHost{}, fmt.Errorf("failed to parse dotcom Upload URL: %w", err)
75 }
76
77 rawURL, err := url.Parse("https://raw.githubusercontent.com/")
78 if err != nil {
79 return APIHost{}, fmt.Errorf("failed to parse dotcom Raw URL: %w", err)
80 }
81
82 // The authorization server for GitHub.com is at github.com/login/oauth, not api.github.com
83 authorizationServerURL, err := url.Parse("https://github.com/login/oauth")
84 if err != nil {
85 return APIHost{}, fmt.Errorf("failed to parse dotcom Authorization Server URL: %w", err)
86 }
87
88 return APIHost{
89 restURL: baseRestURL,
90 gqlURL: gqlURL,
91 uploadURL: uploadURL,
92 rawURL: rawURL,
93 authorizationServerURL: authorizationServerURL,
94 }, nil
95}
96
97func newGHECHost(hostname string) (APIHost, error) {
98 u, err := url.Parse(hostname)

Callers 1

parseAPIHostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected