Class McpAuthenticationExtensions
- Namespace
- Microsoft.Extensions.DependencyInjection
- Assembly
- ModelContextProtocol.AspNetCore.dll
Extension methods for adding MCP authorization support to ASP.NET Core applications.
public static class McpAuthenticationExtensions
- Inheritance
-
McpAuthenticationExtensions
- Inherited Members
Methods
AddMcp(AuthenticationBuilder, Action<McpAuthenticationOptions>?)
Adds MCP authorization support to the application.
public static AuthenticationBuilder AddMcp(this AuthenticationBuilder builder, Action<McpAuthenticationOptions>? configureOptions = null)
Parameters
builder
AuthenticationBuilderThe authentication builder.
configureOptions
Action<McpAuthenticationOptions>An action to configure MCP authentication options.
Returns
- AuthenticationBuilder
The authentication builder for chaining.
AddMcp(AuthenticationBuilder, string, string, Action<McpAuthenticationOptions>?)
Adds MCP authorization support to the application with a custom scheme name.
public static AuthenticationBuilder AddMcp(this AuthenticationBuilder builder, string authenticationScheme, string displayName, Action<McpAuthenticationOptions>? configureOptions = null)
Parameters
builder
AuthenticationBuilderThe authentication builder.
authenticationScheme
stringThe authentication scheme name to use.
displayName
stringThe display name for the authentication scheme.
configureOptions
Action<McpAuthenticationOptions>An action to configure MCP authentication options.
Returns
- AuthenticationBuilder
The authentication builder for chaining.