Definition
Assembly: Microsoft.AspNetCore.Routing.dll
Namespace: Microsoft.AspNetCore.Routing
Syntax
Microsoft . AspNetCore . Routing . IRouteBuilder
Summary
This type is defined in Microsoft.AspNetCore.Routing.
See Microsoft documentation for more information about the rest of the API.
Methods
AddMcp Extension
Extension method from Microsoft.AspNetCore.Routing.ODataMcp_AspNetCore_RouteBuilderExtensions
Adds MCP endpoints to an OData route using the default path.
Syntax
public static Microsoft . AspNetCore . Routing . IRouteBuilder AddMcp ( Microsoft . AspNetCore . Routing . IRouteBuilder routeBuilder )
Parameters
Name Type Description
routeBuilderMicrosoft.AspNetCore.Routing.IRouteBuilderThe route builder.
Returns
Type: Microsoft.AspNetCore.Routing.IRouteBuilder
The route builder for chaining.
Examples
endpoints . MapODataRoute ( "odata" , "api/v1" , GetEdmModel ())
. AddMcp ();
This method adds MCP endpoints as siblings to the OData $metadata endpoint.
For example, if the OData route is “api/v1”, the MCP endpoints will be at “api/v1/mcp”.
AddMcp Extension
Extension method from Microsoft.AspNetCore.Routing.ODataMcp_AspNetCore_RouteBuilderExtensions
Adds MCP endpoints to an OData route using a custom path.
Syntax
public static Microsoft . AspNetCore . Routing . IRouteBuilder AddMcp ( Microsoft . AspNetCore . Routing . IRouteBuilder routeBuilder , string customPath )
Parameters
Name Type Description
routeBuilderMicrosoft.AspNetCore.Routing.IRouteBuilderThe route builder. customPathstring?The custom MCP path, or null to use the default.
Returns
Type: Microsoft.AspNetCore.Routing.IRouteBuilder
The route builder for chaining.
Exceptions
Exception Description
ArgumentNullExceptionThrown when routeBuilder is null.
Examples
endpoints . MapODataRoute ( "odata" , "api/v1" , GetEdmModel ())
. AddMcp ( "/custom/mcp/path" );