Table of Contents

Class McpEndpointRouteBuilderExtensions

Namespace
Microsoft.AspNetCore.Builder
Assembly
ModelContextProtocol.AspNetCore.dll

Provides extension methods for IEndpointRouteBuilder to add MCP endpoints.

public static class McpEndpointRouteBuilderExtensions
Inheritance
McpEndpointRouteBuilderExtensions
Inherited Members

Methods

MapMcp(IEndpointRouteBuilder, string)

Sets up endpoints for handling MCP Streamable HTTP transport. See the 2025-03-26 protocol specification for details about the Streamable HTTP transport. Also maps legacy SSE endpoints for backward compatibility at the path "/sse" and "/message". the 2024-11-05 protocol specification for details about the HTTP with SSE transport.

public static IEndpointConventionBuilder MapMcp(this IEndpointRouteBuilder endpoints, string pattern = "")

Parameters

endpoints IEndpointRouteBuilder

The web application to attach MCP HTTP endpoints.

pattern string

The route pattern prefix to map to.

Returns

IEndpointConventionBuilder

Returns a builder for configuring additional endpoint conventions like authorization policies.