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

# ODataMcpHostOptions

> Host options for `AddODataMcp`.

## Definition

**Assembly:** Microsoft.OData.Mcp.AspNetCore.dll

**Namespace:** Microsoft.OData.Mcp.AspNetCore.Hosting

**Inheritance:** System.Object

## Syntax

```csharp theme={null}
Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpHostOptions
```

## Summary

Host options for `AddODataMcp`.

## Constructors

### &#x20;.ctor

#### Syntax

```csharp theme={null}
public ODataMcpHostOptions()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public Object()
```

## Properties

### &#x20;Catalog

Gets the catalog options applied to every enabled OData route.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.Core.Catalog.ODataMcpCatalogOptions Catalog { get; }
```

#### Property Value

Type: `Microsoft.OData.Mcp.Core.Catalog.ODataMcpCatalogOptions`

### &#x20;ExcludeRoutes

Gets prefixes that must not be exposed over MCP, matched without regard to case or leading slashes.
Applied after [ODataMcpHostOptions.IncludePrefixes](https://ai.easyaf.dev/odata-mcp/api-reference/Microsoft/OData/Mcp/AspNetCore/Hosting/ODataMcpHostOptions.md#includeprefixes).

#### Syntax

```csharp theme={null}
public System.Collections.Generic.List<string> ExcludeRoutes { get; }
```

#### Property Value

Type: `System.Collections.Generic.List<string>`

### &#x20;ExplicitRoutes

Gets routes registered explicitly when endpoint discovery cannot see an [IEdmModel](https://learn.microsoft.com/dotnet/api/microsoft.odata.edm.iedmmodel).
Discovered routes with the same prefix replace these entries.

#### Syntax

```csharp theme={null}
public System.Collections.Generic.List<Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpRouteBinding> ExplicitRoutes { get; }
```

#### Property Value

Type: `System.Collections.Generic.List<Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpRouteBinding>`

### &#x20;IncludePrefixes

Gets prefixes that should be exposed over MCP. When empty, every discovered (and explicit) prefix is enabled.
When non-empty, only matching prefixes are enabled. Prefer this over an OData-version-specific helper.

#### Syntax

```csharp theme={null}
public System.Collections.Generic.List<string> IncludePrefixes { get; }
```

#### Property Value

Type: `System.Collections.Generic.List<string>`

#### Examples

```csharp theme={null}
builder.Services.AddODataMcp(options =&gt;
{
    options.IncludePrefixes.Add("odata");
});
```

### &#x20;RateLimitingPolicyName

Gets or sets the ASP.NET Core rate-limiting policy name attached to each MCP endpoint.
When null, the endpoint still participates in a global limiter configured with `UseRateLimiter`.

#### Syntax

```csharp theme={null}
public string RateLimitingPolicyName { get; set; }
```

#### Property Value

Type: `string?`

#### Examples

```csharp theme={null}
builder.Services.AddRateLimiter(options =&gt;
{
    options.AddFixedWindowLimiter("mcp", limiter =&gt;
    {
        limiter.PermitLimit = 30;
        limiter.Window = TimeSpan.FromMinutes(1);
    });
});
builder.Services.AddODataMcp(options =&gt;
{
    options.RateLimitingPolicyName = "mcp";
});
```

### &#x20;RequireAuthorization

Gets or sets a value indicating whether MCP endpoints require an authenticated user.
When `true`, the mapped MCP endpoints call `RequireAuthorization` and participate
in the host's authentication and authorization pipeline.

#### Syntax

```csharp theme={null}
public bool RequireAuthorization { get; set; }
```

#### Property Value

Type: `bool`

## Methods

### &#x20;AddRoute

Registers an explicit *prefix* and *model* when the routing table
does not carry an [IEdmModel](https://learn.microsoft.com/dotnet/api/microsoft.odata.edm.iedmmodel) (for example a custom host that never wrote OData metadata).

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpHostOptions AddRoute(string prefix, Microsoft.OData.Edm.IEdmModel model)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `prefix` | `string` | The OData route prefix, for example `odata`. Empty is the application root. |
| `model` | `Microsoft.OData.Edm.IEdmModel` | The EdmLib model for that prefix. |

#### Returns

Type: `Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpHostOptions`
The same options instance.

#### Examples

```csharp theme={null}
builder.Services.AddODataMcp(options =&gt;
{
    options.AddRoute("odata", GetEdmModel());
});
```

#### Remarks

Discovery from `EndpointDataSource` still runs and wins when it finds the same prefix.

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={null}
public virtual string ToString()
```

#### Returns

Type: `string?`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.