Skip to content

Commit aa0be80

Browse files
committed
Add content and example for http/sse endpoints and routes
1 parent 4cdb9a2 commit aa0be80

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/concepts/transports/transports.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ await using var client = await McpClient.ResumeSessionAsync(transport, new Resum
113113

114114
#### Streamable HTTP server (ASP.NET Core)
115115

116-
Use the `ModelContextProtocol.AspNetCore` package to host an MCP server over HTTP:
116+
Use the `ModelContextProtocol.AspNetCore` package to host an MCP server over HTTP. The <xref:ModelContextProtocol.AspNetCore.McpEndpointRouteBuilderExtensions.MapMcp*> method maps the Streamable HTTP endpoint at the specified route (root by default). It also maps legacy SSE endpoints at `{route}/sse` and `{route}/message` for backward compatibility.
117117

118118
```csharp
119119
var builder = WebApplication.CreateBuilder(args);
@@ -127,6 +127,16 @@ app.MapMcp();
127127
app.Run();
128128
```
129129

130+
A custom route can be specified. For example, the [AspNetCoreMcpPerSessionTools] sample uses a route parameter:
131+
132+
[AspNetCoreMcpPerSessionTools]: https://github.com/modelcontextprotocol/csharp-sdk/tree/main/samples/AspNetCoreMcpPerSessionTools
133+
134+
```csharp
135+
app.MapMcp("/mcp");
136+
```
137+
138+
When using a custom route, Streamable HTTP clients should connect directly to that route (e.g., `https://host/mcp`), while SSE clients should connect to `{route}/sse` (e.g., `https://host/mcp/sse`).
139+
130140
See the `ModelContextProtocol.AspNetCore` package [README](https://github.com/modelcontextprotocol/csharp-sdk/blob/main/src/ModelContextProtocol.AspNetCore/README.md) for more configuration options.
131141

132142
### SSE transport (legacy)

0 commit comments

Comments
 (0)