From c22ba3f2a126706127b7af2a64f83fbb45b6cc87 Mon Sep 17 00:00:00 2001 From: Jhin Lee Date: Mon, 1 Jun 2026 02:47:31 -0400 Subject: [PATCH] Reject stateless legacy task status notifications --- lib/src/client/client.dart | 1 + lib/src/server/server.dart | 1 + test/mcp_2026_07_28_test.dart | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/lib/src/client/client.dart b/lib/src/client/client.dart index 0c0fdc9a..35defaf5 100644 --- a/lib/src/client/client.dart +++ b/lib/src/client/client.dart @@ -122,6 +122,7 @@ const Set _statelessRemovedRequestMethods = { const Set _statelessRemovedNotificationMethods = { Method.notificationsInitialized, Method.notificationsRootsListChanged, + Method.notificationsTasksStatus, }; /// An MCP client implementation built on top of a pluggable [Transport]. diff --git a/lib/src/server/server.dart b/lib/src/server/server.dart index e5da1fdb..d5a1f52d 100644 --- a/lib/src/server/server.dart +++ b/lib/src/server/server.dart @@ -76,6 +76,7 @@ class Server extends Protocol { static const Set _statelessRemovedNotificationMethods = { Method.notificationsInitialized, Method.notificationsRootsListChanged, + Method.notificationsTasksStatus, }; static const Set _inputRequiredResultMethods = { diff --git a/test/mcp_2026_07_28_test.dart b/test/mcp_2026_07_28_test.dart index ac69cfe4..5b82dbef 100644 --- a/test/mcp_2026_07_28_test.dart +++ b/test/mcp_2026_07_28_test.dart @@ -1541,6 +1541,18 @@ void main() { resultParams: const TaskResultRequest(taskId: 'task-1'), meta: taskExtensionMeta, ), + ) + ..receive( + JsonRpcTaskStatusNotification( + statusParams: const TaskStatusNotification( + taskId: 'task-1', + status: TaskStatus.working, + ttl: null, + createdAt: '2026-07-28T00:00:00Z', + lastUpdatedAt: '2026-07-28T00:00:00Z', + ), + meta: taskExtensionMeta, + ), ); await _pump(); @@ -2623,6 +2635,20 @@ void main() { method: Method.notificationsRootsListChanged, call: client.sendRootsListChanged, ), + ( + method: Method.notificationsTasksStatus, + call: () => client.notification( + JsonRpcTaskStatusNotification( + statusParams: const TaskStatusNotification( + taskId: 'task-1', + status: TaskStatus.working, + ttl: null, + createdAt: '2026-07-28T00:00:00Z', + lastUpdatedAt: '2026-07-28T00:00:00Z', + ), + ), + ), + ), ]; for (final scenario in removedNotifications) {