McpEssentials.Core
1.0.0-preview.4
dotnet add package McpEssentials.Core --version 1.0.0-preview.4
NuGet\Install-Package McpEssentials.Core -Version 1.0.0-preview.4
<PackageReference Include="McpEssentials.Core" Version="1.0.0-preview.4" />
<PackageVersion Include="McpEssentials.Core" Version="1.0.0-preview.4" />
<PackageReference Include="McpEssentials.Core" />
paket add McpEssentials.Core --version 1.0.0-preview.4
#r "nuget: McpEssentials.Core, 1.0.0-preview.4"
#:package McpEssentials.Core@1.0.0-preview.4
#addin nuget:?package=McpEssentials.Core&version=1.0.0-preview.4&prerelease
#tool nuget:?package=McpEssentials.Core&version=1.0.0-preview.4&prerelease
McpEssentials.Core
Authenticated MCP task stores and shared primitives for generic Model Context Protocol servers built on the C# SDK.
The SDK ships InMemoryMcpTaskStore, which is process-wide: any caller who knows a task id can get, update, or cancel it. InMemoryMcpTaskStorePlus is our own in-memory store. It records the user who created each task, isolates later manipulation to that user, and never wraps the SDK store.
Install
dotnet add package McpEssentials.Core
Usage
builder.Services.AddHttpContextAccessor();
builder.Services.AddMcpServer()
.WithHttpTransport()
.WithTools<MyTools>()
.WithTasksPlus(
sp => sp.GetRequiredService<IHttpContextAccessor>().HttpContext?.User,
o => o.DefaultTimeToLive = TimeSpan.FromMinutes(5));
Local / stdio: .WithTasksPlus("local-user"). Tests: new InMemoryMcpTaskStorePlus("user-1") or store.CreateTaskAsync(principal).
HTTP hosts call AddHttpContextAccessor() and pass a factory that resolves IHttpContextAccessor from the built provider.
Form elicitation
var result = await server.ElicitAsync(
FormElicitation.Create($"How should we query {entitySet}?")
.String("filter").Title("$filter")
.Integer("top").Title("$top").Min(1).Max(1000).Default(20),
cancellationToken);
var typed = await server.ElicitAsync(
FormElicitation.From<ProductQuery>("Query products").Exclude(x => x.Skip),
cancellationToken);
Keep the builder and add a field per name when the shape comes from metadata. From<T>() seeds a CLR type. Both work inside an MCP task: the SDK interceptor parks the form on the task when the tool awaits ElicitAsync. To park yourself: store.SetInputRequestsAsync(taskId, form).
IMcpTaskStorePlus extends IMcpTaskStore with ClaimsPrincipal overloads. McpTaskStoreBase takes a current-user callback and wires InputResponseReceived. CreateTaskAsync stamps the current user (NameIdentifier → sub → UPN → Name). tasks/get, tasks/update, and tasks/cancel return "not found" for another user's task. Server-side completion (SetCompletedAsync / SetFailedAsync / SetInputRequestsAsync) uses the owner recorded at create, because those calls run on a background DI scope after the original request is gone.
Durable stores
Core is the in-memory, single-process store. McpEssentials.EntityFrameworkCore and McpEssentials.Redis are the durable providers in this repo. Other packages (PostgreSQL, Cosmos, …) subclass McpTaskStoreBase the same way. See Authenticated Task Stores.
Documentation
License
MIT © CloudNimble, Inc.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- ModelContextProtocol.Extensions.Tasks (>= 2.3.0)
-
net11.0
- ModelContextProtocol.Extensions.Tasks (>= 2.3.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- ModelContextProtocol.Extensions.Tasks (>= 2.3.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- ModelContextProtocol.Extensions.Tasks (>= 2.3.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on McpEssentials.Core:
| Package | Downloads |
|---|---|
|
McpEssentials.EntityFrameworkCore
EF Core authenticated MCP task store. Persist per-user tasks on any EF Core database (SQL Server, SQLite, PostgreSQL, Cosmos via EF). Host owns migrations. |
|
|
McpEssentials.Redis
Redis authenticated MCP task store. Native EXPIRE from DiscardAfter and pub/sub for multi-node elicitation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-preview.4 | 44 | 10/29/2026 |
| 1.0.0-preview.3 | 48 | 10/28/2026 |
| 1.0.0-preview.2 | 42 | 10/27/2026 |
| 1.0.0-preview.1 | 46 | 10/27/2026 |