feat(protocol): upgrade to MCP 2025-11-25 specification#81
Merged
Conversation
Phase 1 of the 2025-11-25 spec upgrade: - Add V_2025_11_25 protocol version constant - Update MCP_VERSION default to "2025-11-25" - Add 2025-11-25 to SUPPORTED_PROTOCOL_VERSIONS - Add optional `description` field to Implementation struct - Add Implementation::new() and Implementation::with_description() constructors - Add CallToolResult::input_validation_error() helper per spec guidance The 2025-11-25 spec clarifies that input validation errors should be returned as tool execution errors (isError: true) rather than protocol errors, enabling LLM self-correction. Ref: #80
Code Coverage Report 📊Local Coverage: 22.59%
Coverage Details📋 Full Report: View on Codecov |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
PR Validation ResultsQuick Validation: ✅
Validation Framework: ✅
Compatibility Check: ✅
Summary: ✅ All checks passed |
Add dual-mode elicitation support (form + url modes): - ElicitationCapability with form/url mode flags - ElicitationMode enum (form/url) - ElicitationRequestParam with mode, elicitation_id, url fields - ElicitationCompleteNotification for url mode completion - UrlElicitationRequiredData and UrlElicitationInfo - ErrorCode::UrlElicitationRequired (-32042) - Error::url_elicitation_required() helper Form mode remains default for backwards compatibility. URL mode enables OAuth flows and sensitive data entry.
…mpling Add complete sampling types with tool support: - SamplingCapability with tools/context support - CreateMessageRequestParam with tools, toolChoice, maxTokens - CreateMessageResult with stop_reason - ToolChoice and ToolChoiceMode (auto/required/none) - Content::ToolUse for LLM tool invocation requests - Content::ToolResult for returning tool execution results - ToolResultContent for text/image results - SamplingMessage, SamplingRole, SamplingContent - ModelPreferences with hints and priorities - ContextInclusion enum - stop_reasons module with standard constants Enables agentic workflows where servers request LLM sampling with tools, and handle multi-turn tool use conversations.
Add experimental support for long-running async operations: - TaskStatus enum with kebab-case serialization - Task struct with lifecycle methods and polling hints - TasksCapability and related capability types - Task request/response types (GetTask, ListTasks, CancelTask) - TaskStatusNotification for real-time updates - ToolExecution and TaskSupport for tool task configuration - Builder methods enable_tasks() and enable_tasks_basic() Update Tool struct across codebase with new execution field. Update mcp_tools macro to include execution field.
HTTP transport now validates Origin headers per MCP 2025-11-25 spec: - Returns 403 Forbidden for requests with invalid Origin - Returns 403 Forbidden for missing Origin when enforcement enabled - New StreamableHttpConfig fields: allowed_origins, enforce_origin_validation - New constructors: with_config(), with_origin_validation()
…2025-11-25) - Add /.well-known/openid-configuration endpoint for OIDC Discovery - Add client_id_metadata_document_supported to server metadata - Add ClientIdMetadataDocument struct and validation functions - Support 'none' and 'private_key_jwt' token endpoint auth methods - Add comprehensive tests for new endpoints
- Add SseEventId struct for stream identity and resumption - Add sse_retry_ms and sse_resumable config options - Implement Last-Event-ID header parsing for stream resumption - Generate event IDs per session for stream tracking - Send retry field to control client reconnection timing - Add comprehensive tests for SSE event ID encode/decode
Add comprehensive conformance test suite for MCP 2025-11-25 features: - Version negotiation tests (newest-to-oldest ordering) - Task lifecycle tests (status transitions, terminal states) - Tool calling in sampling tests (ToolChoice, Content variants) - URL mode elicitation tests (error codes, backwards compatibility) - Enhanced enum tests (single/multi-select schemas) - Implementation description field tests - Input validation error handling tests - Capability integration tests Update SUPPORTED_MCP_VERSIONS to include 2025-11-25 as latest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete implementation of MCP protocol version 2025-11-25, upgrading from the 2025-06-18 baseline.
Phase 1: Protocol Version & Minor Changes ✅
V_2025_11_25toProtocolVersionconstantsMCP_VERSIONdefault to"2025-11-25"descriptionfield toImplementationstructPhase 2: Enhanced Elicitation ✅
ElicitationModeenum (Form, Url)elicitation_idfor tracking URL flowsnotifications/elicitation/completenotification-32042(URLElicitationRequired)Phase 3: Tool Calling in Sampling ✅
SamplingCapabilitywith tools supportToolChoicewith auto/required/none modesContent::ToolUseandContent::ToolResultvariantsstop_reason: "tool_use"supportModelPreferencesandContextInclusionPhase 4: Tasks (Experimental) ✅
Taskstruct with full lifecycleTaskStatusenum (Working, InputRequired, Completed, Failed, Cancelled)TasksCapabilitywith cancel/list/requests supportToolExecutionwithTaskSupport(Forbidden, Optional, Required)Phase 5: Transport & Security ✅
/.well-known/openid-configuration)Phase 6: Testing & Validation ✅
Test Plan
Closes #80