Fix AspNetCore README (#170)

* Use Cache-Control: no-store

* Fix AspNetCore README

* remove and sort
This commit is contained in:
Stephen Halter 2025-03-31 13:17:17 -07:00 • committed by GitHub
commit ce89fa0b50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -40,7 +40,7 @@ public static class McpEndpointRouteBuilderExtensions
var requestAborted = context.RequestAborted;
response.Headers.ContentType = "text/event-stream";
response.Headers.CacheControl = "no-cache";
response.Headers.CacheControl = "no-store";
var sessionId = MakeNewSessionId();
await using var transport = new SseResponseStreamTransport(response.Body, $"/message?sessionId={sessionId}");
@ -53,10 +53,10 @@ public static class McpEndpointRouteBuilderExtensions
try
{
var transportTask = transport.RunAsync(cancellationToken: requestAborted);
runSession ??= RunSession;
try
{
runSession ??= RunSession;
await runSession(context, server, requestAborted);
}
finally

View file

@ -23,15 +23,16 @@ To get started, install the package from NuGet
```
dotnet new web
dotnet add package ModelContextProtocol.AspNetcore --prerelease
dotnet add package ModelContextProtocol.AspNetCore --prerelease
```
## Getting Started
```csharp
// Program.cs
using ModelContextProtocol;
using ModelContextProtocol.AspNetCore;
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(options =>