Skip to content

Commit 467a086

Browse files
committed
Fix race in ConnectAndReceiveNotification_InMemoryServer test
- Go back to not processing messages until IMcpServer.RunAsync is called - style: consistently use mcpServer from parameter rather than features Failed test run: https://github.com/modelcontextprotocol/csharp-sdk/actions/runs/14299175970/job/40070612363?pr=225
1 parent a9a4b8e commit 467a086

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

tests/ModelContextProtocol.Tests/SseIntegrationTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public async Task ConnectAndReceiveNotification_InMemoryServer()
7777
mcpServer.RegisterNotificationHandler("test/notification", async (notification, cancellationToken) =>
7878
{
7979
Assert.Equal("Hello from client!", notification.Params?["message"]?.GetValue<string>());
80-
var server = httpContext.Features.GetRequiredFeature<IMcpServer>();
81-
await server.SendNotificationAsync("test/notification", new { message = "Hello from server!" }, cancellationToken: cancellationToken);
80+
await mcpServer.SendNotificationAsync("test/notification", new { message = "Hello from server!" }, cancellationToken: cancellationToken);
8281
});
8382
return mcpServer.RunAsync(cancellationToken);
8483
});

0 commit comments

Comments
 (0)