Definition
Assembly: CloudNimble.McpEssentials.Core.dll Namespace: CloudNimble.McpEssentials.Core.Tasks Inheritance: CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Summary
An in-memory IMcpTaskStorePlus that records the user who created each task and isolates later client-facing operations to that user.Remarks
Storage is owned by this type: StoredMcpTask snapshots in a [ConcurrentDictionary2](https://learn.microsoft.com/dotnet/api/system.collections.concurrent.concurrentdictionary-2), compare-and-swap updates, two-window TTL, serve-and-drop on a terminal get, plus a throttled sweep. It does not wrap the SDK InMemoryMcpTaskStore`.
Tasks created with a McpTaskStoreBase.DefaultTimeToLive use two
clocks (as permitted by SEP-2663): a work window of CreatedAt + TimeToLive during which
input and progress are accepted, and a tracking window that keeps the snapshot visible until
CreatedAt + 2×TimeToLive so a late complete, fail, or cancel can still be recorded and
polled. That ceiling is stamped as StoredMcpTask.DiscardAfter at write time.
An owner GetTaskAsync of a terminal snapshot serves it and then drops the row. An
opportunistic throttled sweep reclaims snapshots nobody collected. Tasks created without a
time-to-live are retained until a terminal get by the owner or until the process exits.
Client-facing operations require a current user and treat another user’s task as missing.
Another user’s get does not serve-and-drop the owner’s row. Server-side completion skips the
live-user check because the SDK runs those from a background DI scope after the originating
HTTP request is gone.
Single-process only. Register as a singleton. Subclass to change isolation, storage, or TTL.
For multi-instance hosts, use a durable provider described in the authenticated task store spec.
Constructors
.ctor
Initializes a new instance of the InMemoryMcpTaskStorePlus class.Syntax
Parameters
Exceptions
.ctor
Initializes a new instance of the InMemoryMcpTaskStorePlus class that always uses userId.Syntax
Parameters
.ctor
Initializes a new instance of the InMemoryMcpTaskStorePlus class that resolves the user from a ClaimsPrincipal.Syntax
Parameters
Exceptions
.ctor Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Exceptions
.ctor Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
.ctor Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Exceptions
.ctor Inherited
Inherited from
objectSyntax
Properties
AutoSweep Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:bool
The default is true.
Remarks
Set tofalse and call CancellationToken) from your own job
when you want to own the schedule. The public flush handle always runs a full pass.
DefaultPollIntervalMs Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:long
The default is 1000 milliseconds.
DefaultTimeToLive Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBasenull for unlimited.
Syntax
Property Value
Type:System.Nullable<System.TimeSpan>
Remarks
When set to a positive value, the work window ends atCreatedAt + TimeToLive and
the row is discarded at CreatedAt + 2×TimeToLive (stamped as
StoredMcpTask.DiscardAfter), or sooner when a terminal
GetTaskAsync serves it. A null or non-positive value keeps tasks
until a terminal get or until the store discards them.
GetCurrentUserId Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:System.Func<string?>
LastSweepTicks Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:long
ServeAndDrop Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:bool
The default is true.
SweepInterval Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Property Value
Type:System.TimeSpan
The default is 30 seconds. Zero skips the throttle.
Methods
CreateTaskAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo>
CreateTaskAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo>
CreateTaskCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo>
Equals Inherited Virtual
Inherited from
objectSyntax
Parameters
Returns
Type:bool
Equals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
GetHashCode Inherited Virtual
Inherited from
objectSyntax
Returns
Type:int
GetTaskAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo?>
GetTaskAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo?>
GetTaskCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBasenull.
Syntax
Parameters
Returns
Type:System.Threading.Tasks.Task<ModelContextProtocol.Extensions.Tasks.McpTaskInfo?>
GetType Inherited
Inherited from
objectSyntax
Returns
Type:System.Type
GetUserId Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:string?
The first non-whitespace claim in SDK session-identity order, or null
when the principal is missing or unauthenticated.
Remarks
Claim lookup matches the MCP C# SDK session identity order: NameIdentifier,sub, Upn,
Name, then Name.
The principal must be authenticated.
GetUtcNow Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Returns
Type:System.DateTimeOffset
IsOwnedBy Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:bool
MemberwiseClone Inherited
Inherited from
objectSyntax
Returns
Type:object
NormalizeTimeToLive Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBasenull when tasks should be retained until discarded.
Syntax
Parameters
Returns
Type:System.Nullable<System.TimeSpan>
OnInputResponseReceived Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
PulseSweepAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
A completed task when auto-sweep is off or the interval has not elapsed.
ReferenceEquals Inherited
Inherited from
objectSyntax
Parameters
Returns
Type:bool
RequireUserId Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Returns
Type:string
Exceptions
RequireUserId Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:string
Exceptions
ResolveInputRequestsAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
ResolveInputRequestsAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
ResolveInputRequestsCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetCancelledAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<bool>
SetCancelledAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<bool>
SetCancelledCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task<bool>
SetCompletedAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetCompletedCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetFailedAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetFailedCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetInputRequestsAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SetInputRequestsCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
ShouldDiscard Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:bool
The default is DateTimeOffset) (compares
StoredMcpTask.DiscardAfter). Override for per-row Get and mutate.
Set-based drains (EF ExecuteDelete) use the stamp; override
CancellationToken) when bulk criteria must differ.
SweepExpiredAsync Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
SweepExpiredCoreAsync Inherited Abstract
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:System.Threading.Tasks.Task
A task that completes when the pass finishes.
Exceptions
ToString Inherited Virtual
Inherited from
objectSyntax
Returns
Type:string?
TryClaimSweep Inherited Virtual
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Parameters
Returns
Type:bool
true when this caller should run the pass.
A McpTaskStoreBase.SweepInterval of Zero always claims.
Events
InputResponseReceived Inherited
Inherited from
CloudNimble.McpEssentials.Core.Tasks.McpTaskStoreBaseSyntax
Related APIs
- CloudNimble.McpEssentials.Core.Tasks.IMcpTaskStorePlus
- ModelContextProtocol.Extensions.Tasks.IMcpTaskStore