Skip to content

Enable IsAotCompatible for ModelContextProtocol.AspNetCore #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

stephentoub
Copy link
Contributor

No description provided.

Copy link
Contributor

@halter73 halter73 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we registered McpJsonUtilities.DefaultOptions.TypeInfoResolver with JsonOptions.SerializerOptions in an IConfigureOptions<JsonOptions> service added as part of a new AddAspNetCoreMcpServer(this IServericeCollection method, we could simplify this to context.Request.ReadFromJsonAsync<IJsonRpcMessage>(context.RequestAborted) which is also AotCompatible.

But for now, I like not needing any ASP.NET Core specific services to use MapMcp.

@stephentoub stephentoub merged commit 19eed91 into modelcontextprotocol:main Apr 1, 2025
8 checks passed
@stephentoub stephentoub deleted the aspnetaot branch April 1, 2025 02:18
@@ -9,6 +9,7 @@
<PackageId>ModelContextProtocol.AspNetCore</PackageId>
<Description>ASP.NET Core extensions for the C# Model Context Protocol (MCP) SDK.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IsAotCompatible>true</IsAotCompatible>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we similarly turned on <PublishAOT> on the sample projects consuming this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of our samples enable it. I believe @agocke was offering to help do so... Andy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants