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

# MongoDB

> MongoDB authenticated task store with change streams. Specified; not in this repository yet.

> [!WARNING]
>
> `McpEssentials.MongoDB` is specified and is not in this repository yet. Use [Entity Framework Core](https://ai.easyaf.dev/mcpessentials/guides/stores/entity-framework-core.md) if you already map Mongo through EF, or wait for this package for a native collection and change streams.

## When to use it

Document hosts that already run MongoDB and want a `mcpTasks` collection with change streams for elicitation.

## Intended how-to

1. Add `McpEssentials.MongoDB`.
2. Collection `mcpTasks`, unique index on `taskId`, compound index `{ ownerUserId: 1, taskId: 1 }`.
3. Compare-and-swap with `findOneAndUpdate` filtered on current status.
4. Register the store as a singleton with the same current-user factory as [Authenticated tasks](https://ai.easyaf.dev/mcpessentials/guides/authenticated-tasks.md).

## Events

Change streams on the collection, filtered to input-request updates. Subscribers raise `InputResponseReceived`.

## TTL

TTL index on the discard stamp (`DiscardAfter` / `CreatedAt + 2×TimeToLive`).

See [Stores](https://ai.easyaf.dev/mcpessentials/guides/stores.md).


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