Commit graph

264 commits

Author SHA1 Message Date
Eirik Tsarpalis
283a052e3f
Bump version number to 0.3.0 (#534) v0.3.0-preview.1 2025-06-20 09:17:02 -07:00
Stephen Toub
0e6184a4aa
Add 2025-06-18 as supported version (#529) 2025-06-20 12:03:28 -04:00
Stephen Toub
521bb7bde2
Fix QuickstartClient path (#528)
* Fix QuickstartClient path

* Make dotnet run work instead of F5
2025-06-19 15:35:13 -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
b9b4a23005
Add a callback for receiving stderr output (#525)
* Add a callback for receiving stderr output

* Add asserts to test
2025-06-17 16:03:20 -04:00
Stephen Toub
4e2c1b949f
Fix visibility of polyfill (#523) 2025-06-17 12:43:44 -04: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
Sven Boemer
28d65470f4
Update Microsoft.Extensions.AI version & expose JSON configuration on McpServerResourceCreateOptions (#511)
* Update Microsoft.Extensions.AI version

* Update Microsoft.Extensions.AI.OpenAI

* Fix failing tests; add JSON configuration options to McpServerResourceCreateOptions.

* Replace temporary code with `AIFunction.ReturnJsonSchema`

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-06-13 13:50:14 +01:00
Eirik Tsarpalis
1e8fb04037
Make enums serialize as strings if using the reflection-based serializer. (#473)
* Make enums serialize as strings if using the reflection-based serializer.

* Remove unnecessary partial

* Use an explicit reflection-based converter for enums.

* Update comments

* Make the reflection-based enum converter public.
2025-06-12 18:25:54 +03: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
Eirik Tsarpalis
fa017c04c3
Add structured output/output schema support for server-side tools. (#480)
* Add structured output/output schema support for server-side tools.

* Address feedback.

* Add McpServerToolAttribute.UseStructuredContent

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-06-06 00:20:12 -07:00
Stephen Toub
46d25b7558
Add context to complete requests (#488) 2025-06-05 20:30:00 -07:00
Stephen Halter
c560f47ee6
Remove incorrect acknowledgement from Core README.md (#482) 2025-06-03 15:17:28 -07:00
Stephen Halter
ef7ac8481c
Bump version to 0.2.0-preview.4 2025-06-03 13:43:06 -07:00
Stephen Halter
046903c27b
Don't conflate request and response IDs in Streamable HTTP transports (#475) v0.2.0-preview.3 2025-06-03 12:17:11 -07:00
Stephen Toub
e0b058f260
Improve protocol version handling (#468)
Right now by default, the client and server hardcode the initial spec version, and if there's a mismatch, the request fails.

With this change, by default both client and server are allowed to float to any supported version.
2025-06-02 23:03:57 -04:00
Stephen Halter
703b0fe50b
Add ModelContextProtocol.Core package (#428) 2025-06-02 15:16:45 -07:00
Stephen Toub
57458241b9
Update dependency versions (#474) 2025-05-31 06:07:40 -04:00
Eirik Tsarpalis
888f1711f6
Convert solution to slnx (#472)
* Convert solution to slnx

* Bump sdk version in global.json
2025-05-30 18:19:55 +03:00
Eirik Tsarpalis
47e6a6412e
Convert records to classes (#470)
* Convert records to classes

* Make properties in SseClientTransportOptions settable.

* Convert missing property from init to set
2025-05-30 17:34:36 +03:00
Stephen Toub
5cc7c00456
Add elicitation capability (#467)
* Add elicitation capability
2025-05-29 22:03:03 -04:00
Jeff Handley
36a70a03f8
Bump version to 0.2.0-preview.3 (#465)
https://www.nuget.org/packages/ModelContextProtocol/0.2.0-preview.2 has been published
2025-05-29 21:17:39 +03:00
Eirik Tsarpalis
6351b3dd43
Update documentation of McpJsonUtilities.DefaultOptions. (#463) v0.2.0-preview.2 2025-05-29 07:22:26 -04:00
Stephen Toub
72e7623b11
Set CreateNoWindow=true in RunProcessAndWaitForExit (#462) 2025-05-29 06:53:37 -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
кɵɵѕнī
adb2098e4d
Log tool invocation errors (#447)
* Log tool errors
* add test and implement source generated logging
2025-05-23 14:48:47 -07:00
Eirik Tsarpalis
77f9e64e04
SSE client transport: tolerate return of RPC responses in POST requests. (#445)
* SSE client transport: handle return of RPC responses in POST requests.

* Remove accidental change.

* Address feedback

* Remove unused namespace.
2025-05-23 21:39:54 +03:00
Gavin Luo
ee9b04b7e5
Update README.md (#437)
fix example error
2025-05-20 05:10:29 -07:00
Stephen Halter
d23f442a69
Allow more accept headers (#429) 2025-05-19 17:31:20 -07:00
Andy Gocke
849809771d
Serilog AOT has been fixed as of 4.3.0 (#434)
See https://github.com/serilog/serilog/releases/tag/v4.3.0
2025-05-19 11:57:55 +03:00
Jeff Handley
63df4517fa
Bump version to 0.2.0-preview.2 (#424) 2025-05-16 19:24:22 +03:00
Stephen Toub
9c3ac60819
Remove internal GetBase64Data helper (#422) 0.2.0-preview.1
This can now just use DataContent.Base64Data.
2025-05-16 09:10:50 -04:00
Stephen Toub
915f281658
Fix NRT annotation on StdioClientTransportOptions.EnvironmentVariables (#419) 2025-05-16 00:32:29 -04:00
Stephen Toub
2bbfab1789
Update to stable M.E.AI :) (#421) 2025-05-16 00:31:17 -04:00
Jeff Handley
4a8b7fd6cf
Bump version to 0.2.0-preview.1 (#417) 2025-05-15 10:04:24 -04:00
Stephen Toub
106ab8064f
Clean up namespaces (#410) v0.1.0-preview.14
No meaningful code changes, just lots of namespace shuffling to have fewer namespaces and to put things in better namespaces.
2025-05-14 14:50:26 -04:00
Stephen Toub
c11c634945
Improve exception diagnostics for stdio client (#376)
* Improve exception diagnostics for stdio client

Track the last several lines of stderr and include those in an exception created as part of CleanupAsync if the server process has already exited. This is based on an assumption that the server should never exit prior to CleanupAsync being called.

* Address feedback and fix test failure
2025-05-14 10:46:49 -04:00
Stephen Toub
8d4f51da50
Fix McpServerResource registration (#411)
- Add missing filling of ResourceCollection in McpServerOptionsSetup
- Remove AIFunctionMcpServerXx.ToString overrides; for resources, it was changing behavior undesirably, and for the others it was duplicate code.
- Fix notification method used for resource list changes.
- Fix type in WithResources parameter name.
2025-05-14 09:08:59 -04:00
Stephen Halter
ce9f73f43f
Add stateless Streamable HTTP support (#392)
- It allows a single MCP session spanning multiple requests
  to be handled by different servers without sharing state
- It does require the servers share data protection keys, but this
  is standard for ASP.NET Core cookies and antiforgery as well
- It immediately throws for unsupported operations like sampling
2025-05-14 04:51:03 -07:00
Stephen Toub
ca3a8ab921
Update M.E.AI.Abstractions to 9.5.0-preview.1.25262.9 (#412) 2025-05-14 13:24:24 +03:00
Jeff Handley
4043538285
Bump next version to preview.14 (#403) 2025-05-10 09:18:46 -07:00
Jeff Handley
b460a0f091
Make small corrections to release process docs (#402)
The 'auto' selection for the previous tag has been working well. And this also fixes a typo.
2025-05-10 09:03:28 -07:00
Stephen Toub
61092e0266
Update to latest M.E.AI version (#401) v0.1.0-preview.13 2025-05-10 07:53:04 -04:00
Stephen Toub
26c3622101
Use WithResources in EverythingServer sample (#400) 2025-05-10 06:13:42 -04:00
Stephen Toub
d86b3277d4
Add McpServer/ClientResource{Template} and friends (#391)
* Add McpServer/ClientResource{Template} and friends

This PR copies the same design used by tools and prompts to add McpServerResource, McpServerResourceAttribute, McpServerResourceTypeAttribute, McpClientResource, and then all of those for ResourceTemplate as well.

Unlike the others, [McpServerResource] is permitted not only on methods but also on properties. This convenience is afforded because such resources aren't parameterized, and thus can be easily modeled as properties, likely auto-props, e.g.
```C#
[McpServerResource]
public static BlobResourceContents MyAmazingData { get; } = Create();
```

Details about resources can be encoded into the attributes or provided via McpServerResource{Template}.Create methods. If not URI is explicitly defined, one is derived from the member name and arguments. For templates, this means manufacturing a URI template that includes variables for all non-DI parameters.

This also fixes a few issues discovered along the way:
- McpClientExtensions are updated to use `ValueTask<T>` instead of `Task<T>` where relevant.
- McpServerPrompt was missing handling for progress notifications; that's been rectified. It was also missing configuring the description on the ProtocolPrompt.
- Renamed IMcpServerPrimitive.Name to Id. For resources, names aren't unique.
- After going back and forth, updated McpServer to not fail for missing handlers and to instead register default handlers. It simplifies the implementation and makes it more consistent.
- Added a bunch of primitive types into the McpJsonUtilities JSON source generator context so that such primitives are usable with tools/prompts/resources without folks being required to add them into their own context for Native AOT. I think we should consider pushing this down to AIJsonUtilities, instead, and that will then flow up to McpJsonUtilities automatically.

* Address feedback
2025-05-09 18:21:11 -04:00
Astaggrock
47de86ab91
Set IsError on CallToolResponse to true when result is ErrorContent (#394)
* Set IsError on CallToolResponse to true when result is ErrorContent

* Updated the `IsError` determination for a list of AIContent to require that all items in `contentItems` are instances of `ErrorContent` and that the collection is not empty

* Introduce ConvertAiContentEnumerableToCallToolResponse to transform an IEnumerable<AIContent> into a CallToolResponse

* Move location of ConvertAIContentEnumerableToCallToolResponse helper function

---------

Co-authored-by: Andy Tagg <antagg@microsoft.com>
2025-05-08 23:15:58 -04:00
Stephen Halter
c750f09e97
Bump version to v0.1.0-preview.13 2025-05-05 15:46:42 -07:00
Stephen Halter
bac97efec6
Remove batching support from StreamableHttpServerTransport (#372) v0.1.0-preview.12 2025-05-01 15:48:53 -07:00
Stephen Toub
b743889987
Update System and M.E.AI dependencies (#374) 2025-05-01 11:25:17 -04:00