Skip to main content

Definition

Assembly: Microsoft.AspNetCore.Http.Abstractions.dll Namespace: Microsoft.AspNetCore.Builder

Syntax

Microsoft.AspNetCore.Builder.IApplicationBuilder

Summary

This type is defined in Microsoft.AspNetCore.Http.Abstractions.

Remarks

See Microsoft documentation for more information about the rest of the API.

Methods

UseODataMcp Extension

Extension method from Microsoft.AspNetCore.Builder.ODataMcp_AspNetCore_ApplicationBuilderExtensions
Adds OData MCP middleware to automatically discover and register MCP endpoints.

Syntax

public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseODataMcp(Microsoft.AspNetCore.Builder.IApplicationBuilder app)

Parameters

NameTypeDescription
appMicrosoft.AspNetCore.Builder.IApplicationBuilderThe application builder.

Returns

Type: Microsoft.AspNetCore.Builder.IApplicationBuilder The application builder for chaining.

Exceptions

ExceptionDescription
ArgumentNullExceptionThrown when app is null.

Examples

var app = builder.Build();
app.UseRouting();
app.UseODataMcp(); // Automatic MCP endpoint registration
app.MapControllers();

Remarks

This method must be called after UseRouting() but before UseEndpoints() or MapControllers(). It automatically discovers all registered OData routes and adds corresponding MCP endpoints.