Skip to content

v0.3.0

Choose a tag to compare

@github-actions github-actions released this 29 Oct 06:47
· 239 commits to master since this release

v0.3.0 adds the 2026-07-28 Tasks extension (io.modelcontextprotocol/tasks) to the server and the client.

Highlights

  • Long-running tools as tasks. A tool handler can answer a tools/call with a task by returning server.NewTaskResult(ctx, handlerID, ...). The client then polls tasks/get, and can cancel with tasks/cancel or answer input with tasks/update.
    • FlexMCP stores nothing about a task. A TaskHandler you provide owns the work and its state.
    • server.NewMemoryTasks is a ready-made in-memory handler: MemoryTasks.Run hands the call over when the request allows it, and otherwise runs the work synchronously.
  • Unguessable task ids, bound to the caller. A task id is sealed with an HMAC, not looked up. Set WithTaskKey so ids survive a restart and work across instances, and WithTaskCaller so one caller cannot read another's tasks.
  • Client support. GetExtensionTask, CancelExtensionTask, UpdateExtensionTask and WaitForExtensionTask. A refused id is a typed mcp.TaskRefusedError; mcp.IsTaskGone tells you to call the tool again.
  • Both eras kept apart. The 2025-11-25 tasks (AddTaskTool, params.task) serve initialize-era requests only. On a 2026-07-28 request, params.task is ignored, task-only tools are hidden, and execution is dropped from tools/list.
  • Works with Claude Code. Checked live against Claude Code 2.1.312, which declares the extension on its tools/call and tasks/get and polls at the interval the server asks for. It does not declare it on every call, so a tool must still answer synchronously when no task is possible; MemoryTasks.Run does.
  • Documented and runnable. See Tasks and examples/tasks_extension.

Changes you may notice

  • The task result options are WithTaskResultPollInterval, WithTaskResultTTL, WithTaskResultStatusMessage and WithTaskResultCreatedAt. The WithTask* names already belong to the 2025-11-25 tasks.
  • Run handed-over work under server.DetachTaskContext(ctx). It keeps the request's values and drops its cancellation, its session and its task stamp. MemoryTasks.Run does this for you.
  • On a 2026-07-28 request, tasks/get, tasks/cancel and tasks/update fire only the untyped hooks (BeforeAny, OnSuccess, OnError). The typed task hooks are for earlier revisions.
  • On a 2026-07-28 connection, the client's old GetTask, CancelTask, WaitForTask, TaskResult and ListTasks return ErrLegacyTaskMethod.
  • WithExtensions copies its map. Given a tasks entry without a task handler, it panics at construction.
  • A client may leave without cancelling its task, so choose a TTL that bounds abandoned work. MemoryTasks defaults to one hour.
  • mcp.WithModelImmediateResponse is deprecated. The server never sends it in the answer to a task-augmented call.

Fixes

  • Output schema validation now judges a result's raw structured content when the result carries it. Before, raw content that broke the schema could be sent unchecked.
  • A tool re-registered while a call is in flight:
    • its Mcp-Param-* header bindings are now enforced on that call;
    • a 2025-11-25 task-augmented call now runs the registration the tool filters authorized.
  • Tool filters on a 2026-07-28 tools/call see the same tool that tools/list showed them.

Known issues

  • At a very small result-size limit, the answer that hands a call over can be replaced by a size error after the task has started. Keep the limit well above the size of a task answer.

Install

go get github.com/pbednarcik/flexmcp@v0.3.0

The OpenTelemetry adapter is unchanged: github.com/pbednarcik/flexmcp/otel@v0.2.0.