Commit graph csharp-sdk/tests
Author SHA1 Message Date
Copilot
25f080115d Apply review feedback: replace _getHttpResponseCompleted with _disposed; rewrite test
- Remove _getHttpResponseCompleted and rely on _httpSseWriter being null as the signal that the GET response stream has been released. Null out _httpSseWriter in DisposeAsync so SendMessageAsync correctly skips writing post-dispose.
- Replace the dispose-idempotency role of the old flag with a dedicated _disposed bool.
- Move the explanatory comment in SendMessageAsync onto the event store branch (which intentionally still runs when the response stream is gone, to support Last-Event-ID replay).
- Rewrite the unit test to assert observable behavior via a recording Stream instead of reflecting on private fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-05 16:52:49 -07:00
Joel Forsyth
4d011995d1 Release SSE response stream reference when GET request ends
StreamableHttpServerTransport held a reference to the Kestrel SSE
response stream via _httpSseWriter for the entire session lifetime.
Since the transport is only disposed when the session itself is disposed
(via explicit DELETE or idle timeout), clients that disconnect without
sending DELETE — which is typical for long-lived SSE connections — left
the response stream pinned for the remainder of the idle timeout window.

Because the Kestrel HTTP connection (and its associated memory pool
buffers, Pipe readers/writers, socket send/receive buffers) is only
collectible once all references to the response stream are released,
this pinned ~20MiB of unmanaged memory per disconnected session until
cleanup. Under steady connect/disconnect churn (e.g., IDE availability
probes) this accumulated into sustained memory growth that eventually
OOMKilled the container.

Fix: release _httpSseWriter from within HandleGetRequestAsync's finally
block so the reference is dropped as soon as the GET request exits, not
just when the session is disposed. SendMessageAsync handles the
now-nullable field via the existing _getHttpResponseCompleted gate, and
any server-to-client messages sent after disconnect are still captured
by the event store writer for replay via Last-Event-ID.

Add a unit test that verifies _httpSseWriter is null once
HandleGetRequestAsync returns.

