Commit graph

351 commits

Author SHA1 Message Date
Stephen Toub
e7b403b820
Fix comments on McpServerTool/Prompt/Resource (#866)
They were a bit out of date with the implementation.

Co-authored-by: Stephen Halter <halter73@gmail.com>
2025-10-14 23:44:09 -04:00
Stephen Halter
1f97301182
Pin GitHub workflows to rc.1 SDK (#871)
* Pin GitHub workflows to rc.1 SDK

* Make src/* change to force PR tests

* Add global.json to paths that trigger PR tests
2025-10-14 22:53:10 -04:00
Stephen Halter
2ec3ceba5c
Pin global.json to rc.1 SDK (#869) 2025-10-14 22:14:14 -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 Toub
2c9558cf21
Remove unnecessary System.Net.Http dependency from tests (#867)
It's started producing a warning-as-error about not getting pruned.
2025-10-14 16:42:59 -07:00
Copilot
b40f06c043
Fix markdown links in docs and add docfx CI validation (#862)
* Initial plan

* Replace obsolete API references with xref tags in markdown docs

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Add documentation guidelines for xref syntax

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Fix: Only update link URLs, preserve document structure

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Add --warningsAsErrors flag to docfx command in Makefile

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Add CI validation for document generation

* Fix broken link

* Fix invalid xref cross-references in documentation

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Apply suggestion from @eiriktsarpalis

* Fix Progress link syntax and remove docs/README.md

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Separate build & test targets

* Apply suggestion from @eiriktsarpalis

* tweak Makefile

* Fix test results upload path

* Add emojis to CI workflow step names

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* perform manual cleanups

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-10-14 17:24:32 +03:00
Copilot
c40effebc4
✨ Set up Copilot instructions for repository (#858)
* Initial plan

* Add Copilot instructions for repository

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>

* Apply suggestions from code review

* Refocus instructions on library implementation and architecture

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>

* Add key types and architectural layers documentation

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>

* Fix markdown link formatting for link checker

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>

* Add explicit build and test requirements to instructions

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>

* Apply suggestions from code review

---------

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>
2025-10-13 21:52:07 -04:00
Copilot
31339f31d9
Fix sample projects to work in GitHub Codespaces by installing .NET 9.0 SDK (#854)
* Initial plan

* Update global.json to use .NET 9.0 SDK for GitHub Codespaces compatibility

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Revert global.json and update devcontainer.json to install both .NET 9 and 10

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Fix devcontainer.json to use additionalVersions for multiple .NET SDKs

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
2025-10-13 21:42:50 +03:00
dependabot[bot]
d22c5f0485
Bump actions/download-artifact from 4.2.1 to 5.0.0 (#849)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.2.1 to 5.0.0.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](95815c38cf...634f93cb29)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 18:04:03 +03:00
dependabot[bot]
f006ff9f5d
Bump actions/checkout from 4.2.2 to 5.0.0 (#851)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.2 to 5.0.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...08c6903cd8)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 17:27:39 +03:00
dependabot[bot]
8ea69b8e37
Bump becheran/mlc from 0.21.0 to 1.0.0 (#852)
Bumps [becheran/mlc](https://github.com/becheran/mlc) from 0.21.0 to 1.0.0.
- [Release notes](https://github.com/becheran/mlc/releases)
- [Changelog](https://github.com/becheran/mlc/blob/master/CHANGELOG.md)
- [Commits](c925f90a9a...18a06b3aa2)

---
updated-dependencies:
- dependency-name: becheran/mlc
  dependency-version: 1.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 17:27:10 +03: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
dependabot[bot]
d914581471
Bump actions/setup-dotnet from 4.3.1 to 5.0.0 (#846)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 4.3.1 to 5.0.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](67a3573c9a...d4c94342e5)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 16:24:05 -07:00
dependabot[bot]
acf78c70d7
Bump danielpalme/ReportGenerator-GitHub-Action from 5.4.4 to 5.4.17 (#847)
Bumps [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/reportgenerator-github-action) from 5.4.4 to 5.4.17.
- [Release notes](https://github.com/danielpalme/reportgenerator-github-action/releases)
- [Commits](https://github.com/danielpalme/reportgenerator-github-action/compare/5.4.4...5.4.17)

---
updated-dependencies:
- dependency-name: danielpalme/ReportGenerator-GitHub-Action
  dependency-version: 5.4.17
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 16:23:52 -07:00
dependabot[bot]
1860f3b859
Bump actions/upload-pages-artifact from 3.0.1 to 4.0.0 (#848)
Bumps [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) from 3.0.1 to 4.0.0.
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](56afc609e7...7b1f4a764d)

---
updated-dependencies:
- dependency-name: actions/upload-pages-artifact
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 16:23:39 -07:00
dependabot[bot]
6883f3b943
Bump actions/setup-node from 4.3.0 to 5.0.0 (#845)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4.3.0 to 5.0.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](cdca7365b2...a0853c2454)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 5.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 16:23:12 -07:00
Copilot
564f21073c
Onboard repository to Dependabot for automated testing and AI dependency updates (#800)
* Initial plan

* Add Dependabot configuration for automated dependency updates

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Add Dependabot documentation and complete onboarding

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Refactor Dependabot config to only update testing dependencies and remove documentation

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Remove redundant allow list and use groups + ignore instead

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Use wildcard patterns in ignore list for cleaner configuration

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Add Microsoft.Extensions.AI group and remove from ignore list

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Update .github/dependabot.yml

* Move microsoft-extensions-ai group to top of groups section

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Update .github/dependabot.yml

* Update .github/dependabot.yml

* Remove packages with fixed version strings from dependency groups

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* remove Microsoft.Extensions packages

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-10-10 17:37:11 +03:00
Copilot
f28639119b
Implement SEP-973: Icons and metadata support for Implementations, Resources, Tools, and Prompts (#802)
* Initial plan

* Initial plan for SEP-973 implementation

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Implement SEP-973: Add Icon class and icon support to Implementation, Resource, Tool, and Prompt

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Complete SEP-973 implementation with documentation and fix property consistency

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Address code review feedback: improve tests, remove docs, split test files

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Fix tests to use S.T.J. source generator

* Styling fixes

* Simplify Icons property documentation as suggested in code review

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Rename Icon.Src property to Icon.Source for more .NET-y naming

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Add icon support to McpServerTool infrastructure and attributes

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Cleanup

* Refactor icon tests to use Delegate overload instead of MethodInfo pattern

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Change Icon.Sizes property from string to IList<string> per spec update

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>

* Add icon support to Prompts and Resources (CreateOptions and Attributes)

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Add client-server integration tests for Icons and WebsiteUrl

Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>

* Fix nullability warnings

* Revert "Add client-server integration tests for Icons and WebsiteUrl"

This reverts commit f37de15569e54e86a0709121c9bdf80c5045511c.

* More nullability fixes

* Add more tests

* Address code review feedback: add Theme property, fix docs, improve test patterns

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>

* Update Icon tests to exercise Theme property

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>

* Add Theme property assertions to client-server integration tests

Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>

* Fix nullability

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MackinnonBuck <10456961+MackinnonBuck@users.noreply.github.com>
Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com>
Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Co-authored-by: David Cantú <dacantu@microsoft.com>
2025-10-08 12:23:01 -07:00
Stephen Halter
a0049c7a3c
Bump version to 0.4.0-preview.3 again 2025-10-08 11:37:58 -07:00
Stephen Halter
da30f0e604
Update remaining .NET versions in release.yml v0.4.0-preview.2 2025-10-08 11:23:47 -07:00
Stephen Halter
58bbb10d3d
Bump version back down to 0.4.0-preview.2
We need to retry the release since the NuGet publish failed.
2025-10-08 10:06:26 -07:00
Stephen Halter
857915ca52
Update .NET version in release.yml (#841)
Updated .NET version in release workflow to 10.0.x and removed older versions.
2025-10-08 09:39:12 -07:00
Stephen Halter
3444243bf2
Bump version to 0.4.0-preview.3 2025-10-07 14:51:34 -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
Den Delimarsky
445ea42adc
Update sample with URI validation (#824) 2025-10-03 10:00:51 -07: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
Jeff Handley
7c66faaef6
Bump version to 0.4.0-preview.2 (#818) 2025-09-25 19:47:35 +03:00
Jeff Handley
be2d0f5bcd
Bump to 0.4.0-preview.1 for releasing breaking changes (#813) v0.4.0-preview.1 2025-09-25 09:32:02 -07:00
Stephen Toub
6cb9e0e1fe
Bump M.E.AI version (#817) 2025-09-25 16:27:59 +03:00
Eirik Tsarpalis
d8768de302
Fix stdio client transport CLI argument escaping. (#811)
* 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
2025-09-25 14:46:39 +03:00
Copilot
f331a6927f
Add devcontainer.json to support .NET 9 samples in GitHub Codespaces (#779)
* Initial plan

* Add devcontainer.json to support both .NET 8 and .NET 9 in GitHub Codespaces

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Polish devcontainer.json with better VS Code integration and useful postCreateCommand

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

* Remove redundant .NET 8 SDK installation and add Node.js feature

Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: eiriktsarpalis <2813363+eiriktsarpalis@users.noreply.github.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
2025-09-25 11:42:11 +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
Mike Kistler
39b0ed3c18
Add conceptual docs on accessing HttpContext (#771)
* Add doc with sample on accessing HttpContext
* Apply suggestions from PR review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-24 07:41:08 -05:00
Eirik Tsarpalis
ab6d3e1ac5
Update MEAI dependencies. (#801) 2025-09-19 17:36:12 +03: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
Alexander Sklar
fe2ce2bc60
Correct 'McpTool' to 'McpServerTool' in README (#775) 2025-09-16 13:42:43 +03:00
Mehran Davoudi
15d1271212
Add ElicitAsync<T> (#630) (#715)
* Add ElicitAsync<T> (#630)

- Refactored `ElicitResult` to a generic class `ElicitResult<T>` for typed content.
- Added `ElicitAsync<T>` method in `McpServerExtensions.cs` to request user input and construct schemas based on type `T`.
- Implemented schema building logic to handle primitive types and enums, ignoring unsupported types.
- Introduced `ElicitationTypedTests.cs` for testing the new elicitation functionality with typed forms.
- Verified naming policies in tests to ensure correct serialization casing.
- Defined `SampleForm` and `CamelForm` classes for expected input shapes, including unsupported properties for schema testing.
- Created JSON serialization contexts for both forms using source generation for improved performance.

* Fix the enum issue. for ElicitAsync<T>.

* Use AIJsonUtilities.CreateJsonSchema to create PrimitiveSchemaDefinition. #630

Renamed `BuildRequestSchemaFor<T>` to `BuildRequestSchema<T>`.
Updated the implementation to use `CreatePrimitiveSchema` and
enhanced type checks for supported primitives with
`AIJsonUtilities.CreateJsonSchema`. Streamlined handling of
unsupported types by consolidating return statements.

* Simplify ElicitAsync for schema validation. #630

Simplified the `ElicitAsync` method in `McpServerExtensions.cs` by removing unnecessary JSON object construction and directly deserializing `raw.Content`. Updated `CreatePrimitiveSchema` to use `JsonTypeInfo` for type checking and adjusted return logic for unsupported types.

In `ElicitationTypedTests.cs`, modified the `Can_Elicit_Typed_Information` test to account for the new `Created` property in `SampleForm`, increasing the expected property count from 5 to 6. Added assertions for the type and format of the `Created` property and included its deserialization in the test setup.

* Add error handling for unsupported elicitation types #630

Introduce exception handling in `McpServerExtensions.cs` for unsupported types. Add a test case in `ElicitationTypedTests.cs` to verify exception throwing for unsupported types. Define a new `UnsupportedForm` class with nested properties and include JSON serialization attributes for proper handling.

* Validate generic types in BuildRequestSchema #630

Introduce validation to ensure only object types are supported for elicitation requests in the `BuildRequestSchema` method. An exception is thrown for non-object types. Update the test suite with a new test case to verify this behavior, ensuring that an exception is raised when eliciting a non-object generic type (e.g., string) and that the elicitation handler is not invoked in this scenario.

* Move nullable types handling logic to ElicitationRequestParams.Coverter. #630

* Add schema validation for elicitation requests

Introduce `TryValidateElicitationPrimitiveSchema` method to validate JSON schemas for elicitation requests. This method checks for object type, verifies the "type" property, and ensures compliance with allowed properties based on primitive types (string, boolean, number). Integrate this validation in the `BuildRequestSchema` method to ensure generated schemas are valid before further processing.

* Refactor nullable type pattern matching. #630

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

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

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

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

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

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

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

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

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

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

* Add ElicitResultSchemaCache. #630

* Prepopulate elicit schema validation logic. #630

- Introduced `LazyElicitAllowedProperties` to cache allowed property names for primitive types, replacing hardcoded logic.
- Streamlined `TryValidateElicitationPrimitiveSchema` method by consolidating type checks using pattern matching.
- Removed manual addition of allowed properties and now retrieve them directly from the new dictionary.
- Updated handling of "integer" type to be treated as "number" for consistency.

* Use Nullable.GetUnderlyingType to handle nullable types on elicitation. #630

- Update `ElicitRequestParams.cs` to throw a `JsonException` for non-string "type" properties, simplifying error handling.
- Modify `CreatePrimitiveSchema` in `McpServerExtensions.cs` to better handle nullable types and improve error messages.
- Revise `TryValidateElicitationPrimitiveSchema` to accept schema as the first parameter, enhancing clarity in error reporting.
- Simplify validation logic for the "type" keyword by directly retrieving string values, ensuring unsupported "type" arrays are flagged as errors.

* Rename static field.

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

* Fix static field renamings. #630

* Make BuildRequestSchema non-generic. #630

* Avoid closure allocation for serializerOptions on netcore  #630

Updated the `GetOrAdd` method to use a generic type parameter for .NET, allowing for better handling of `JsonSerializerOptions`. Retained the original implementation for other frameworks to ensure compatibility.

* Refactor ElicitRequestParams and McpServerExtensions. #630

- Simplified "type" property handling in Converter.
- Changed s_lazyElicitAllowedProperties to nullable type.
- Updated ElicitAsync to use static lambda for clarity.
- Refactored CreatePrimitiveSchema to handle nullable types.
- Initialized allowed properties in TryValidateElicitationPrimitiveSchema.
- Updated ElicitationTypedTests for naming conventions and added tests for nullable properties.
- Enforced required properties in SampleForm and introduced NullablePropertyForm.
- Added JSON source generation context for NullablePropertyForm.

* Remove reduntant checks. #630

Refactor JSON schema type handling and add integer support

This commit simplifies the validation logic for the `type` property in the JSON schema by removing unnecessary conditional checks. It directly retrieves the string value from `typeProperty` and assigns it to `typeKeyword`. Additionally, it enhances the `s_lazyElicitAllowedProperties` dictionary to include support for the `integer` type, allowing it to be recognized as a valid type with its corresponding allowed properties.

* Add IsAccepted property and update ElicitAsync return type

- Introduced `IsAccepted` property in `ElicitResult` and `ElicitResult<T>` to indicate if the action was accepted.
- Changed `ElicitAsync<T>` to return `ValueTask<ElicitResult<T>>` instead of `ValueTask<ElicitResult<T?>>`, ensuring non-nullable results.
- Updated return statements in `ElicitAsync<T>` to reflect the new return type, treating `Content` as non-nullable.

* Rename to s_elicitAllowedProperties

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

* Fix renaming s_elicitAllowedProperties. #630

* Remove unnecessary json attributes. #630

* Improve xml comment

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>

* Remove extra IsAccepted property. #630

* Use IsAccepted for checks.

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* Add IsAccepted to non-generic ElicitResult.

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-09-15 17:50:50 +03:00
Stephen Halter
d344c65120
Add middleware and authz support for server-side handlers (#733) 2025-09-10 10:07:45 -07:00
Peder Holdgaard Pedersen
0f0aad020b
Per Session Tools Sample (#724) 2025-09-08 07:34:09 -07:00
Elan Hasson
ec3b08b9dc
Fix typo LoggingTools.cs (#740) 2025-09-03 16:10:51 -07:00
Mike Kistler
acf6eb2e6b
Include docs samples in solution build (#751)
* Include docs samples in solution build
* Update workflow to build for doc updates
* Fix build error
2025-09-03 07:37:01 -05:00
Levan Revazashvili
4855a3668c
style: (#746)
- convert ValueStringBuilder.cs to file-scoped namespaces
- add rule in .editorconfig
2025-09-02 18:34:17 +03:00
sabbadino
0cf449eaca
Improved samples: added weather tool in AspNetCoreSseServer and option to connect via http to AspNetCoreSseServer. (#469) 2025-08-26 19:07:41 -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 Toub
2fa658e439
Add WithXx overloads that take target instance (#706)
* Add WithXx overloads that take target instance
* Special-case enumerables
2025-08-26 09:38:53 -07:00
Tim Heuer
aef509fd92
Clarify default value in ElicitResult documentation (#731)
Updated XML documentation to clarify default value for action.
2025-08-26 09:15:59 -07:00
Eirik Tsarpalis
f2dc714cd5
Update packages and Infra (#732)
* Update packages and Infra

* Update Directory.Packages.props

* Update Directory.Packages.props

* Install mono on macos gh-actions machines

* Skip failing test

* Attempt to fix failing macos test.
2025-08-26 17:28:35 +03:00