Build Your First MCP Task
Build an MCP server and client that create thumbnail batches, then use Tasks to track progress, retrieve results and request cancellation.
You’ll build
An MCP Task for image batches
Local runnable project
The MCP client declares Tasks support and calls create_thumbnails. The MCP server saves a task in its local store, starts the worker, and returns a task ID. The client uses tasks/get to retrieve status and the eventual result over Streamable HTTP.
You’ll learn
How the MCP server returns a task handle
How the MCP client polls and reconnects by task ID
Where the worker and local task store fit
How cancellation and tool errors appear
Some tools/call requests take longer than a request should stay open. Think
of a test suite, a deployment, a data export, or a step that waits for a person
to approve something. Tasks is the MCP extension that lets an MCP server
answer such a call immediately with a task handle, then report progress and the
final result through short follow-up requests. The MCP client can disconnect,
come back later with the task ID, and pick up the same work.
This guide is for developers who have built an MCP server and are new to Tasks. The first step explains how Tasks work with diagrams of the full exchange. The remaining steps guide you through implementing the extension on both an MCP server and an MCP client, using a batch of image resizes as the example. For the concepts on their own, without the build, read How MCP Tasks Work.
What you will build
Your MCP server will use Sharp to turn six images into eighteen thumbnails: three widths per image. Your MCP client will start the batch as a task, report its progress and retrieve the result. Then you will reconnect to a running task using its saved ID, cancel one, and handle a tool error.
![]()
Get started with Understand how MCP Tasks work and building your first task workflow below.
Guide steps
Work through the guide
- 1Understand how MCP Tasks workSee why a long tool call needs a task, what a task is, and how an MCP client follows one to its result.8 minCurrent step
- 2Check prerequisites and get the projectSet up your tools, get the project and inspect the sample images.8 minNot started
- 3Build an MCP server with Tasks supportRegister the image tool, return a task ID and serve task status.12 minNot started
- 4Build an MCP client with Tasks supportDeclare support, call the tool and poll for its result.12 minNot started
- 5Reconnect to a task and cancel workSave a task ID, return to the same batch and request cancellation.8 minNot started
- 6Handle an error and try your own imageRead a tool error, recover and apply what you learned.5 minNot started
- 7Wrap up and keep goingReview what you built and find the resources for taking Tasks further.3 minNot started