Relates to #766.
2026-06-05 16:52:49 -07:00
Aniket Anil Kumar
96a3ddff69 feat: Add Enterprise Managed Authorization (SEP-990) support (#1305) 2026-06-03 16:34:59 -07:00
Stephen Halter
453132009a Validate user on Streamable HTTP session DELETE (#1604) 2026-06-03 02:00:35 -07:00
Copilot
8fdfe581b6 Stop logging stdio transport environment variables (#1538) 2026-06-03 01:58:52 -07:00
Stephen Halter
d34fac48d5 Add InheritEnvironmentVariables to StdioClientTransportOptions (#1563) 2026-06-03 01:58:35 -07:00
Jeff Handley
2c5d1ed2be
Document and demonstrate allowed hosts and CORS policy guidance (#1554)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Stephen Halter <halter73@gmail.com>
2026-05-01 19:03:30 -07:00
Jayaraman Venkatesan
07435dcb16
Fix stateless HTTP transport advertising listChanged capability (#1509) 2026-04-09 14:30:12 -07:00
Eric StJohn
2e7209c35a
Fix process crash when testing Stderr (#1449)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-06 11:29:00 -07:00
Eric StJohn
d4c588b2f5
Fix flaky OutgoingFilter_MultipleFilters_ExecuteInOrder test (#1488)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-02 09:27:37 -07:00
Copilot
7662ce6b70
Make ClientTransportClosedException public and unify transport exception handling (#1467)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-03-29 20:21:03 -04:00
Stephen Halter
8eb4023c20
Add stateless doc, prefer stateless mode and disable legacy SSE by default (#1468) 2026-03-27 13:56:16 -07:00
Copilot
49bf17077d
Fix WithMeta + WithProgress causing tool invocation failure (#1464)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-03-27 15:41:58 -04:00
Copilot
cf63f0e42b
Fix: create per-task DI scope in ExecuteToolAsTaskAsync to prevent ObjectDisposedException (#1433)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-03-27 15:41:53 -04:00
Copilot
7dcdbafe9d
Add 3-arg RequestContext constructor and obsolete 2-arg to eliminate null-forgiving operator usage (#1462) 2026-03-27 12:33:23 -07:00
Stephen Halter
afc40d1e2e
Route SendRequestAsync logic through outgoing message filters (#1465) 2026-03-27 09:09:45 -07:00
Copilot
2958a75894
Support specifying OutputSchema independently of return type for tools returning CallToolResult (#1425)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-22 21:19:29 -04:00
Copilot
89fcf3f8b7
Wait for in-flight message handlers before ProcessMessagesCoreAsync returns (#1403)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-03-02 18:59:02 -05:00
Stephen Toub
b965a7eca6
Add client completion notification and details (#1368)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-02 09:17:22 -05:00
Copilot
4af2596019
Auto-populate completion handlers from AllowedValuesAttribute on prompt/resource parameters (#1380)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-03-01 13:41:00 -05:00
Copilot
94aa6952eb
Fix Extensions not being copied to ServerCapabilities during initialization (#1399)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-27 19:36:15 -05:00
Copilot
919e8383f0
Register ping handler in McpSessionHandler to support server-initiated pings (#1391)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-26 18:53:20 -05:00
Copilot
84cd6917bb
Mark RunSessionHandler experimental (MCPEXP002) (#1383)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
2026-02-24 15:02:34 -08:00
Jeff Handley
4e68a4e9ec
Add 2025-03-26 OAuth backward compatibility for client conformance (#1374)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-24 15:01:40 -08:00
Mackinnon Buck
669c36b229
Unify service configuration for ISseEventStreamStore, IMcpTaskStore, and ISessionMigrationHandler (#1362) 2026-02-23 23:22:59 -08:00
Copilot
8c46411f82
Fix McpClientPrompt/Resource types to use RequestOptions like McpClientTool does (#1370)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 23:40:54 -05:00
Copilot
124b43b5c1
Add explicit [Experimental] protected constructors to McpClient and McpServer (#1363)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
2026-02-23 21:37:39 -05:00
Copilot
ce2a5e4a4b
Fix CreateMessageRequestParams.Metadata type to JsonObject (#1354)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-23 18:08:03 -05:00
Copilot
0a0a575a3d
Normalize CallToolResult.StructuredContent to JsonElement? (#1357)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-23 18:04:09 -05:00
Copilot
a2ee0c805a
Address asymmetry in McpServerHandlers/McpClientHandlers and make all filter properties settable (#1337)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-23 15:51:37 -05:00
Copilot
4f7095453c
Prevent cancellation of initialize request per MCP spec (#1350)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 15:40:17 -05:00
Copilot
e7b779ac8a
Add CloneResourceMetadataClonesAllProperties test using public reflection (#1343)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-23 14:24:36 -05:00
Copilot
774a1dba35
Fix base64 deserialization when JSON encoder escapes forward slashes (#1342)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 14:20:25 -05:00
Copilot
74622d0c9c
Remove server back-references from protocol DTO types (#1345)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-23 14:17:54 -05:00
Copilot
2c9bb5d368
Fix off-by-one error in reconnection attempts (#1356)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 11:38:47 -05:00
Copilot
571e4dc127
Make LoggingMessageNotificationParams.Data required per MCP spec (#1353)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 11:37:35 -05:00
Copilot
9b5d0fe80a
Make Tool.Name required to match other protocol types (#1351)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-23 11:33:01 -05:00
Copilot
2960f6116d
Fix flaky sse-retry conformance test due to CI timing overhead (#1336)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
2026-02-21 12:18:34 -05:00
Copilot
d429b0bf64
Fix _meta properties to use JsonObject (#1341)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-21 07:54:06 -05:00
Copilot
c2aa6a5123
Add Extensions support to ClientCapabilities and ServerCapabilities (#1317)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-21 00:08:20 -08:00
Copilot
79b2dbeb20
Fix Metadata delegation in DelegatingMcpServerTool/Prompt/Resource (#1338)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: jeffhandley <1031940+jeffhandley@users.noreply.github.com>
2026-02-21 00:36:30 -05:00
Copilot
5c35ea9207
Replace concrete collection types with interfaces in public API surface (#1326)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-19 19:48:45 -08:00
Copilot
539481f999
Validate mimeType in ImageContentBlock.FromBytes and AudioContentBlock.FromBytes (#1321)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-20 03:47:08 +00:00
Copilot
3727dc4aaa
Omit null mimeType from ResourceContents JSON serialization (#1325)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2026-02-20 03:46:56 +00:00
Copilot
54283a8590
Add missing Title and Icons properties to ResourceLinkBlock (#1320)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-20 03:46:45 +00:00
Copilot
d9ae6bc266
Fix flaky DiagnosticTests on net10.0 by waiting for specific activities (#1324)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
2026-02-19 19:42:45 -08:00
Stephen Halter
d21aa9e5a2
Split configuration of request and message filters (#1308)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-19 17:42:35 -08:00
Mackinnon Buck
27a3196c7f
Add ISessionMigrationHandler (#1270) 2026-02-19 15:31:34 -08:00
Stephen Halter
411cef6ab0
Don't treat McpServerHandlers as an independent options type (#1313) 2026-02-19 14:45:51 -08:00
Copilot
80b1ad21d7
Use ReadOnlyMemory<byte> for binary data to eliminate UTF-16 transcoding (#1070)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: ericstj <8918108+ericstj@users.noreply.github.com>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
2026-02-19 14:08:05 -08:00