> ## Documentation Index
> Fetch the complete documentation index at: https://si.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://si.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.

> [card] When it ships
>
> Document hosts that already run MongoDB and want a `mcpTasks` collection with change streams for elicitation.

> [card] [Until then](https://si.easyaf.dev/mcpessentials/guides/stores/entity-framework-core.md)
>
> Stay on Entity Framework Core if the host already maps Mongo through EF.

## Intended how-to

**1. Add the package**

Add `McpEssentials.MongoDB`.

**2. Create the collection**

Collection `mcpTasks`, unique index on `taskId`, compound index `{ ownerUserId: 1, taskId: 1 }`.

**3. Compare-and-swap**

`findOneAndUpdate` filtered on current status.

**4. Register the store**

Singleton, same current-user factory as [Authenticated tasks](https://si.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`).

## Related

> [card] [Entity Framework Core](https://si.easyaf.dev/mcpessentials/guides/stores/entity-framework-core.md)
>
> Shipped. Use this if you already map Mongo through EF.

> [card] [Stores](https://si.easyaf.dev/mcpessentials/guides/stores.md)
>
> Pick a backing store by the engine you already run.


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