> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# IRouteBuilder

> Extension methods for IRouteBuilder from Microsoft.AspNetCore.Routing

export function DocsBadge({text, variant = 'neutral'}) {
  const variantClasses = {
    success: 'mint-bg-green-500/10 mint-text-green-600 dark:mint-text-green-400 mint-border-green-500/20',
    neutral: 'mint-bg-slate-500/10 mint-text-slate-600 dark:mint-text-slate-400 mint-border-slate-500/20',
    info: 'mint-bg-blue-500/10 mint-text-blue-600 dark:mint-text-blue-400 mint-border-blue-500/20',
    warning: 'mint-bg-amber-500/10 mint-text-amber-600 dark:mint-text-amber-400 mint-border-amber-500/20',
    danger: 'mint-bg-red-500/10 mint-text-red-600 dark:mint-text-red-400 mint-border-red-500/20'
  };
  const classes = variantClasses[variant] || variantClasses.neutral;
  return <span className={`mint-inline-flex mint-items-center mint-px-2 mint-py-0.5 mint-rounded-full mint-text-xs mint-font-medium mint-tracking-wide mint-border mint-ml-1.5 mint-align-middle mint-whitespace-nowrap ${classes}`}>
      {text}
    </span>;
}

## Definition

**Assembly:** Microsoft.AspNetCore.Routing.dll

**Namespace:** Microsoft.AspNetCore.Routing

## Syntax

```csharp theme={"dark"}
Microsoft.AspNetCore.Routing.IRouteBuilder
```

## Summary

This type is defined in Microsoft.AspNetCore.Routing.

## Remarks

See [Microsoft documentation](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.routing.iroutebuilder) for more information about the rest of the API.

## Methods

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  AddMcp <DocsBadge text="Extension" variant="success" />

<Note>Extension method from `Microsoft.AspNetCore.Routing.ODataMcp_AspNetCore_RouteBuilderExtensions`</Note>

Adds MCP endpoints to an OData route using the default path.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.AspNetCore.Routing.IRouteBuilder AddMcp(Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder)
```

#### Parameters

| Name           | Type                                         | Description        |
| -------------- | -------------------------------------------- | ------------------ |
| `routeBuilder` | `Microsoft.AspNetCore.Routing.IRouteBuilder` | The route builder. |

#### Returns

Type: `Microsoft.AspNetCore.Routing.IRouteBuilder`
The route builder for chaining.

#### Examples

```csharp theme={"dark"}
endpoints.MapODataRoute("odata", "api/v1", GetEdmModel())
    .AddMcp();
```

#### Remarks

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".

### <Icon icon="puzzle-piece" iconType="duotone" color="#419AC5" size={24} style={{ paddingRight: '8px' }} />  AddMcp <DocsBadge text="Extension" variant="success" />

<Note>Extension method from `Microsoft.AspNetCore.Routing.ODataMcp_AspNetCore_RouteBuilderExtensions`</Note>

Adds MCP endpoints to an OData route using a custom path.

#### Syntax

```csharp theme={"dark"}
public static Microsoft.AspNetCore.Routing.IRouteBuilder AddMcp(Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string customPath)
```

#### Parameters

| Name           | Type                                         | Description                                      |
| -------------- | -------------------------------------------- | ------------------------------------------------ |
| `routeBuilder` | `Microsoft.AspNetCore.Routing.IRouteBuilder` | The route builder.                               |
| `customPath`   | `string?`                                    | The custom MCP path, or null to use the default. |

#### Returns

Type: `Microsoft.AspNetCore.Routing.IRouteBuilder`
The route builder for chaining.

#### Exceptions

| Exception               | Description                         |
| ----------------------- | ----------------------------------- |
| `ArgumentNullException` | Thrown when *routeBuilder* is null. |

#### Examples

```csharp theme={"dark"}
endpoints.MapODataRoute("odata", "api/v1", GetEdmModel())
    .AddMcp("/custom/mcp/path");
```
