Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
ProtocolServiceCollectionExtensions class
Registers the MCP server and the A2A agent that EndpointRouteBuilderExtensions.MapMentorAgentMcp and EndpointRouteBuilderExtensions.MapMentorAgentA2A map.
On this page
Until 1.0.0-rc.15 AddMentorAgent registered both itself. They moved to this package with the endpoints (story 105) because their transports need ASP.NET Core, which MentorAgent no longer references — that is what lets a MAUI app reference it on Android, iOS and Mac Catalyst. AddMentorAgentServer() calls both, so a headless host needs nothing more; a Blazor Server host that serves MCP or A2A without the hub calls the one it needs after AddMentorAgent.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Extensions. Package: Novior.MentorAgent.Server.
public static class ProtocolServiceCollectionExtensions
dotnet add package Novior.MentorAgent.ServerMethods
Section titled “Methods”AddMentorAgentA2A
Section titled “AddMentorAgentA2A”public static IServiceCollection AddMentorAgentA2A(this IServiceCollection services)
Registers the A2A agent when MentorOptions.A2AServerEnabled is true, so that app.MapMentorAgentA2A() can map it. Call it after AddMentorAgent():
builder.Services.AddMentorAgent(options => { options.A2AServerEnabled = true; /* ... */ });
builder.Services.AddMentorAgentA2A();
// ...
app.MapMentorAgentA2A();The flag is read as AddMentorAgent read it, at registration time. Calling this twice, or together with AddMentorAgentServer(), which calls it, registers the agent once. Called before AddMentorAgent() it registers nothing, and the host stops at start-up saying so; the same when A2AServerEnabled is turned on after AddMentorAgent() read it, in a Configure or PostConfigure of MentorOptions.
AddMentorAgentMcp
Section titled “AddMentorAgentMcp”public static IServiceCollection AddMentorAgentMcp(this IServiceCollection services)
Registers the MCP server when MentorOptions.McpServerEnabled is true, so that app.MapMentorAgentMcp() can map it. Call it after AddMentorAgent():
builder.Services.AddMentorAgent(options => { options.McpServerEnabled = true; /* ... */ });
builder.Services.AddMentorAgentMcp();
// ...
app.MapMentorAgentMcp();The flag is read as AddMentorAgent read it, at registration time. Calling this twice, or together with AddMentorAgentServer(), which calls it, registers the server once. Called before AddMentorAgent() it registers nothing, and the host stops at start-up saying so; the same when McpServerEnabled is turned on after AddMentorAgent() read it, in a Configure or PostConfigure of MentorOptions.
