MCPcopy Create free account
hub / github.com/modelcontextprotocol/go-sdk / handleServerMetadata

Method handleServerMetadata

oauthex/oauthex_test.go:99–120  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

97}
98
99func (s *state) handleServerMetadata(w http.ResponseWriter, r *http.Request) {
100 issuer := getBaseURL(r)
101 metadata := AuthServerMeta{
102 Issuer: issuer,
103 AuthorizationEndpoint: issuer + "/authorize",
104 TokenEndpoint: issuer + "/token",
105 RegistrationEndpoint: issuer + "/register",
106 JWKSURI: issuer + "/.well-known/jwks.json",
107 ScopesSupported: []string{"openid", "profile", "email"},
108 ResponseTypesSupported: []string{"code"},
109 GrantTypesSupported: []string{"authorization_code"},
110 TokenEndpointAuthMethodsSupported: []string{"none"},
111 CodeChallengeMethodsSupported: []string{"S256"},
112 }
113 var buf bytes.Buffer
114 if err := json.NewEncoder(&buf).Encode(metadata); err != nil {
115 http.Error(w, err.Error(), http.StatusInternalServerError)
116 return
117 }
118 w.Header().Set("Content-Type", "application/json")
119 w.Write(buf.Bytes())
120}
121
122// handleDynamicClientRegistration handles dynamic client registration requests,
123// as defined in RFC 7591.

Callers

nothing calls this directly

Calls 4

getBaseURLFunction · 0.85
BytesMethod · 0.80
WriteMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected