Skip to content

Commit af719fc

Browse files
gewarrenstephentoubmikekistler
authored
Docs edit pass (MCP.AspNetCore and a few other files) (#1034)
Co-authored-by: Stephen Toub <[email protected]> Co-authored-by: Mike Kistler <[email protected]>
1 parent 6ed728d commit af719fc

11 files changed

+90
-81
lines changed

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationDefaults.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace ModelContextProtocol.AspNetCore.Authentication;
22

33
/// <summary>
4-
/// Default values used by MCP authentication.
4+
/// Represents default values used by MCP authentication.
55
/// </summary>
66
public static class McpAuthenticationDefaults
77
{
@@ -14,4 +14,4 @@ public static class McpAuthenticationDefaults
1414
/// The default value used for authentication scheme display name.
1515
/// </summary>
1616
public const string DisplayName = "MCP Authentication";
17-
}
17+
}

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationEvents.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
public class McpAuthenticationEvents
77
{
88
/// <summary>
9-
/// Gets or sets the function that is invoked when resource metadata is requested.
9+
/// Gets or sets the function that's invoked when resource metadata is requested.
1010
/// </summary>
1111
/// <remarks>
1212
/// This function is called when a resource metadata request is made to the protected resource metadata endpoint.
1313
/// The implementer should set the <see cref="ResourceMetadataRequestContext.ResourceMetadata"/> property
1414
/// to provide the appropriate metadata for the current request.
1515
/// </remarks>
1616
public Func<ResourceMetadataRequestContext, Task> OnResourceMetadataRequest { get; set; } = context => Task.CompletedTask;
17-
}
17+
}

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace ModelContextProtocol.AspNetCore.Authentication;
99

1010
/// <summary>
11-
/// Authentication handler for MCP protocol that adds resource metadata to challenge responses
11+
/// Represents an authentication handler for MCP protocol that adds resource metadata to challenge responses
1212
/// and handles resource metadata endpoint requests.
1313
/// </summary>
1414
public class McpAuthenticationHandler : AuthenticationHandler<McpAuthenticationOptions>, IAuthenticationRequestHandler

src/ModelContextProtocol.AspNetCore/Authentication/McpAuthenticationOptions.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace ModelContextProtocol.AspNetCore.Authentication;
55

66
/// <summary>
7-
/// Options for the MCP authentication handler.
7+
/// Represents options for the MCP authentication handler.
88
/// </summary>
99
public class McpAuthenticationOptions : AuthenticationSchemeOptions
1010
{
@@ -25,16 +25,16 @@ public McpAuthenticationOptions()
2525
/// Gets or sets the events used to handle authentication events.
2626
/// </summary>
2727
public new McpAuthenticationEvents Events
28-
{
29-
get => (McpAuthenticationEvents)base.Events!;
28+
{
29+
get => (McpAuthenticationEvents)base.Events!;
3030
set => base.Events = value;
3131
}
3232

3333
/// <summary>
34-
/// The URI to the resource metadata document.
34+
/// Gets or sets the URI to the resource metadata document.
3535
/// </summary>
3636
/// <remarks>
37-
/// This URI will be included in the WWW-Authenticate header when a 401 response is returned.
37+
/// This URI is included in the WWW-Authenticate header when a 401 response is returned.
3838
/// </remarks>
3939
public Uri ResourceMetadataUri { get; set; }
4040

@@ -46,4 +46,4 @@ public McpAuthenticationOptions()
4646
/// supported scopes, and other information needed for clients to authenticate.
4747
/// </remarks>
4848
public ProtectedResourceMetadata? ResourceMetadata { get; set; }
49-
}
49+
}

src/ModelContextProtocol.AspNetCore/Authentication/ResourceMetadataRequestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace ModelContextProtocol.AspNetCore.Authentication;
66

