.NET MCP server: Run tool as background task with client polling
Authorised Territory demonstrates a .NET MCP server pattern where a tool call starts a background task and returns a task handle instead of an immediate result, while a .NET client polls the server every second until the final output is available.
Overview
The video shows how to implement an MCP server in .NET that exposes a tool designed for long-running work:
- When the client invokes the tool, the server starts the work as a background task.
- Instead of returning the final result immediately, the server returns a task reference/handle.
- A .NET client then polls the MCP server every second until the tool reports completion and returns the final result.
The starting solution referenced for this tutorial is available here: https://youtu.be/qSSE9geqne0