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

# ODataMcpServerBuilder

> Configures OData MCP Tasks on `AddODataMcp`. Hosts call [ODataMcpServerBuilder.WithTasks](/odata-mcp/api-reference/Microsoft/OData/Mcp/AspNetCore/Hosting/ODataMcpServe...

## 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.ODataMcpServerBuilder
```

## Summary

Configures OData MCP Tasks on `AddODataMcp`. Hosts call
[ODataMcpServerBuilder.WithTasks](https://ai.easyaf.dev/api-reference/Microsoft/OData/Mcp/AspNetCore/Hosting/ODataMcpServerBuilder#withtasks) and [WaitForAnnotatedAction\`\`1](https://learn.microsoft.com/dotnet/api/microsoft.odata.mcp.aspnetcore.hosting.odatamcpserverbuilder.waitforannotatedaction`-1) here, not on
`UseODataMcp` and not via SDK `WithTasks` from app code.

## Examples

```csharp theme={null}
builder.Services.AddODataMcp(options =&gt; { }, mcp =&gt;
{
    mcp.WithTasks();
    mcp.WaitForAnnotatedAction&lt;HostAuthorizeWaiter&gt;();
});
```

## Constructors

### &#x20;.ctor Inherited

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

#### Syntax

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

## Properties

### &#x20;Server

Gets the SDK builder already used for `WithHttpTransport` and catalog handlers.
Hosts may attach logging filters. They must not call SDK `WithTasks` on it.

#### Syntax

```csharp theme={null}
public Microsoft.Extensions.DependencyInjection.IMcpServerBuilder Server { get; }
```

#### Property Value

Type: `Microsoft.Extensions.DependencyInjection.IMcpServerBuilder`

## Methods

### &#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?`

### &#x20;WaitForAnnotatedAction

Registers the host waiter used after URL elicitation is accepted.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder WaitForAnnotatedAction<TWaiter>() where TWaiter : class, Microsoft.OData.Mcp.AspNetCore.Hosting.IMcpAnnotatedActionWaiter
```

#### Returns

Type: `Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder`
This builder.

#### Type Parameters

* `TWaiter` - The waiter type.

#### Remarks

Required for Succeeded after elicitation. Without it, the call completes with the
Started payload after the URL is shown.

### &#x20;WithTasks

Enables MCP Tasks for annotated actions only, using `InMemoryMcpTaskStorePlus`.
Authenticated callers are isolated by user id. Unauthenticated callers share owner
[UnauthenticatedTaskOwner](https://learn.microsoft.com/dotnet/api/microsoft.odata.mcp.aspnetcore.hosting.odatamcpserverbuilder.unauthenticatedtaskowner) and the task id is the secret.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder WithTasks()
```

#### Returns

Type: `Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder`
This builder.

### &#x20;WithTasks

Enables MCP Tasks and selects a plus store provider.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder WithTasks(System.Action<CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBuilder> configure)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `configure` | `System.Action<CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBuilder>` | Selects `UseInMemory` or a provider `Use*` method. |

#### Returns

Type: `Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder`
This builder.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *configure* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). |
| `InvalidOperationException` | Thrown when *configure* did not call a `Use*` method. |

#### Examples

```csharp theme={null}
mcp.WithTasks(tasks =&gt; tasks.UseInMemory("local-user"));
mcp.WithTasks(tasks =&gt; tasks.UseEntityFramework&lt;AppDbContext&gt;(
    sp =&gt; sp.GetRequiredService&lt;IHttpContextAccessor&gt;().HttpContext?.User));
```

### &#x20;WithTasks

Enables MCP Tasks for annotated actions only. CRUD, functions, and unannotated
actions stay one-shot.

#### Syntax

```csharp theme={null}
public Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder WithTasks(ModelContextProtocol.Extensions.Tasks.IMcpTaskStore store)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `store` | `ModelContextProtocol.Extensions.Tasks.IMcpTaskStore` | The protocol task store. Register a singleton; stateless HTTP |
| creates a fresh server per POST. | | |

#### Returns

Type: `Microsoft.OData.Mcp.AspNetCore.Hosting.ODataMcpServerBuilder`
This builder.

#### Exceptions

| Exception | Description |
| - | - |
| `ArgumentNullException` | Thrown when *store* is [`null`](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). |

#### Remarks

Wires `tasks/get`, `tasks/update`, and `tasks/cancel` from
`ModelContextProtocol.Extensions.Tasks`. Does not wrap every catalog tool:
the execution-mode selector returns Optional only for annotated actions whose
request advertised the Tasks extension. Stamps `DefaultTimeToLive` on
`IMcpTaskStorePlus` so Claude Code receives `ttlMs`.


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