modelcontextprotocol / modelcontextprotocol/csharp-sdk

Allow tools to continue running when session is closed

Open
#623 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs confirmation
Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.

A server may implement a long-running tool that should continue running if the client disconnects or session is closed due to idle timeout.

The MCP Spec permits this case and has provisions for reconnecting to the server to resume its connection to the tool (resumable streams), but this is currently not possible with the C# SDK because it terminates tool calls when the session is closed.

Describe the solution you'd like

An option in the McpServerOptions, or maybe in the HttpTransport options, or maybe on individual tools, that skip cancellation of outstanding tool calls when a session is closed.

Describe alternatives you've considered

An alternative might be to not close a session when the client disconnects, and/or disable the idle session timeout.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how session closure and idle timeouts cancel outstanding tool calls in the C# SDK. Compare McpServerOptions, HttpTransport options, and individual-tool configuration against the MCP resumable streams provisions. Done means a documented option preserves eligible tool calls after disconnect or session closure and supports reconnecting to them.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.