You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ModelContextProtocol.AspNetCore/HttpMcpServerBuilderExtensions.cs
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -13,13 +13,15 @@ public static class HttpMcpServerBuilderExtensions
13
13
{
14
14
/// <summary>
15
15
/// 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.
/// <param name="configureOptions">Configures options for the Streamable HTTP transport. This allows configuring per-session
21
20
/// <see cref="McpServerOptions"/> and running logic before and after a session.</param>
22
21
/// <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>
23
25
/// <exception cref="ArgumentNullException"><paramref name="builder"/> is <see langword="null"/>.</exception>
Copy file name to clipboardExpand all lines: src/ModelContextProtocol.AspNetCore/HttpServerTransportOptions.cs
+31-18Lines changed: 31 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -4,10 +4,13 @@
4
4
namespaceModelContextProtocol.AspNetCore;
5
5
6
6
/// <summary>
7
-
/// Configuration options for <see cref="M:McpEndpointRouteBuilderExtensions.MapMcp"/>.
7
+
/// Represents configuration options for <see cref="M:McpEndpointRouteBuilderExtensions.MapMcp"/>,
8
8
/// which implements the Streaming HTTP transport for the Model Context Protocol.
9
9
/// See the protocol specification for details on the Streamable HTTP transport. <see href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http"/>
10
10
/// </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>
11
14
publicclassHttpServerTransportOptions
12
15
{
13
16
/// <summary>
@@ -18,61 +21,71 @@ public class HttpServerTransportOptions
18
21
19
22
/// <summary>
20
23
/// 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.
22
24
/// </summary>
25
+
/// <remarks>
26
+
/// This callback is useful for running logic before a sessions starts and after it completes.
/// 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,
27
32
/// allowing for load balancing without session affinity.
28
33
/// </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>
29
37
/// <remarks>
30
38
/// If <see langword="true"/>, <see cref="McpSession.SessionId"/> will be null, and the "MCP-Session-Id" header will not be used,
31
39
/// the <see cref="RunSessionHandler"/> will be called once for for each request, and the "/sse" endpoint will be disabled.
32
40
/// 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.
34
42
/// Client sampling and roots capabilities are also disabled in stateless mode, because the server cannot make requests.
35
-
/// Defaults to <see langword="false"/>.
36
43
/// </remarks>
37
44
publicboolStateless{get;set;}
38
45
39
46
/// <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>
41
53
/// 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.
43
55
/// If <see langword="true"/>, handlers will get called with the same <see cref="ExecutionContext"/>
44
56
/// used to call <see cref="ConfigureSessionOptions" /> and <see cref="RunSessionHandler"/>.
45
-
/// </summary>
46
-
/// <remarks>
47
57
/// Enabling a per-session <see cref="ExecutionContext"/> can be useful for setting <see cref="AsyncLocal{T}"/> variables
48
58
/// that persist for the entire session, but it prevents you from using IHttpContextAccessor in handlers.
49
-
/// Defaults to <see langword="false"/>.
50
59
/// </remarks>
51
60
publicboolPerSessionExecutionContext{get;set;}
52
61
53
62
/// <summary>
54
63
/// Gets or sets the duration of time the server will wait between any active requests before timing out an MCP session.
55
64
/// </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>
56
68
/// <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
58
70
/// and should restart their session. A client can keep their session open by keeping a GET request open.
Copy file name to clipboardExpand all lines: src/ModelContextProtocol.AspNetCore/McpEndpointRouteBuilderExtensions.cs
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,12 +15,14 @@ public static class McpEndpointRouteBuilderExtensions
15
15
{
16
16
/// <summary>
17
17
/// 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.
20
18
/// </summary>
21
19
/// <param name="endpoints">The web application to attach MCP HTTP endpoints.</param>
22
20
/// <param name="pattern">The route pattern prefix to map to.</param>
23
21
/// <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>.
0 commit comments