Skip to content

Commit 6ed728d

Browse files
MCP Core docs edit pass (#1033)
Co-authored-by: Stephen Toub <stoub@microsoft.com>
1 parent ffda098 commit 6ed728d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+452
-447
lines changed

src/ModelContextProtocol.Core/Authentication/ClientOAuthOptions.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public sealed class ClientOAuthOptions
1919
/// Gets or sets the OAuth client secret.
2020
/// </summary>
2121
/// <remarks>
22-
/// This is optional for public clients or when using PKCE without client authentication.
22+
/// This secret is optional for public clients or when using PKCE without client authentication.
2323
/// </remarks>
2424
public string? ClientSecret { get; set; }
2525

@@ -43,7 +43,7 @@ public sealed class ClientOAuthOptions
4343
/// If not specified, the provider will use the scopes from the protected resource metadata.
4444
/// </para>
4545
/// <para>
46-
/// Common OAuth scopes include "openid", "profile", "email", etc.
46+
/// Common OAuth scopes include "openid", "profile", and "email".
4747
/// </para>
4848
/// </remarks>
4949
public IEnumerable<string>? Scopes { get; set; }
@@ -82,7 +82,7 @@ public sealed class ClientOAuthOptions
8282
/// Gets or sets the options to use during dynamic client registration.
8383
/// </summary>
8484
/// <remarks>
85-
/// Only used when a <see cref="ClientId"/> is not specified.
85+
/// This value is only used when no <see cref="ClientId"/> is specified.
8686
/// </remarks>
8787
public DynamicClientRegistrationOptions? DynamicClientRegistration { get; set; }
8888

@@ -92,7 +92,7 @@ public sealed class ClientOAuthOptions
9292
/// </summary>
9393
/// <remarks>
9494
/// <para>
95-
/// Parameters specified cannot override or append to any automatically set parameters like the "redirect_uri"
95+
/// Parameters specified cannot override or append to any automatically set parameters like the "redirect_uri",
9696
/// which should instead be configured via <see cref="RedirectUri"/>.
9797
/// </para>
9898
/// </remarks>
@@ -103,4 +103,4 @@ public sealed class ClientOAuthOptions
103103
/// If none is provided, tokens will be cached with the transport.
104104
/// </summary>
105105
public ITokenCache? TokenCache { get; set; }
106-
}
106+
}

