Skip to content

Re-enable InMemoryMcpTaskStore when upstream DI scope bug is fixed #410

@jongalloway

Description

@jongalloway

Context

MCP SDK v1.1.0's ExecuteToolAsTaskAsync disposes the request-scoped IServiceProvider before the background task can resolve services. This causes ObjectDisposedException on every tool call when InMemoryMcpTaskStore is registered.

We've commented out the task store registration as a workaround. The TaskSupport = ToolTaskSupport.Optional attribute is kept on dotnet_project so it's ready to activate.

Upstream

When to re-enable

  1. Upstream issue is fixed and a new MCP SDK version is released
  2. Uncomment builder.Services.AddSingleton<IMcpTaskStore, InMemoryMcpTaskStore>(); in Program.cs
  3. Set AsyncTasks = true in DotNetCliTools.Misc.cs ServerCapabilities
  4. Restore the task lifecycle conformance tests in McpConformanceTests.cs
  5. Update ServerCapabilitiesTests.cs to assert AsyncTasks == true

Files

  • DotNetMcp/Program.cs — commented-out registration
  • DotNetMcp/Tools/Cli/DotNetCliTools.Misc.csAsyncTasks = false
  • DotNetMcp.Tests/Server/McpConformanceTests.cs — task tests replaced with degradation tests
  • DotNetMcp.Tests/Server/ServerCapabilitiesTests.cs — asserts AsyncTasks == false

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedBlocked by external dependency or decisionenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions