Commit graph csharp-sdk/tests/ModelContextProtocol.AspNetCore.Tests
Author SHA1 Message Date
Mike Kistler
14f9735c19
Add client conformance tests (#1102)
Co-authored-by: Stephen Halter <halter73@gmail.com>
2026-01-09 07:26:50 -06:00
Copilot
8b73a42c9d
Remove private reflection from tests (#1107)
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>
2025-12-16 21:20:42 +02:00
Copilot
aaffd71c69
Fix session timeout due to timestamp frequency mismatch and activity tracking (#1106)
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: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
2025-12-15 16:21:21 -05:00
Peder Holdgaard Pedersen
9bbae84c9b
Resource subscribe should be true if handler provided (#676)
Co-authored-by: Stephen Halter <halter73@gmail.com>
Co-authored-by: Mike Kistler <mikekistler@microsoft.com>
2025-12-11 20:41:43 -08:00
Stephen Halter
31f8d20a1a
Support incremental scope consent (SEP-835) (#1084) 2025-12-11 19:51:47 -08:00
Stephen Halter
970207989e
Fall back to well-known URL in client if 401 response is missing resource_metadata parameter (#1054) 2025-12-05 14:12:51 -08:00
Stephen Toub
4a84412331
Add McpClient/Session methods using .Protocol types (#1063) 2025-12-05 13:45:12 -05:00
Mike Kistler
c447973972
Add request options bag to high level requests and include Meta (#970)
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-04 17:32:12 -05:00
Mike Kistler
f45996d4b5
Add Conformance tests for the server (#983) 2025-11-25 17:20:18 -08:00
Mackinnon Buck
5a65af8ed7
Add support for Client ID Metadata Documents to enable URL-based client registration (#1023) 2025-11-25 16:17:47 -08:00
Stephen Halter
7f25ae9d2a
Add ability for client to resume session (#1029) 2025-11-25 14:31:10 -08:00
Manuel Naujoks
820821fa0c
Tokens can be cached beyond the lifetime of the (http) transport. (#834) 2025-11-24 17:56:56 -08:00
Stephen Halter
707c083c65
Revert "Update to MTP (#958)" (#1011) 2025-11-21 14:53:16 -08:00
Youssef Victor
c94cb895a7
Revert "Revert "Update to MTP"" (#990) 2025-11-21 15:28:42 +02:00
Stephen Toub
15139cc569
Add tools support to sampling (#976) 2025-11-20 09:52:23 -05:00
Eirik Tsarpalis
bf0a65b3e3
Revert "Update to MTP (#958)" (#989)
This reverts commit 7080e3a621.
2025-11-19 18:48:33 +02:00
Mackinnon Buck
d540dc1fb1
Make RequestId non-required (#984) 2025-11-18 16:03:31 -08:00
Youssef Victor
7080e3a621
Update to MTP (#958)
* Update to MTP

* Drop GitHubActionsTestLogger, better test output, and update dependabot.yml

* Keep cobertura

* Fix Makefile
2025-11-18 15:06:09 +02:00
Stephen Halter
b9c9f44e06
Fix tests in Dev Container (#965) 2025-11-17 11:48:18 -05:00
Mackinnon Buck
121929da36
Audit protocol types (#892) 2025-11-04 15:41:10 -08:00
Copilot
8f2e21d734
Fix: Synthesize handlers for empty tool/prompt/resource collections (#865)
* Initial plan

* Allow handlers for empty tool/prompt/resource collections

Changed condition from `IsEmpty: false` to `not null` check in McpServerImpl.cs for resources (line 298), prompts (line 459), and tools (line 547). This allows handlers to be synthesized even when collections are empty, enabling dynamic addition of items after initialization.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-10-16 09:57:50 -04:00
Stephen Toub
bfc0980ef5
Add net10.0 assets and run some fixers (#875) 2025-10-15 15:27:43 -04:00
Stephen Halter
3255adb4d6
Propagate tool call exceptions through filters (#844)
* Add McpProtocolException specifically for JSON-RPC errors
2025-10-14 19:10:55 -07:00
Stephen Halter
e01edc143a
Fix slow shutdown when a Streamable HTTP client is connected (#843)
* Add "Async" suffix to async methods
2025-10-10 17:50:57 -07:00
Eirik Tsarpalis
93834d1aec
Fix support for sending server notifications with request-specific McpServer instances used outside their original scope. (#832)
* Fix support for sending server notifications with request-specific McpServer instances used outside their original scope.

* Address feedback.

* Update src/ModelContextProtocol.Core/Server/SseWriter.cs
2025-10-06 18:50:33 +03:00
Stephen Halter
47b9582fd7
Make "Stateless" mode sessionless (#760)
- This removes the requirement to configure data protection which is the motivating reason for this change
- This means that McpServer.ClientInfo will always be null in stateless mode
2025-10-02 15:57:01 -07:00
Stephen Halter
740a7d0346
Move options validation to constructor (#826)
This works around the breaking change to BackgroundService in
https://github.com/dotnet/runtime/pull/116283 which launches
ExecuteAsync using Task.Run.
2025-10-02 12:38:13 -07:00
Eirik Tsarpalis
7628b3064f
Onboard repo to the .NET 10 sdk (#822)
* Onboard repo to the .NET 10 sdk

* Remove redundant property.

* Remove console logger

* Disabling failing tests in .NET 10.
2025-09-30 20:36:12 +03:00
David Cantú
5f992994c3
Decouple Handlers and Collections from protocol types (#765)
* Decouple Handlers and Collections (e.g. ToolsHandler and ToolsCollection) from Capabilities by promoting them to the options types.

Also, group all handlers in container classes, for server, I decided to move McpServerHandlers down to Mcp.Core and move the NotificationHandlers there too.

Also, Fix ListResourceTemplatesHandler issue.

* Add remarks for empty protocol capability types

* Keep JsonIgnore properties and mark them as Obsolete

* Continue supporting Obsolete members

* Update Obsolete messages to indicate the member will be removed

* Add EditorBrowsable Never to the remaining obsolete members
2025-09-24 09:42:03 -05:00
Eirik Tsarpalis
7cfe0ef621
Add McpSessions.NegotiatedProtocolVersion property. (#794) 2025-09-19 13:11:01 +03:00
Mackinnon Buck
38b4a26998
Restructure IMcpEndpoint, IMcpClient, and IMcpServer (#723)
* Remove `McpEndpoint` & `IMcpClient`

* Revise naming, add abstract classes

* Fix missing renames

* Move extension methods to instance methods

* Add back old API, but obsoleted

* Add back obsoleted factory classes

* Move deprecation attributes

* `SseClientTransport` -> `HttpClientTransport`

* Update src/ModelContextProtocol.Core/Server/AugmentedServiceProvider.cs

Co-authored-by: Stephen Halter <halter73@gmail.com>

* PR feedback

* PR feedback

* Add back dispose lock

* Fix docs projects

* PR feedback

* Undo `docs/*.md` changes

---------

Co-authored-by: Stephen Halter <halter73@gmail.com>
2025-09-16 10:22:10 -07:00
Stephen Halter
d344c65120
Add middleware and authz support for server-side handlers (#733) 2025-09-10 10:07:45 -07:00
S-Luiten
f9129f5b28
Improvements to dynamic client registration (#609)
* Add a delegate for handling the dynamic client registration response.
* Support passing an initial access token for dynamic client registration.
2025-08-26 14:24:00 -07:00
Stephen Halter
b067261ca7
Prune idle sessions before starting new ones (#701) 2025-08-18 11:04:27 -07:00
Stephen Halter
f53e0d2132
Respect HandleResponse() and SkipHandler() calls in OnResourceMetadataRequest (#607) 2025-07-17 17:39:05 -07:00
Stephen Halter
a88ef0deb7
Flow ExecutionContext with JsonRpcMessage (#616)
The primary goal of this change is to support IHttpContextAccessor in tool calls when the Streamable HTTP is in its default non-Stateless mode.
2025-07-15 13:58:43 -07:00
David Parks
984aa9ae1b
fix: Prevent crash when Options.ResourceMetadata is null but handled by event (#603) 2025-07-09 12:05:00 -07:00
Den Delimarsky 🌺
cdf88e7f5d
Authorization Support (Using ASP.NET Core Native AuthN/AuthZ Integration) (#377) 2025-07-03 14:39:28 -07:00
Stephen Toub
4411f1ce5e
Change default name casing of McpServerXx.Create tools/prompts/resources (#568) 2025-07-01 16:40:42 -04:00
Stephen Toub
ab51400ba0
Make CallToolResult.IsError optional (#573)
Match the spec, and avoid sending the property in the success case.
2025-06-30 11:35:07 -04:00
Eirik Tsarpalis
55bda787ae
Styling: remove a few redundant parens from object initializer expressions. (#548)
* Styling: remove a few redundant parens from object initializer expressions.

* Fix build error.
2025-06-26 16:55:54 +03:00
Stephen Toub
0e6184a4aa
Add 2025-06-18 as supported version (#529) 2025-06-20 12:03:28 -04:00
Stephen Halter
a4b4edaa2a
Send DELETE request when closing a Streamable HTTP session on the client (#501) 2025-06-19 08:40:11 -07:00
Stephen Halter
befa31d5c9
Send MCP-Protocol-Version header in Streamable HTTP client transport (#500) 2025-06-17 14:27:26 -07:00
Stephen Toub
2bcff315f8
Update content according to latest spec (#513)
* Update content according to latest spec

* Add Title to a bunch of types

* Add _meta to lots of types

* Address feedback, more cleanup, fix NAOT test failure
2025-06-16 19:39:41 -04:00
Eirik Tsarpalis
d7d9eab3f8
Pass session id's to MCP endpoints. (#466)
* Pass session id's to MCP endpoints.

* Update src/ModelContextProtocol/Client/McpClient.cs

Co-authored-by: Stephen Halter <halter73@gmail.com>

* Update src/ModelContextProtocol.AspNetCore/StreamableHttpHandler.cs

Co-authored-by: Stephen Halter <halter73@gmail.com>

* Make init callback asynchronous.

* Address feedback.

---------

Co-authored-by: Stephen Halter <halter73@gmail.com>
2025-06-12 17:56:57 +03:00
Stephen Halter
046903c27b
Don't conflate request and response IDs in Streamable HTTP transports (#475) 2025-06-03 12:17:11 -07:00
Stephen Halter
703b0fe50b
Add ModelContextProtocol.Core package (#428) 2025-06-02 15:16:45 -07:00
Stephen Toub
5cc7c00456
Add elicitation capability (#467)
* Add elicitation capability
2025-05-29 22:03:03 -04:00
Stephen Halter
317f468807
Automatically fall back from Streamable HTTP to SSE on the client by default (#456) 2025-05-28 11:06:58 -07:00