Skip to content

Commit a231d9a

Browse files
jeffhandleyCopilot
andcommitted
Add SSE server code example to transports documentation
The SSE server section had prose but no code example. Add a minimal example showing that MapMcp() serves both Streamable HTTP and legacy SSE, with comments clarifying that SSE clients connect to /sse. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 551db0d commit a231d9a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/concepts/transports/transports.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,21 @@ SSE-specific configuration options:
175175

176176
The ASP.NET Core integration supports SSE transport alongside Streamable HTTP. The same `MapMcp()` endpoint handles both protocols — clients connecting with SSE are automatically served using the legacy SSE mechanism:
177177

178+
```csharp
179+
var builder = WebApplication.CreateBuilder(args);
180+
181+
builder.Services.AddMcpServer()
182+
.WithHttpTransport()
183+
.WithTools<MyTools>();
184+
185+
var app = builder.Build();
186+
187+
// MapMcp() serves both Streamable HTTP and legacy SSE.
188+
// SSE clients connect to /sse (or {route}/sse for custom routes).
189+
app.MapMcp();
190+
app.Run();
191+
```
192+
178193
No additional configuration is needed. When a client connects using the SSE protocol, the server responds with an SSE stream for server-to-client messages and accepts client-to-server messages via a separate POST endpoint.
179194

180195
### Transport mode comparison

0 commit comments

Comments
 (0)