* Fix stdio client transport CLI argument escaping.
* Fix failing Windows test.
* Add more test cases and refine escaping logic.
* Fix test failures in mono
* Style fixes
* Tweak stdio test
* Tweak tests further
* 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
* 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
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.
* Separate ASP.NET Core tests into a distinct project and make the main test project netfx compatible.
* Fix merge conflicts.
* Update tests/ModelContextProtocol.Tests/ModelContextProtocol.Tests.csproj
Co-authored-by: Stephen Halter <halter73@gmail.com>
* Revert "Fix merge conflicts."
This reverts commit 852169b96786bad2144795540fa164e20b4b197e.
* Fix merge conflicts
---------
Co-authored-by: Stephen Halter <halter73@gmail.com>
* Move notification handler registrations to capabilities
Currently request handlers are set on the capability objects, but notification handlers are set after construction via an AddNotificationHandler method on the IMcpEndpoint interface. This moves handler specification to be at construction as well. This makes it more consistent with request handlers, simplifies the IMcpEndpoint interface to just be about message sending, and avoids a concurrency bug that could occur if someone tried to add a handler while the endpoint was processing notifications.
* Address more feedback and further cleanup
* Allow user-defined JsonSerializerOptions for user-defined and inputs and hardcode everything else to the source generator.
* Add validation for user-defined JsonSerializerOptions.
* Remove out of date comment.
* Address feedback and add tests
* Supporting resource templates with read resource callback
Fixes#123
* Aligning the resource data structures with the 2024-11-05 schema
- Introducing separate classes for Text and Blob ResourceContents
- Custom JSON converter to allow those types to be returned, making it easier to follow the type system against the spec
- Updated tests
* Apply suggestions from code review
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Peder Holdgaard Pedersen <127606677+PederHP@users.noreply.github.com>
* Putting files back where they belong
* Adding an internal constructor to prevent overloads
* Addressing feedback
* Apply suggestions from code review
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Update src/ModelContextProtocol/Protocol/Types/ResourceContents.cs
* Addressing feedback
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Peder Holdgaard Pedersen <127606677+PederHP@users.noreply.github.com>
- This also paves the way for better multi-session support
- We should definitely rethink names for the transport API
- For now, I kept the names similar as possible, so we can
focus on the API shape
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Add initial support for Resource Templates
* Make ListResourceTemplatesHandler not required
The server was throwing if this handler wasn't specified, and it should probably be optional anyway.
* Remove extra line
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix spaces
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix spaces
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Add and use a default ListResourceTemplatesHandler
If no ListResourceTemplatesHandler is specified, use a default one that returns an empty result.
* Fix spaces
* Spaces
* Add Client extensions for ListResourceTemplates
* Integration Test for Client ListResourceTemplates
* Fix comment
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Make Defaults internal
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Simplify test call
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Make delegate static
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Fix test comment
* Spaces
* Fix xml doc
Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Make default handler inline
* Spaces
Co-authored-by: Stephen Halter <halter73@gmail.com>
---------
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Halter <halter73@gmail.com>
* Change type of Tool.InputSchema to be JsonElement
* Add schema validation in the InputSchema property setter.
* Simplify AIFunction tool adapter.
---------
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>