docs: prepare for stable 3.0 release (#1073)
* docs: prepare for stable 3.0 release * docs: update stable spec code references
This commit is contained in:
parent
b429fc1240
commit
e54c2220af
5 changed files with 77 additions and 78 deletions
|
|
@ -171,7 +171,7 @@ impl<H: ServerHandler> Service<RoleServer> for H {
|
|||
let subscription_id = context.id.clone();
|
||||
let subscription =
|
||||
SubscriptionContext::establish(context, requested, accepted).await?;
|
||||
// The integrated draft schema defines a final result for graceful
|
||||
// The 2026-07-28 schema defines a final result for graceful
|
||||
// server teardown; explicit stdio cancellation remains a notification.
|
||||
self.listen(subscription).await.map(|()| {
|
||||
ServerResult::SubscriptionsListenResult(
|
||||
|
|
@ -405,7 +405,7 @@ macro_rules! server_handler_methods {
|
|||
///
|
||||
/// The SDK sends the acknowledgment before invoking this method. Returning
|
||||
/// `Ok(())` sends the final [`SubscriptionsListenResult`] defined by the
|
||||
/// integrated draft schema, marking graceful server teardown. Explicit
|
||||
/// 2026-07-28 schema, marking graceful server teardown. Explicit
|
||||
/// stdio cancellation uses `notifications/cancelled` instead.
|
||||
fn listen(
|
||||
&self,
|
||||
|
|
|
|||
|
|
@ -503,9 +503,9 @@ pub struct JsonRpcResponse<R = JsonObject> {
|
|||
#[expect(clippy::exhaustive_structs, reason = "intentionally exhaustive")]
|
||||
pub struct JsonRpcError {
|
||||
pub jsonrpc: JsonRpcVersion2_0,
|
||||
// MCP 2025-11-25 §Error Responses: `id` is optional and omitted when the
|
||||
// MCP 2026-07-28 §Error Responses: `id` is optional and omitted when the
|
||||
// server cannot read the request id (e.g. parse error / invalid request).
|
||||
// https://modelcontextprotocol.io/specification/2025-11-25/basic#error-responses
|
||||
// https://modelcontextprotocol.io/specification/2026-07-28/basic#error-responses
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<RequestId>,
|
||||
pub error: ErrorData,
|
||||
|
|
@ -1534,7 +1534,7 @@ macro_rules! paginated_result {
|
|||
/// the server handler clears the field when responding to peers that
|
||||
/// negotiated an older version.
|
||||
///
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/5bed7b30527019e34ccb0eb474636651424501f6/schema/draft/schema.ts#L225-L234
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/271ecc9accafdd9b83a3c869fa67c22953b2af80/schema/2026-07-28/schema.ts#L219-L235
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result_type: Option<ResultType>,
|
||||
#[serde(rename = "_meta", default, skip_serializing_if = "Option::is_none")]
|
||||
|
|
@ -1688,7 +1688,7 @@ pub struct ReadResourceResult {
|
|||
/// the server handler clears the field when responding to peers that
|
||||
/// negotiated an older version.
|
||||
///
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/5bed7b30527019e34ccb0eb474636651424501f6/schema/draft/schema.ts#L225-L234
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/271ecc9accafdd9b83a3c869fa67c22953b2af80/schema/2026-07-28/schema.ts#L219-L235
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result_type: Option<ResultType>,
|
||||
/// Time, in milliseconds, that this result may be treated as fresh (SEP-2549).
|
||||
|
|
@ -2046,7 +2046,7 @@ fn subscriptions_listen_request_meta_schema(
|
|||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||
#[non_exhaustive]
|
||||
pub struct SubscriptionsListenRequestParams {
|
||||
/// Protocol-level metadata. Required by the draft wire schema.
|
||||
/// Protocol-level metadata. Required by the 2026-07-28 wire schema.
|
||||
#[serde(rename = "_meta", skip_serializing_if = "Option::is_none")]
|
||||
#[cfg_attr(
|
||||
feature = "schemars",
|
||||
|
|
@ -3262,7 +3262,7 @@ pub struct CompleteResult {
|
|||
/// the server handler clears the field when responding to peers that
|
||||
/// negotiated an older version.
|
||||
///
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/5bed7b30527019e34ccb0eb474636651424501f6/schema/draft/schema.ts#L225-L234
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/271ecc9accafdd9b83a3c869fa67c22953b2af80/schema/2026-07-28/schema.ts#L219-L235
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result_type: Option<ResultType>,
|
||||
pub completion: CompletionInfo,
|
||||
|
|
@ -3721,7 +3721,7 @@ pub struct CallToolResult {
|
|||
/// the server handler clears the field when responding to peers that
|
||||
/// negotiated an older version.
|
||||
///
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/5bed7b30527019e34ccb0eb474636651424501f6/schema/draft/schema.ts#L225-L234
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/271ecc9accafdd9b83a3c869fa67c22953b2af80/schema/2026-07-28/schema.ts#L219-L235
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result_type: Option<ResultType>,
|
||||
/// The content returned by the tool (text, images, etc.)
|
||||
|
|
@ -4105,7 +4105,7 @@ pub struct GetPromptResult {
|
|||
/// the server handler clears the field when responding to peers that
|
||||
/// negotiated an older version.
|
||||
///
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/5bed7b30527019e34ccb0eb474636651424501f6/schema/draft/schema.ts#L225-L234
|
||||
/// [spec schema]: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/271ecc9accafdd9b83a3c869fa67c22953b2af80/schema/2026-07-28/schema.ts#L219-L235
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub result_type: Option<ResultType>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ impl schemars::JsonSchema for MetaObject {
|
|||
|
||||
fn json_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
|
||||
schemars::json_schema!({
|
||||
"description": "See [specification/draft/basic/index#general-fields] for notes on _meta usage.",
|
||||
"description": "See [MCP general fields](https://modelcontextprotocol.io/specification/2026-07-28/basic#general-fields) for notes on _meta usage.",
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
})
|
||||
|
|
@ -374,10 +374,9 @@ impl schemars::JsonSchema for MetaObject {
|
|||
/// - `io.modelcontextprotocol/clientCapabilities` (SEP-2575)
|
||||
/// - `io.modelcontextprotocol/logLevel` (SEP-2575)
|
||||
///
|
||||
/// The 2026-07-28 draft schema marks the protocol-version, client-info, and
|
||||
/// client-capabilities keys as required; earlier protocol versions do not know
|
||||
/// them. All keys therefore stay optional at runtime and in the generated
|
||||
/// (version-shared) JSON schema — use
|
||||
/// The 2026-07-28 schema defines required per-request metadata; earlier
|
||||
/// protocol versions do not know these keys. All keys therefore stay optional
|
||||
/// at runtime and in the generated (version-shared) JSON schema — use
|
||||
/// [`RequestMetaObject::missing_required_keys`] to validate a request against
|
||||
/// the negotiated protocol version.
|
||||
///
|
||||
|
|
@ -396,7 +395,7 @@ impl RequestMetaObject {
|
|||
const META_KEY_CLIENT_CAPABILITIES: &str = "io.modelcontextprotocol/clientCapabilities";
|
||||
const META_KEY_LOG_LEVEL: &str = "io.modelcontextprotocol/logLevel";
|
||||
|
||||
/// Request `_meta` keys the 2026-07-28 draft schema marks as required.
|
||||
/// Request `_meta` keys validated for the 2026-07-28 protocol.
|
||||
pub const DRAFT_REQUIRED_KEYS: [&str; 3] = [
|
||||
Self::META_KEY_PROTOCOL_VERSION,
|
||||
Self::META_KEY_CLIENT_INFO,
|
||||
|
|
@ -510,7 +509,7 @@ impl RequestMetaObject {
|
|||
/// meta.missing_required_keys(&ProtocolVersion::V_2025_11_25)
|
||||
/// .is_empty()
|
||||
/// );
|
||||
/// // The 2026-07-28 draft requires the SEP-2575 keys.
|
||||
/// // The 2026-07-28 protocol requires per-request context.
|
||||
/// assert_eq!(
|
||||
/// meta.missing_required_keys(&ProtocolVersion::V_2026_07_28),
|
||||
/// RequestMetaObject::DRAFT_REQUIRED_KEYS.to_vec(),
|
||||
|
|
@ -577,9 +576,9 @@ impl schemars::JsonSchema for RequestMetaObject {
|
|||
let client_capabilities = generator.subschema_for::<ClientCapabilities>();
|
||||
let log_level = generator.subschema_for::<LoggingLevel>();
|
||||
// rmcp generates one schema shared by every supported protocol
|
||||
// version, so the keys the 2026-07-28 draft marks as required are left
|
||||
// version, so the keys validated for 2026-07-28 are left
|
||||
// optional here: a 2025-11-25 request whose `_meta` only carries
|
||||
// `progressToken` is valid. Draft-strict validation is available at
|
||||
// `progressToken` is valid. Version-specific validation is available at
|
||||
// runtime via [`RequestMetaObject::missing_required_keys`].
|
||||
schemars::json_schema!({
|
||||
"description": "Metadata reserved by MCP on requests. Extension keys are also allowed.",
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ pub enum AuthorizationMetadataSource {
|
|||
/// [Newer MCP revisions] require metadata discovery and do not define an
|
||||
/// endpoint-synthesis fallback.
|
||||
///
|
||||
/// [Newer MCP revisions]: https://modelcontextprotocol.io/specification/draft/basic/authorization/authorization-server-discovery#protected-resource-metadata-discovery-requirements
|
||||
/// [Newer MCP revisions]: https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/authorization-server-discovery#protected-resource-metadata-discovery-requirements
|
||||
LegacyEndpointFallback,
|
||||
}
|
||||
|
||||
|
|
@ -705,7 +705,7 @@ impl OAuthClientConfig {
|
|||
/// Declarative description of the client identity material available for an
|
||||
/// authorization flow.
|
||||
///
|
||||
/// The [MCP authorization specification](https://modelcontextprotocol.io/specification/draft/basic/authorization/client-registration)
|
||||
/// The [MCP authorization specification](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration)
|
||||
/// recommends that clients obtain a client ID using the following priority
|
||||
/// order. [`OAuthState::start_authorization`] and [`AuthorizationSession::new`]
|
||||
/// apply it internally:
|
||||
|
|
@ -3245,7 +3245,7 @@ pub struct AuthorizationSession {
|
|||
|
||||
impl AuthorizationSession {
|
||||
/// Create a new authorization session, selecting a client registration
|
||||
/// mechanism per the [MCP authorization specification](https://modelcontextprotocol.io/specification/draft/basic/authorization/client-registration)
|
||||
/// mechanism per the [MCP authorization specification](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration)
|
||||
/// priority order:
|
||||
///
|
||||
/// 1. Pre-registered client information
|
||||
|
|
@ -3600,7 +3600,7 @@ impl OAuthState {
|
|||
/// Start authorization.
|
||||
///
|
||||
/// Selects a client registration mechanism from the identity material in
|
||||
/// `request`, following the [MCP authorization specification](https://modelcontextprotocol.io/specification/draft/basic/authorization/client-registration)
|
||||
/// `request`, following the [MCP authorization specification](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/client-registration)
|
||||
/// priority order:
|
||||
///
|
||||
/// 1. Pre-registered client information
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ pub struct StreamableHttpServerConfig {
|
|||
/// When enabled, SSE priming events are sent to enable client reconnection.
|
||||
///
|
||||
/// Only applies to legacy protocol versions (`< 2026-07-28`). Per SEP-2567,
|
||||
/// sessions are removed from the `2026-07-28` draft version, so requests
|
||||
/// sessions are removed from the `2026-07-28` version, so requests
|
||||
/// negotiating that version are always served statelessly regardless of
|
||||
/// this setting.
|
||||
pub legacy_session_mode: bool,
|
||||
|
|
@ -745,7 +745,7 @@ fn validate_origin_header(
|
|||
/// # Streamable HTTP server
|
||||
///
|
||||
/// An HTTP service that implements the
|
||||
/// [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#streamable-http)
|
||||
/// [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http)
|
||||
/// for MCP servers.
|
||||
///
|
||||
/// ## Session management
|
||||
|
|
|
|||
Loading…
Reference in a new issue