src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ internal sealed partial class ClientOAuthProvider
5252
/// </summary>
5353
/// <param name="serverUrl">The MCP server URL.</param>
5454
/// <param name="options">The OAuth provider configuration options.</param>
55-
/// <param name="httpClient">The HTTP client to use for OAuth requests. If null, a default HttpClient will be used.</param>
55+
/// <param name="httpClient">The HTTP client to use for OAuth requests. If null, a default HttpClient is used.</param>
5656
/// <param name="loggerFactory">A logger factory to handle diagnostic messages.</param>
57-
/// <exception cref="ArgumentNullException">Thrown when serverUrl or options are null.</exception>
57+
/// <exception cref="ArgumentNullException"><paramref name="serverUrl"/> or <paramref name="options"/> is null.</exception>
5858
public ClientOAuthProvider(
5959
Uri serverUrl,
6060
ClientOAuthOptions options,
@@ -136,7 +136,7 @@ public ClientOAuthProvider(
136136
/// <param name="scheme">The authentication scheme to use.</param>
137137
/// <param name="resourceUri">The URI of the resource requiring authentication.</param>
138138
/// <param name="cancellationToken">A token to cancel the operation.</param>
139-
/// <returns>An authentication token string or null if no token could be obtained for the specified scheme.</returns>
139+
/// <returns>An authentication token string, or null if no token could be obtained for the specified scheme.</returns>
140140
public async Task<string?> GetCredentialAsync(string scheme, Uri resourceUri, CancellationToken cancellationToken = default)
141141
{
142142
ThrowIfNotBearerScheme(scheme);
@@ -186,8 +186,8 @@ public async Task HandleUnauthorizedResponseAsync(
186186
/// Performs OAuth authorization by selecting an appropriate authorization server and completing the OAuth flow.
187187
/// </summary>
188188
/// <param name="response">The 401 Unauthorized response containing authentication challenge.</param>
189-
/// <param name="cancellationToken">Cancellation token.</param>
190-
/// <returns>Result indicating whether authorization was successful.</returns>
189+
/// <param name="cancellationToken">The cancellation token.</param>
190+
/// <returns>A result object indicating whether authorization was successful.</returns>
191191
private async Task PerformOAuthAuthorizationAsync(
192192
HttpResponseMessage response,
193193
CancellationToken cancellationToken)

src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ public sealed class DynamicClientRegistrationOptions
99
/// Gets or sets the client name to use during dynamic client registration.
1010
/// </summary>
1111
/// <remarks>
12-
/// This is a human-readable name for the client that may be displayed to users during authorization.
12+
/// This value is a human-readable name for the client that can be displayed to users during authorization.
1313
/// </remarks>
1414
public string? ClientName { get; set; }
1515

1616
/// <summary>
1717
/// Gets or sets the client URI to use during dynamic client registration.
1818
/// </summary>
1919
/// <remarks>
20-
/// This should be a URL pointing to the client's home page or information page.
20+
/// This value should be a URL pointing to the client's home page or information page.
2121
/// </remarks>
2222
public Uri? ClientUri { get; set; }
2323

@@ -29,7 +29,7 @@ public sealed class DynamicClientRegistrationOptions
2929
/// This token is used to authenticate the client during the registration process.
3030
/// </para>
3131
/// <para>
32-
/// This is required if the authorization server does not allow anonymous client registration.
32+
/// This token is required if the authorization server does not allow anonymous client registration.
3333
/// </para>
3434
/// </remarks>
3535
public string? InitialAccessToken { get; set; }
@@ -46,4 +46,4 @@ public sealed class DynamicClientRegistrationOptions
4646
/// </para>
4747
/// </remarks>
4848
public Func<DynamicClientRegistrationResponse, CancellationToken, Task>? ResponseDelegate { get; set; }
49-
}
49+
}

src/ModelContextProtocol.Core/Authentication/DynamicClientRegistrationResponse.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,50 @@ namespace ModelContextProtocol.Authentication;
88
public sealed class DynamicClientRegistrationResponse
99
{
1010
/// <summary>
11-
/// Gets or sets the client identifier.
11+
/// Gets or initializes the client identifier.
1212
/// </summary>
1313
[JsonPropertyName("client_id")]
1414
public required string ClientId { get; init; }
1515

1616
/// <summary>
17-
/// Gets or sets the client secret.
17+
/// Gets or initializes the client secret.
1818
/// </summary>
1919
[JsonPropertyName("client_secret")]
2020
public string? ClientSecret { get; init; }
2121

2222
/// <summary>
23-
/// Gets or sets the redirect URIs for the client.
23+
/// Gets or initializes the redirect URIs for the client.
2424
/// </summary>
2525
[JsonPropertyName("redirect_uris")]
2626
public string[]? RedirectUris { get; init; }
2727

2828
/// <summary>
29-
/// Gets or sets the token endpoint authentication method.
29+
/// Gets or initializes the token endpoint authentication method.
3030
/// </summary>
3131
[JsonPropertyName("token_endpoint_auth_method")]
3232
public string? TokenEndpointAuthMethod { get; init; }
3333

3434
/// <summary>
35-
/// Gets or sets the grant types that the client will use.
35+
/// Gets or initializes the grant types that the client will use.
3636
/// </summary>
3737
[JsonPropertyName("grant_types")]
3838
public string[]? GrantTypes { get; init; }
3939

4040
/// <summary>
41-
/// Gets or sets the response types that the client will use.
41+
/// Gets or initializes the response types that the client will use.
4242
/// </summary>
4343
[JsonPropertyName("response_types")]
4444
public string[]? ResponseTypes { get; init; }
4545

4646
/// <summary>
47-
/// Gets or sets the client ID issued timestamp.
47+
/// Gets or initializes the timestamp at which the client ID was issued.
4848
/// </summary>
4949
[JsonPropertyName("client_id_issued_at")]
5050
public long? ClientIdIssuedAt { get; init; }
5151

5252
/// <summary>
53-
/// Gets or sets the client secret expiration time.
53+
/// Gets or initializes the client secret expiration time.
5454
/// </summary>
5555
[JsonPropertyName("client_secret_expires_at")]
5656
public long? ClientSecretExpiresAt { get; init; }
57-
}
57+
}

src/ModelContextProtocol.Core/Authentication/ProtectedResourceMetadata.cs

Lines changed: 68 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,81 @@ namespace ModelContextProtocol.Authentication;
99
public sealed class ProtectedResourceMetadata
1010
{
1111
/// <summary>
12-
/// The resource URI.
12+
/// Gets or sets the resource URI.
1313
/// </summary>
14+
/// <value>
15+
/// The protected resource's resource identifier.
16+
/// </value>
1417
/// <remarks>
15-
/// REQUIRED. The protected resource's resource identifier.
18+
/// REQUIRED.
1619
/// </remarks>
1720
[JsonPropertyName("resource")]
1821
public required Uri Resource { get; set; }
1922

2023
/// <summary>
21-
/// The list of authorization server URIs.
24+
/// Gets or sets the list of authorization server URIs.
2225
/// </summary>
23-
/// <remarks>
24-
/// OPTIONAL. JSON array containing a list of OAuth authorization server issuer identifiers
26+
/// <value>
27+
/// A JSON array containing a list of OAuth authorization server issuer identifiers
2528
/// for authorization servers that can be used with this protected resource.
29+
/// </value>
30+
/// <remarks>
31+
/// OPTIONAL.
2632
/// </remarks>
2733
[JsonPropertyName("authorization_servers")]
2834
public List<Uri> AuthorizationServers { get; set; } = [];
2935

3036
/// <summary>
31-
/// The supported bearer token methods.
37+
/// Gets or sets the supported bearer token methods.
3238
/// </summary>
33-
/// <remarks>
34-
/// OPTIONAL. JSON array containing a list of the supported methods of sending an OAuth 2.0 bearer token
39+
/// <value>
40+
/// A JSON array containing a list of the supported methods of sending an OAuth 2.0 bearer token
3541
/// to the protected resource. Defined values are ["header", "body", "query"].
42+
/// </value>
43+
/// <remarks>
44+
/// OPTIONAL.
3645
/// </remarks>
3746
[JsonPropertyName("bearer_methods_supported")]
3847
public List<string> BearerMethodsSupported { get; set; } = ["header"];
3948

4049
/// <summary>
41-
/// The supported scopes.
50+
/// Gets or sets the supported scopes.
4251
/// </summary>
43-
/// <remarks>
44-
/// RECOMMENDED. JSON array containing a list of scope values that are used in authorization
52+
/// <value>
53+
/// A JSON array containing a list of scope values that are used in authorization
4554
/// requests to request access to this protected resource.
55+
/// </value>
56+
/// <remarks>
57+
/// RECOMMENDED.
4658
/// </remarks>
4759
[JsonPropertyName("scopes_supported")]
4860
public List<string> ScopesSupported { get; set; } = [];
4961

5062
/// <summary>
51-
/// URL of the protected resource's JSON Web Key (JWK) Set document.
63+
/// Gets or sets the URL of the protected resource's JSON Web Key (JWK) Set document.
5264
/// </summary>
5365
/// <remarks>
54-
/// OPTIONAL. This contains public keys belonging to the protected resource, such as signing key(s)
55-
/// that the resource server uses to sign resource responses. This URL MUST use the https scheme.
66+
/// OPTIONAL. This document contains public keys belonging to the protected resource, such as signing keys
67+
/// that the resource server uses to sign resource responses. This URL MUST use the HTTPS scheme.
5668
/// </remarks>
5769
[JsonPropertyName("jwks_uri")]
5870
public Uri? JwksUri { get; set; }
5971

6072
/// <summary>
61-
/// List of the JWS signing algorithms supported by the protected resource for signing resource responses.
73+
/// Gets or sets the list of the JWS signing algorithms supported by the protected resource for signing resource responses.
6274
/// </summary>
75+
/// <value>
76+
/// A JSON array containing a list of the JWS signing algorithms (alg values) supported by the protected resource
77+
/// for signing resource responses.
78+
/// </value>
6379
/// <remarks>
64-
/// OPTIONAL. JSON array containing a list of the JWS signing algorithms (alg values) supported by the protected resource
65-
/// for signing resource responses. No default algorithms are implied if this entry is omitted. The value none MUST NOT be used.
80+
/// OPTIONAL. No default algorithms are implied if this entry is omitted. The value "none" MUST NOT be used.
6681
/// </remarks>
6782
[JsonPropertyName("resource_signing_alg_values_supported")]
6883
public List<string>? ResourceSigningAlgValuesSupported { get; set; }
6984

7085
/// <summary>
71-
/// Human-readable name of the protected resource intended for display to the end user.
86+
/// Gets or sets the human-readable name of the protected resource intended for display to the end user.
7287
/// </summary>
7388
/// <remarks>
7489
/// RECOMMENDED. It is recommended that protected resource metadata include this field.
@@ -78,26 +93,32 @@ public sealed class ProtectedResourceMetadata
7893
public string? ResourceName { get; set; }
7994

8095
/// <summary>
81-
/// The URI to the resource documentation.
96+
/// Gets or sets the URI to the resource documentation.
8297
/// </summary>
83-
/// <remarks>
84-
/// OPTIONAL. URL of a page containing human-readable information that developers might want or need to know
98+
/// <value>
99+
/// The URL of a page containing human-readable information that developers might want or need to know
85100
/// when using the protected resource.
101+
/// </value>
102+
/// <remarks>
103+
/// OPTIONAL.
86104
/// </remarks>
87105
[JsonPropertyName("resource_documentation")]
88106
public Uri? ResourceDocumentation { get; set; }
89107

90108
/// <summary>
91-
/// URL of a page containing human-readable information about the protected resource's requirements.
109+
/// Gets or sets the URL of a page containing human-readable information about the protected resource's requirements.
92110
/// </summary>
111+
/// <value>
112+
/// The URL of a page that contains information about how the client can use the data provided by the protected resource.
113+
/// </value>
93114
/// <remarks>
94-
/// OPTIONAL. Information about how the client can use the data provided by the protected resource.
115+
/// OPTIONAL.
95116
/// </remarks>
96117
[JsonPropertyName("resource_policy_uri")]
97118
public Uri? ResourcePolicyUri { get; set; }
98119

99120
/// <summary>
100-
/// URL of a page containing human-readable information about the protected resource's terms of service.
121+
/// Gets or sets the URL of a page containing human-readable information about the protected resource's terms of service.
101122
/// </summary>
102123
/// <remarks>
103124
/// OPTIONAL. The value of this field MAY be internationalized.
@@ -106,40 +127,52 @@ public sealed class ProtectedResourceMetadata
106127
public Uri? ResourceTosUri { get; set; }
107128

108129
/// <summary>
109-
/// Boolean value indicating protected resource support for mutual-TLS client certificate-bound access tokens.
130+
/// Gets or sets a value indicating whether there is protected resource support for mutual-TLS client certificate-bound access tokens.
110131
/// </summary>
132+
/// <value>
133+
/// <see langword="true"/> if there's protected resource support for mutual-TLS client certificate-bound access tokens; otherwise, <see langword="false"/>. The default is <see langword="false"/>.
134+
/// </value>
111135
/// <remarks>
112-
/// OPTIONAL. If omitted, the default value is false.
136+
/// OPTIONAL.
113137
/// </remarks>
114138
[JsonPropertyName("tls_client_certificate_bound_access_tokens")]
115139
public bool? TlsClientCertificateBoundAccessTokens { get; set; }
116140

117141
/// <summary>
118-
/// List of the authorization details type values supported by the resource server.
142+
/// Gets or sets the list of the authorization details type values supported by the resource server.
119143
/// </summary>
120-
/// <remarks>
121-
/// OPTIONAL. JSON array containing a list of the authorization details type values supported by the resource server
144+
/// <value>
145+
/// A JSON array containing a list of the authorization details type values supported by the resource server
122146
/// when the authorization_details request parameter is used.
147+
/// </value>
148+
/// <remarks>
149+
/// OPTIONAL.
123150
/// </remarks>
124151
[JsonPropertyName("authorization_details_types_supported")]
125152
public List<string>? AuthorizationDetailsTypesSupported { get; set; }
126153

127154
/// <summary>
128-
/// List of the JWS algorithm values supported by the resource server for validating DPoP proof JWTs.
155+
/// Gets or sets the list of the JWS algorithm values supported by the resource server for validating DPoP proof JWTs.
129156
/// </summary>
130-
/// <remarks>
131-
/// OPTIONAL. JSON array containing a list of the JWS alg values supported by the resource server
157+
/// <value>
158+
/// A JSON array containing a list of the JWS alg values supported by the resource server
132159
/// for validating Demonstrating Proof of Possession (DPoP) proof JWTs.
160+
/// </value>
161+
/// <remarks>
162+
/// OPTIONAL.
133163
/// </remarks>
134164
[JsonPropertyName("dpop_signing_alg_values_supported")]
135165
public List<string>? DpopSigningAlgValuesSupported { get; set; }
136166

137167
/// <summary>
138-
/// Boolean value specifying whether the protected resource always requires the use of DPoP-bound access tokens.
168+
/// Gets or sets a value indicating whether the protected resource always requires the use of DPoP-bound access tokens.
139169
/// </summary>
170+
/// <value>
171+
/// <see langword="true"/> if the protected resource always requires the use of DPoP-bound access tokens; otherwise, <see langword="false"/>. The default is <see langword="false"/>.
172+
/// </value>
140173
/// <remarks>
141-
/// OPTIONAL. If omitted, the default value is false.
174+
/// OPTIONAL.
142175
/// </remarks>
143176
[JsonPropertyName("dpop_bound_access_tokens_required")]
144177
public bool? DpopBoundAccessTokensRequired { get; set; }
145-
}
178+
}

0 commit comments

Comments
 (0)