77
/// <summary>
8-
/// Context for resource metadata request events.
8+
/// Represents the context for resource metadata request events.
99
/// </summary>
1010
public class ResourceMetadataRequestContext : HandleRequestContext<McpAuthenticationOptions>
1111
{

src/ModelContextProtocol.AspNetCore/HttpMcpServerBuilderExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ public static class HttpMcpServerBuilderExtensions
1313
{
1414
/// <summary>
1515
/// Adds the services necessary for <see cref="M:McpEndpointRouteBuilderExtensions.MapMcp"/>
16-
/// to handle MCP requests and sessions using the MCP Streamable HTTP transport. For more information on configuring the underlying HTTP server
17-
/// to control things like port binding custom TLS certificates, see the <see href="https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis">Minimal APIs quick reference</see>.
16+
/// to handle MCP requests and sessions using the MCP Streamable HTTP transport.
1817
/// </summary>
1918
/// <param name="builder">The builder instance.</param>
2019
/// <param name="configureOptions">Configures options for the Streamable HTTP transport. This allows configuring per-session
2120
/// <see cref="McpServerOptions"/> and running logic before and after a session.</param>
2221
/// <returns>The builder provided in <paramref name="builder"/>.</returns>
22+
/// <remarks>For more information on configuring the underlying HTTP server
23+
/// to control things like port binding custom TLS certificates, see the <see href="https://learn.microsoft.com/aspnet/core/fundamentals/minimal-apis">Minimal APIs quick reference</see>.
24+
/// </remarks>
2325
/// <exception cref="ArgumentNullException"><paramref name="builder"/> is <see langword="null"/>.</exception>
2426
public static IMcpServerBuilder WithHttpTransport(this IMcpServerBuilder builder, Action<HttpServerTransportOptions>? configureOptions = null)
2527
{

src/ModelContextProtocol.AspNetCore/HttpServerTransportOptions.cs

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
namespace ModelContextProtocol.AspNetCore;
55

66
/// <summary>
7-
/// Configuration options for <see cref="M:McpEndpointRouteBuilderExtensions.MapMcp"/>.
7+
/// Represents configuration options for <see cref="M:McpEndpointRouteBuilderExtensions.MapMcp"/>,
88
/// which implements the Streaming HTTP transport for the Model Context Protocol.
99
/// See the protocol specification for details on the Streamable HTTP transport. <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http"/>
1010
/// </summary>
11+
/// <remarks>
12+
/// For details on the Streamable HTTP transport, see the <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http">protocol specification</see>.
13+
/// </remarks>
1114
public class HttpServerTransportOptions
1215
{
1316
/// <summary>
@@ -18,61 +21,71 @@ public class HttpServerTransportOptions
1821

1922
/// <summary>
2023
/// Gets or sets an optional asynchronous callback for running new MCP sessions manually.
21-
/// This is useful for running logic before a sessions starts and after it completes.
2224
/// </summary>
25+
/// <remarks>
26+
/// This callback is useful for running logic before a sessions starts and after it completes.
27+
/// </remarks>
2328
public Func<HttpContext, McpServer, CancellationToken, Task>? RunSessionHandler { get; set; }
2429

2530
/// <summary>
26-
/// Gets or sets whether the server should run in a stateless mode which does not track state between requests
31+
/// Gets or sets a value that indicates whether the server runs in a stateless mode that doesn't track state between requests,
2732
/// allowing for load balancing without session affinity.
2833
/// </summary>
34+
/// <value>
35+
/// <see langword="true"/> if the server runs in a stateless mode; <see langword="false"/> if the server tracks state between requests. The default is <see langword="false"/>.
36+
/// </value>
2937
/// <remarks>
3038
/// If <see langword="true"/>, <see cref="McpSession.SessionId"/> will be null, and the "MCP-Session-Id" header will not be used,
3139
/// the <see cref="RunSessionHandler"/> will be called once for for each request, and the "/sse" endpoint will be disabled.
3240
/// Unsolicited server-to-client messages and all server-to-client requests are also unsupported, because any responses
33-
/// may arrive at another ASP.NET Core application process.
41+
/// might arrive at another ASP.NET Core application process.
3442
/// Client sampling and roots capabilities are also disabled in stateless mode, because the server cannot make requests.
35-
/// Defaults to <see langword="false"/>.
3643
/// </remarks>
3744
public bool Stateless { get; set; }
3845

3946
/// <summary>
40-
/// Gets or sets whether the server should use a single execution context for the entire session.
47+
/// Gets or sets a value that indicates whether the server uses a single execution context for the entire session.
48+
/// </summary>
49+
/// <value>
50+
/// <see langword="true"/> if the server uses a single execution context for the entire session; otherwise, <see langword="false"/>. The default is <see langword="false"/>.
51+
/// </value>
52+
/// <remarks>
4153
/// If <see langword="false"/>, handlers like tools get called with the <see cref="ExecutionContext"/>
42-
/// belonging to the corresponding HTTP request which can change throughout the MCP session.
54+
/// belonging to the corresponding HTTP request, which can change throughout the MCP session.
4355
/// If <see langword="true"/>, handlers will get called with the same <see cref="ExecutionContext"/>
4456
/// used to call <see cref="ConfigureSessionOptions" /> and <see cref="RunSessionHandler"/>.
45-
/// </summary>
46-
/// <remarks>
4757
/// Enabling a per-session <see cref="ExecutionContext"/> can be useful for setting <see cref="AsyncLocal{T}"/> variables
4858
/// that persist for the entire session, but it prevents you from using IHttpContextAccessor in handlers.
49-
/// Defaults to <see langword="false"/>.
5059
/// </remarks>
5160
public bool PerSessionExecutionContext { get; set; }
5261

5362
/// <summary>
5463
/// Gets or sets the duration of time the server will wait between any active requests before timing out an MCP session.
5564
/// </summary>
65+
/// <value>
66+
/// The amount of time the server waits between any active requests before timing out an MCP session. The default is 2 hours.
67+
/// </value>
5668
/// <remarks>
57-
/// This is checked in background every 5 seconds. A client trying to resume a session will receive a 404 status code
69+
/// This value is checked in the background every 5 seconds. A client trying to resume a session will receive a 404 status code
5870
/// and should restart their session. A client can keep their session open by keeping a GET request open.
59-
/// Defaults to 2 hours.
6071
/// </remarks>
6172
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromHours(2);
6273

6374
/// <summary>
64-
/// Gets or sets maximum number of idle sessions to track in memory. This is used to limit the number of sessions that can be idle at once.
75+
/// Gets or sets maximum number of idle sessions to track in memory. This value is used to limit the number of sessions that can be idle at once.
6576
/// </summary>
77+
/// <value>
78+
/// The maximum number of idle sessions to track in memory. The default is 10,000 sessions.
79+
/// </value>
6680
/// <remarks>
67-
/// Past this limit, the server will log a critical error and terminate the oldest idle sessions even if they have not reached
68-
/// their <see cref="IdleTimeout"/> until the idle session count is below this limit. Clients that keep their session open by
69-
/// keeping a GET request open will not count towards this limit.
70-
/// Defaults to 10,000 sessions.
81+
/// Past this limit, the server logs a critical error and terminates the oldest idle sessions, even if they have not reached
82+
/// their <see cref="IdleTimeout"/>, until the idle session count is below this limit. Clients that keep their session open by
83+
/// keeping a GET request open don't count towards this limit.
7184
/// </remarks>
7285
public int MaxIdleSessionCount { get; set; } = 10_000;
7386

7487
/// <summary>
75-
/// Used for testing the <see cref="IdleTimeout"/>.
88+
/// Gets or sets the time provider that's used for testing the <see cref="IdleTimeout"/>.
7689
/// </summary>
7790
public TimeProvider TimeProvider { get; set; } = TimeProvider.System;
7891
}

src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ public static class McpEndpointRouteBuilderExtensions
1515
{
1616
/// <summary>
1717
/// Sets up endpoints for handling MCP Streamable HTTP transport.
18-
/// See <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http">the 2025-06-18 protocol specification</see> for details about the Streamable HTTP transport.
19-
/// Also maps legacy SSE endpoints for backward compatibility at the path "/sse" and "/message". <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">the 2024-11-05 protocol specification</see> for details about the HTTP with SSE transport.
2018
/// </summary>
2119
/// <param name="endpoints">The web application to attach MCP HTTP endpoints.</param>
2220
/// <param name="pattern">The route pattern prefix to map to.</param>
2321
/// <returns>Returns a builder for configuring additional endpoint conventions like authorization policies.</returns>
22+
/// <remarks>
23+
/// For details about the Streamable HTTP transport, see the <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http">2025-06-18 protocol specification</see>.
24+
/// This method also maps legacy SSE endpoints for backward compatibility at the path "/sse" and "/message". For details about the HTTP with SSE transport, see the <see href="https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse">2024-11-05 protocol specification</see>.
25+
/// </remarks>
2426
public static IEndpointConventionBuilder MapMcp(this IEndpointRouteBuilder endpoints, [StringSyntax("Route")] string pattern = "")
2527
{
2628
var streamableHttpHandler = endpoints.ServiceProvider.GetService<StreamableHttpHandler>() ??

0 commit comments

Comments
 (0)