-
Notifications
You must be signed in to change notification settings - Fork 158
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
Allow Integration with ASP.Net Core #119
Comments
Should be resolved by #25 |
I'd say #25 is the base for this feature. |
@halter73, is this something we want to do as part of ModelContextProtocol.AspNetCore? |
This does sound appealing, but the HttpContext is a bad fit to represent an MCP JSON-RPC invocation, and controllers and minimal route handlers expect a conventional HTTP request where you can do things like set HTTP response headers, stream HTTP request and response bodies, etc. @BrennanConroy showed me a very early prototype he has exposing SignalR hub methods as tools, but says it would take a lot more effort to make it production quality. While this might be an interesting approach, SignalR's HubCallerContext is not a much better fit than an HttpContext for a tool invocation, so this really only makes sense if you also have conventional SignalR clients connected to your application that you can send and broadcast messages to. And there's really no SignalR client "Caller" that the HubCallerContext alludes too, so we have some tough questions left to figure out. The core HTTP Streaming MCP API is going to be built around the MapMcp method at least in the short term. We will give you access to the HttpContexts used to initiate sessions and send individual or batched JSON-RPC messages, but we will not automatically translate tool invocations into controller action invocations or minimal route handler invocations, at least not in the short term. It might be an interesting idea for a community add-on package. It could probably be implemented already using a combination of MapGroup, an endpoint filter factory, and MapMcp, but it'd be a lot work. |
For server developers who only want to support stateless HTTP calls without SSE, we will provide an API that's similar to minimal route handlers, but it won't dispatch to existing minimal APIs even in an opt-in nature. Minimal APIs are too unconstrained. |
cc: @captainsafia |
Is your feature request related to a problem? Please describe.
Many teams have already working APIs in place which are built using ASP.Net Core Controllers or Minimal APIs. It would be good to provide an easy way to leverage these APIs and expose them through the MCP.
Describe the solution you'd like
Since ASP.Net Core already has the API Explorer built in which allows looking at the metadata of endpoints, it could be as easy as providing a Middleware which would then generate the MCP description at the
/resources/list
endpoint.Another Middleware could then listen at the
/message
endpoint and dispatch the calls to the appropriate Controller / Minimal Endpoint.Describe alternatives you've considered
None
Additional context
The MCP spec has just introduces "normal" HTTP calls without SSE
modelcontextprotocol/specification#206
The text was updated successfully, but these errors were encountered: