feat: add subscription listen streams (SEP-2575) (#1000)

* feat: add subscription listen streams

* refactor: reuse legacy request helper
This commit is contained in:
Dale Seo 2026-07-21 09:53:04 -04:00 • committed by GitHub
commit ff1a715b6e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 3617 additions and 223 deletions

View file

@ -1160,21 +1160,24 @@
{
"$ref": "#/definitions/Request9"
},
{
"$ref": "#/definitions/RequestOptionalParam4"
},
{
"$ref": "#/definitions/Request10"
},
{
"$ref": "#/definitions/RequestOptionalParam5"
"$ref": "#/definitions/RequestOptionalParam4"
},
{
"$ref": "#/definitions/Request11"
},
{
"$ref": "#/definitions/RequestOptionalParam5"
},
{
"$ref": "#/definitions/Request12"
},
{
"$ref": "#/definitions/Request13"
},
{
"$ref": "#/definitions/CustomRequest"
}
@ -1567,6 +1570,22 @@
]
},
"Request10": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/CallToolRequestMethod"
},
"params": {
"$ref": "#/definitions/CallToolRequestParams"
}
},
"required": [
"method",
"params"
]
},
"Request11": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1582,7 +1601,7 @@
"params"
]
},
"Request11": {
"Request12": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1598,7 +1617,7 @@
"params"
]
},
"Request12": {
"Request13": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1699,10 +1718,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/SubscribeRequestMethod"
"$ref": "#/definitions/SubscriptionsListenRequestMethod"
},
"params": {
"$ref": "#/definitions/SubscribeRequestParams"
"$ref": "#/definitions/SubscriptionsListenRequestParams"
}
},
"required": [
@ -1715,10 +1734,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/UnsubscribeRequestMethod"
"$ref": "#/definitions/SubscribeRequestMethod"
},
"params": {
"$ref": "#/definitions/UnsubscribeRequestParams"
"$ref": "#/definitions/SubscribeRequestParams"
}
},
"required": [
@ -1731,10 +1750,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/CallToolRequestMethod"
"$ref": "#/definitions/UnsubscribeRequestMethod"
},
"params": {
"$ref": "#/definitions/CallToolRequestParams"
"$ref": "#/definitions/UnsubscribeRequestParams"
}
},
"required": [
@ -2303,6 +2322,77 @@
"uri"
]
},
"SubscriptionFilter": {
"description": "Notification categories a client opts in to on a `subscriptions/listen` stream.",
"type": "object",
"properties": {
"promptsListChanged": {
"type": "boolean"
},
"resourceSubscriptions": {
"type": "array",
"items": {
"type": "string"
}
},
"resourcesListChanged": {
"type": "boolean"
},
"toolsListChanged": {
"type": "boolean"
}
}
},
"SubscriptionsListenRequestMethod": {
"type": "string",
"format": "const",
"const": "subscriptions/listen"
},
"SubscriptionsListenRequestParams": {
"description": "Parameters for opening a long-lived notification subscription.",
"type": "object",
"properties": {
"_meta": {
"description": "Protocol-level metadata. Required by the draft wire schema.",
"type": "object",
"properties": {
"io.modelcontextprotocol/clientCapabilities": {
"$ref": "#/definitions/ClientCapabilities"
},
"io.modelcontextprotocol/clientInfo": {
"$ref": "#/definitions/Implementation"
},
"io.modelcontextprotocol/logLevel": {
"$ref": "#/definitions/LoggingLevel"
},
"io.modelcontextprotocol/protocolVersion": {
"type": "string"
},
"progressToken": {
"$ref": "#/definitions/ProgressToken"
}
},
"additionalProperties": true,
"required": [
"io.modelcontextprotocol/protocolVersion",
"io.modelcontextprotocol/clientInfo",
"io.modelcontextprotocol/clientCapabilities"
]
},
"notifications": {
"description": "Notification categories requested for this stream.",
"allOf": [
{
"$ref": "#/definitions/SubscriptionFilter"
}
]
}
},
"required": [
"_meta",
"notifications"
]
},
"TaskMetadata": {
"description": "Metadata for augmenting a request with task execution (spec `TaskMetadata`).",
"type": "object",

View file

@ -1160,21 +1160,24 @@
{
"$ref": "#/definitions/Request9"
},
{
"$ref": "#/definitions/RequestOptionalParam4"
},
{
"$ref": "#/definitions/Request10"
},
{
"$ref": "#/definitions/RequestOptionalParam5"
"$ref": "#/definitions/RequestOptionalParam4"
},
{
"$ref": "#/definitions/Request11"
},
{
"$ref": "#/definitions/RequestOptionalParam5"
},
{
"$ref": "#/definitions/Request12"
},
{
"$ref": "#/definitions/Request13"
},
{
"$ref": "#/definitions/CustomRequest"
}
@ -1567,6 +1570,22 @@
]
},
"Request10": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/CallToolRequestMethod"
},
"params": {
"$ref": "#/definitions/CallToolRequestParams"
}
},
"required": [
"method",
"params"
]
},
"Request11": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1582,7 +1601,7 @@
"params"
]
},
"Request11": {
"Request12": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1598,7 +1617,7 @@
"params"
]
},
"Request12": {
"Request13": {
"description": "Represents a JSON-RPC request with method, parameters, and extensions.\n\nThis is the core structure for all MCP requests, containing:\n- `method`: The name of the method being called\n- `params`: The parameters for the method\n- `extensions`: Additional context data (similar to HTTP headers)",
"type": "object",
"properties": {
@ -1699,10 +1718,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/SubscribeRequestMethod"
"$ref": "#/definitions/SubscriptionsListenRequestMethod"
},
"params": {
"$ref": "#/definitions/SubscribeRequestParams"
"$ref": "#/definitions/SubscriptionsListenRequestParams"
}
},
"required": [
@ -1715,10 +1734,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/UnsubscribeRequestMethod"
"$ref": "#/definitions/SubscribeRequestMethod"
},
"params": {
"$ref": "#/definitions/UnsubscribeRequestParams"
"$ref": "#/definitions/SubscribeRequestParams"
}
},
"required": [
@ -1731,10 +1750,10 @@
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/CallToolRequestMethod"
"$ref": "#/definitions/UnsubscribeRequestMethod"
},
"params": {
"$ref": "#/definitions/CallToolRequestParams"
"$ref": "#/definitions/UnsubscribeRequestParams"
}
},
"required": [
@ -2303,6 +2322,77 @@
"uri"
]
},
"SubscriptionFilter": {
"description": "Notification categories a client opts in to on a `subscriptions/listen` stream.",
"type": "object",
"properties": {
"promptsListChanged": {
"type": "boolean"
},
"resourceSubscriptions": {
"type": "array",
"items": {
"type": "string"
}
},
"resourcesListChanged": {
"type": "boolean"
},
"toolsListChanged": {
"type": "boolean"
}
}
},
"SubscriptionsListenRequestMethod": {
"type": "string",
"format": "const",
"const": "subscriptions/listen"
},
"SubscriptionsListenRequestParams": {
"description": "Parameters for opening a long-lived notification subscription.",
"type": "object",
"properties": {
"_meta": {
"description": "Protocol-level metadata. Required by the draft wire schema.",
"type": "object",
"properties": {
"io.modelcontextprotocol/clientCapabilities": {
"$ref": "#/definitions/ClientCapabilities"
},
"io.modelcontextprotocol/clientInfo": {
"$ref": "#/definitions/Implementation"
},
"io.modelcontextprotocol/logLevel": {
"$ref": "#/definitions/LoggingLevel"
},
"io.modelcontextprotocol/protocolVersion": {
"type": "string"
},
"progressToken": {
"$ref": "#/definitions/ProgressToken"
}
},
"additionalProperties": true,
"required": [
"io.modelcontextprotocol/protocolVersion",
"io.modelcontextprotocol/clientInfo",
"io.modelcontextprotocol/clientCapabilities"
]
},
"notifications": {
"description": "Notification categories requested for this stream.",
"allOf": [
{
"$ref": "#/definitions/SubscriptionFilter"
}
]
}
},
"required": [
"_meta",
"notifications"
]
},
"TaskMetadata": {
"description": "Metadata for augmenting a request with task execution (spec `TaskMetadata`).",
"type": "object",

View file

@ -1650,6 +1650,9 @@
{
"$ref": "#/definitions/Notification5"
},
{
"$ref": "#/definitions/Notification6"
},
{
"$ref": "#/definitions/CustomNotification"
}
@ -2222,6 +2225,21 @@
]
},
"Notification5": {
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/SubscriptionsAcknowledgedNotificationMethod"
},
"params": {
"$ref": "#/definitions/SubscriptionsAcknowledgedNotificationParams"
}
},
"required": [
"method",
"params"
]
},
"Notification6": {
"type": "object",
"properties": {
"method": {
@ -3295,6 +3313,9 @@
{
"$ref": "#/definitions/ReadResourceResult"
},
{
"$ref": "#/definitions/SubscriptionsListenResult"
},
{
"$ref": "#/definitions/ListToolsResult"
},
@ -3438,6 +3459,75 @@
"format": "const",
"const": "string"
},
"SubscriptionFilter": {
"description": "Notification categories a client opts in to on a `subscriptions/listen` stream.",
"type": "object",
"properties": {
"promptsListChanged": {
"type": "boolean"
},
"resourceSubscriptions": {
"type": "array",
"items": {
"type": "string"
}
},
"resourcesListChanged": {
"type": "boolean"
},
"toolsListChanged": {
"type": "boolean"
}
}
},
"SubscriptionsAcknowledgedNotificationMethod": {
"type": "string",
"format": "const",
"const": "notifications/subscriptions/acknowledged"
},
"SubscriptionsAcknowledgedNotificationParams": {
"description": "Parameters reporting the accepted subset of a subscription filter.",
"type": "object",
"properties": {
"_meta": {
"$ref": "#/definitions/NotificationMetaObject"
},
"notifications": {
"$ref": "#/definitions/SubscriptionFilter"
}
},
"required": [
"notifications"
]
},
"SubscriptionsListenResult": {
"description": "Final response indicating that a subscription ended gracefully.",
"type": "object",
"properties": {
"_meta": {
"$ref": "#/definitions/SubscriptionsListenResultMeta"
},
"resultType": {
"$ref": "#/definitions/ResultType"
}
},
"required": [
"resultType",
"_meta"
]
},
"SubscriptionsListenResultMeta": {
"type": "object",
"properties": {
"io.modelcontextprotocol/subscriptionId": {
"$ref": "#/definitions/NumberOrString"
}
},
"additionalProperties": true,
"required": [
"io.modelcontextprotocol/subscriptionId"
]
},
"Task": {
"description": "Primary Task object that surfaces metadata during the task lifecycle.\n\nPer spec, `lastUpdatedAt` and `ttl` are required fields.\n`ttl` is nullable (`null` means unlimited retention).",
"type": "object",

View file

@ -1650,6 +1650,9 @@
{
"$ref": "#/definitions/Notification5"
},
{
"$ref": "#/definitions/Notification6"
},
{
"$ref": "#/definitions/CustomNotification"
}
@ -2222,6 +2225,21 @@
]
},
"Notification5": {
"type": "object",
"properties": {
"method": {
"$ref": "#/definitions/SubscriptionsAcknowledgedNotificationMethod"
},
"params": {
"$ref": "#/definitions/SubscriptionsAcknowledgedNotificationParams"
}
},
"required": [
"method",
"params"
]
},
"Notification6": {
"type": "object",
"properties": {
"method": {
@ -3295,6 +3313,9 @@
{
"$ref": "#/definitions/ReadResourceResult"
},
{
"$ref": "#/definitions/SubscriptionsListenResult"
},
{
"$ref": "#/definitions/ListToolsResult"
},
@ -3438,6 +3459,75 @@
"format": "const",
"const": "string"
},
"SubscriptionFilter": {
"description": "Notification categories a client opts in to on a `subscriptions/listen` stream.",
"type": "object",
"properties": {
"promptsListChanged": {
"type": "boolean"
},
"resourceSubscriptions": {
"type": "array",
"items": {
"type": "string"
}
},
"resourcesListChanged": {
"type": "boolean"
},
"toolsListChanged": {
"type": "boolean"
}
}
},
"SubscriptionsAcknowledgedNotificationMethod": {
"type": "string",
"format": "const",
"const": "notifications/subscriptions/acknowledged"
},
"SubscriptionsAcknowledgedNotificationParams": {
"description": "Parameters reporting the accepted subset of a subscription filter.",
"type": "object",
"properties": {
"_meta": {
"$ref": "#/definitions/NotificationMetaObject"
},
"notifications": {
"$ref": "#/definitions/SubscriptionFilter"
}
},
"required": [
"notifications"
]
},
"SubscriptionsListenResult": {
"description": "Final response indicating that a subscription ended gracefully.",
"type": "object",
"properties": {
"_meta": {
"$ref": "#/definitions/SubscriptionsListenResultMeta"
},
"resultType": {
"$ref": "#/definitions/ResultType"
}
},
"required": [
"resultType",
"_meta"
]
},
"SubscriptionsListenResultMeta": {
"type": "object",
"properties": {
"io.modelcontextprotocol/subscriptionId": {
"$ref": "#/definitions/NumberOrString"
}
},
"additionalProperties": true,
"required": [
"io.modelcontextprotocol/subscriptionId"
]
},
"Task": {
"description": "Primary Task object that surfaces metadata during the task lifecycle.\n\nPer spec, `lastUpdatedAt` and `ttl` are required fields.\n`ttl` is nullable (`null` means unlimited retention).",
"type": "object",