Replies: 1 comment
|
There is no separate typed initialize handler to replace, but the current SDK gives you two hooks depending on what “during initialization” means. For legacy handshake clients ( builder.Services.AddMcpServer()
.WithMessageFilters(filters =>
{
filters.AddIncomingFilter(next => async (context, cancellationToken) =>
{
if (context.JsonRpcMessage is JsonRpcRequest
{ Method: RequestMethods.Initialize })
{
// Validate or prepare handshake-scoped state here.
}
await next(context, cancellationToken);
if (context.JsonRpcMessage is JsonRpcNotification
{ Method: NotificationMethods.InitializedNotification })
{
// The client has acknowledged initialization.
}
});
});Call If you mean work for the lifetime of an HTTP MCP session, configure One important current-version caveat: protocol Relevant current sources: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Pre-submission Checklist
Question Category
Your Question
Hi!
I am developing a remote server with C# sdk and i am looking to do "things" during initialization phase of an http server. Someone can help me on how to do that? Is there any handler that can be implemented?
Thanks for all your answers.
All reactions