Table of Contents

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 AuthenticationBuilder

The 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 AuthenticationBuilder

The authentication builder.

authenticationScheme string

The authentication scheme name to use.

displayName string

The display name for the authentication scheme.

configureOptions Action<McpAuthenticationOptions>

An action to configure MCP authentication options.

Returns

AuthenticationBuilder

The authentication builder for chaining.