Skip to content

feat(protocol): upgrade to MCP 2025-11-25 specification#81

Merged
avrabe merged 8 commits intomainfrom
feature/mcp-2025-11-25-phase1
Dec 11, 2025
Merged

feat(protocol): upgrade to MCP 2025-11-25 specification#81
avrabe merged 8 commits intomainfrom
feature/mcp-2025-11-25-phase1

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Dec 10, 2025

Summary

Complete implementation of MCP protocol version 2025-11-25, upgrading from the 2025-06-18 baseline.

Phase 1: Protocol Version & Minor Changes ✅

  • Add V_2025_11_25 to ProtocolVersion constants
  • Update MCP_VERSION default to "2025-11-25"
  • Add description field to Implementation struct
  • Input validation errors returned as Tool Execution Errors

Phase 2: Enhanced Elicitation ✅

  • URL mode elicitation support
  • ElicitationMode enum (Form, Url)
  • elicitation_id for tracking URL flows
  • notifications/elicitation/complete notification
  • Error code -32042 (URLElicitationRequired)
  • Enhanced enum support (single/multi-select with titles)

Phase 3: Tool Calling in Sampling ✅

  • SamplingCapability with tools support
  • ToolChoice with auto/required/none modes
  • Content::ToolUse and Content::ToolResult variants
  • stop_reason: "tool_use" support
  • ModelPreferences and ContextInclusion

Phase 4: Tasks (Experimental) ✅

  • Task struct with full lifecycle
  • TaskStatus enum (Working, InputRequired, Completed, Failed, Cancelled)
  • TasksCapability with cancel/list/requests support
  • ToolExecution with TaskSupport (Forbidden, Optional, Required)
  • Task notifications and pagination

Phase 5: Transport & Security ✅

  • Origin header validation in HTTP transport
  • OpenID Connect Discovery (/.well-known/openid-configuration)
  • Client ID Metadata Documents support
  • SSE polling with event IDs and stream resumption

Phase 6: Testing & Validation ✅

  • 43 MCP 2025-11-25 conformance tests
  • Version negotiation tests
  • Task lifecycle tests
  • Tool calling in sampling tests
  • URL mode elicitation tests
  • Enhanced enum tests

Test Plan

  • All existing tests pass (1000+ tests)
  • New conformance tests pass (43 tests)
  • Backwards compatible with 2025-06-18 and earlier
  • Pre-commit hooks pass (rustfmt, clippy)

Closes #80

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
@github-actions
Copy link

github-actions bot commented Dec 10, 2025

Code Coverage Report 📊

Local Coverage: 22.59%
Validation: Handled by Codecov

Note: Coverage validation is now performed by Codecov to ensure consistency across all platforms.

Coverage Details
Filename                                                  Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
integration-tests/src/auth_server_integration.rs              392                61    84.44%          26                 9    65.38%         290                69    76.21%           0                 0         -
integration-tests/src/cli_server_integration.rs               401                32    92.02%          35                 5    85.71%         355                23    93.52%           0                 0         -
integration-tests/src/end_to_end_scenarios.rs                 923               176    80.93%          40                 9    77.50%         636                94    85.22%           0                 0         -
integration-tests/src/lib.rs                                   22                12    45.45%           5                 2    60.00%          44                17    61.36%           0                 0         -
integration-tests/src/monitoring_integration.rs               440                66    85.00%          28                 8    71.43%         374                82    78.07%           0                 0         -
integration-tests/src/transport_server_integration.rs         450               119    73.56%          31                11    64.52%         384               143    62.76%           0                 0         -
mcp-auth/src/audit.rs                                         390               262    32.82%          28                17    39.29%         276               177    35.87%           0                 0         -
mcp-auth/src/config.rs                                         48                41    14.58%          11                10     9.09%          75                68     9.33%           0                 0         -
mcp-auth/src/crypto/encryption.rs                              89                89     0.00%           9                 9     0.00%          51                51     0.00%           0                 0         -
mcp-auth/src/crypto/hashing.rs                                 98                98     0.00%          10                10     0.00%          53                53     0.00%           0                 0         -
mcp-auth/src/crypto/keys.rs                                   115               115     0.00%           8                 8     0.00%          78                78     0.00%           0                 0         -
mcp-auth/src/crypto/mod.rs                                     15                15     0.00%           2                 2     0.00%          12                12     0.00%           0                 0         -
mcp-auth/src/jwt.rs                                           321               284    11.53%          29                27     6.90%         255               226    11.37%           0                 0         -
mcp-auth/src/lib.rs                                            18                15    16.67%           6                 5    16.67%          16                13    18.75%           0                 0         -
mcp-auth/src/manager.rs                                      1258              1116    11.29%         117               101    13.68%         938               794    15.35%           0                 0         -
mcp-auth/src/middleware/mcp_auth.rs                           235               235     0.00%          24                24     0.00%         206               206     0.00%           0                 0         -
mcp-auth/src/middleware/session_middleware.rs                 430               430     0.00%          41                41     0.00%         357               357     0.00%           0                 0         -
mcp-auth/src/models.rs                                        195               195     0.00%          19                19     0.00%         166               166     0.00%           0                 0         -
mcp-auth/src/oauth/authorize.rs                               159               159     0.00%          20                20     0.00%         232               232     0.00%           0                 0         -
mcp-auth/src/oauth/bearer.rs                                  159               159     0.00%          16                16     0.00%         111               111     0.00%           0                 0         -
mcp-auth/src/oauth/client_metadata.rs                          65                65     0.00%           8                 8     0.00%          59                59     0.00%           0                 0         -
mcp-auth/src/oauth/metadata.rs                                 75                75     0.00%           7                 7     0.00%          58                58     0.00%           0                 0         -
mcp-auth/src/oauth/mod.rs                                      28                28     0.00%           3                 3     0.00%          23                23     0.00%           0                 0         -
mcp-auth/src/oauth/models.rs                                   30                30     0.00%           6                 6     0.00%          42                42     0.00%           0                 0         -
mcp-auth/src/oauth/pkce.rs                                     45                45     0.00%           5                 5     0.00%          27                27     0.00%           0                 0         -
mcp-auth/src/oauth/registration.rs                            105               105     0.00%           7                 7     0.00%         106               106     0.00%           0                 0         -
mcp-auth/src/oauth/resource.rs                                 19                19     0.00%           3                 3     0.00%          13                13     0.00%           0                 0         -
mcp-auth/src/oauth/storage.rs                                 124               124     0.00%          17                17     0.00%          81                81     0.00%           0                 0         -
mcp-auth/src/oauth/token.rs                                   229               229     0.00%          24                24     0.00%         280               280     0.00%           0                 0         -
mcp-auth/src/permissions/mcp_permissions.rs                   419               419     0.00%          33                33     0.00%         319               319     0.00%           0                 0         -
mcp-auth/src/security/request_security.rs                     702               702     0.00%          49                49     0.00%         615               615     0.00%           0                 0         -
mcp-auth/src/session/session_manager.rs                       457               457     0.00%          50                50     0.00%         353               353     0.00%           0                 0         -
mcp-auth/src/storage.rs                                       697               680     2.44%          50                46     8.00%         412               394     4.37%           0                 0         -
mcp-auth/src/transport/auth_extractors.rs                     155               155     0.00%          27                27     0.00%         137               137     0.00%           0                 0         -
mcp-auth/src/transport/http_auth.rs                           303               303     0.00%          20                20     0.00%         216               216     0.00%           0                 0         -
mcp-auth/src/transport/stdio_auth.rs                          268               268     0.00%          22                22     0.00%         195               195     0.00%           0                 0         -
mcp-auth/src/transport/websocket_auth.rs                      351               351     0.00%          23                23     0.00%         258               258     0.00%           0                 0         -
mcp-auth/src/validation.rs                                    144               144     0.00%          13                13     0.00%          95                95     0.00%           0                 0         -
mcp-logging/src/aggregation.rs                                311               311     0.00%          27                27     0.00%         228               228     0.00%           0                 0         -
mcp-logging/src/alerting.rs                                   552               344    37.68%          39                17    56.41%         419               226    46.06%           0                 0         -
mcp-logging/src/correlation.rs                                415               415     0.00%          34                34     0.00%         299               299     0.00%           0                 0         -
mcp-logging/src/dashboard.rs                                  391               197    49.62%          21                15    28.57%         394               182    53.81%           0                 0         -
mcp-logging/src/metrics.rs                                    306               127    58.50%          36                19    47.22%         329               123    62.61%           0                 0         -
mcp-logging/src/persistence.rs                                360               360     0.00%          26                26     0.00%         202               202     0.00%           0                 0         -
mcp-logging/src/profiling.rs                                  502               496     1.20%          37                36     2.70%         398               354    11.06%           0                 0         -
mcp-logging/src/sanitization.rs                               268               265     1.12%          22                21     4.55%         181               173     4.42%           0                 0         -
mcp-logging/src/structured.rs                                 258               255     1.16%          24                23     4.17%         230               227     1.30%           0                 0         -
mcp-logging/src/telemetry.rs                                   75                34    54.67%          12                 5    58.33%          78                24    69.23%           0                 0         -
mcp-protocol/src/error.rs                                     206               166    19.42%          28                19    32.14%         164               130    20.73%           0                 0         -
mcp-protocol/src/errors.rs                                     83                83     0.00%          12                12     0.00%          40                40     0.00%           0                 0         -
mcp-protocol/src/lib.rs                                        12                12     0.00%           2                 2     0.00%          11                11     0.00%           0                 0         -
mcp-protocol/src/model.rs                                     568               552     2.82%          92                89     3.26%         666               652     2.10%           0                 0         -
mcp-protocol/src/validation.rs                                238               238     0.00%          25                25     0.00%         176               176     0.00%           0                 0         -
mcp-security/src/config.rs                                      4                 0   100.00%           1                 0   100.00%           9                 0   100.00%           0                 0         -
mcp-security/src/lib.rs                                         3                 0   100.00%           1                 0   100.00%           3                 0   100.00%           0                 0         -
mcp-security/src/middleware.rs                                 18                 3    83.33%           3                 0   100.00%          25                 3    88.00%           0                 0         -
mcp-security/src/validation.rs                                 10                10     0.00%           1                 1     0.00%          11                11     0.00%           0                 0         -
mcp-server/src/alerting_endpoint.rs                           117               117     0.00%          15                15     0.00%         110               110     0.00%           0                 0         -
mcp-server/src/backend.rs                                     114                99    13.16%          26                22    15.38%          99                86    13.13%           0                 0         -
mcp-server/src/builder_trait.rs                                44                44     0.00%           3                 3     0.00%          37                37     0.00%           0                 0         -
mcp-server/src/cli_helpers.rs                                  94                80    14.89%          17                14    17.65%          83                73    12.05%           0                 0         -
mcp-server/src/common_backend.rs                               57                57     0.00%          11                11     0.00%          79                79     0.00%           0                 0         -
mcp-server/src/context.rs                                      55                14    74.55%          10                 3    70.00%          46                16    65.22%           0                 0         -
mcp-server/src/dashboard_endpoint.rs                          104               104     0.00%          12                12     0.00%          79                79     0.00%           0                 0         -
mcp-server/src/handler.rs                                     344               235    31.69%          57                34    40.35%         248               152    38.71%           0                 0         -
mcp-server/src/health_endpoint.rs                              83                83     0.00%           5                 5     0.00%          91                91     0.00%           0                 0         -
mcp-server/src/metrics_endpoint.rs                            133               133     0.00%           7                 7     0.00%          86                86     0.00%           0                 0         -
mcp-server/src/middleware.rs                                  128                33    74.22%          13                 5    61.54%         104                17    83.65%           0                 0         -
mcp-server/src/observability/collector.rs                     179                78    56.42%          19                 8    57.89%         133                52    60.90%           0                 0         -
mcp-server/src/observability/config.rs                          3                 0   100.00%           1                 0   100.00%           8                 0   100.00%           0                 0         -
mcp-server/src/observability/metrics.rs                         3                 3     0.00%           1                 1     0.00%          11                11     0.00%           0                 0         -
mcp-server/src/observability/mod.rs                             3                 0   100.00%           1                 0   100.00%           3                 0   100.00%           0                 0         -
mcp-server/src/server.rs                                      328               111    66.16%          38                19    50.00%         229                77    66.38%           0                 0         -
mcp-transport/src/batch.rs                                    195               195     0.00%          14                14     0.00%         128               128     0.00%           0                 0         -
mcp-transport/src/config.rs                                    15                12    20.00%           5                 4    20.00%          15                12    20.00%           0                 0         -
mcp-transport/src/http.rs                                     651               634     2.61%          39                36     7.69%         438               408     6.85%           0                 0         -
mcp-transport/src/lib.rs                                       13                 3    76.92%           1                 0   100.00%          12                 3    75.00%           0                 0         -
mcp-transport/src/stdio.rs                                    233               186    20.17%          17                12    29.41%         162               119    26.54%           0                 0         -
mcp-transport/src/streamable_http.rs                          422               422     0.00%          32                32     0.00%         321               321     0.00%           0                 0         -
mcp-transport/src/validation.rs                               193               193     0.00%          14                14     0.00%         135               135     0.00%           0                 0         -
mcp-transport/src/websocket.rs                                 15                 9    40.00%           5                 3    40.00%          17                11    35.29%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                       18480             14591    21.04%        1678              1361    18.89%       14735             11407    22.59%           0                 0         -

📋 Full Report: View on Codecov

@codecov
Copy link

codecov bot commented Dec 10, 2025

@github-actions
Copy link

github-actions bot commented Dec 10, 2025

PR Validation Results

Quick Validation: ✅

  • Format check
  • Clippy lints
  • Unit tests
  • Documentation

Validation Framework: ✅

  • Framework tests
  • Property-based tests
  • CLI tools

Compatibility Check: ✅

  • Protocol compliance
  • Server compatibility

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.
@avrabe avrabe changed the title feat(protocol): upgrade to MCP 2025-11-25 specification (Phase 1) feat(protocol): upgrade to MCP 2025-11-25 specification Dec 11, 2025
@avrabe avrabe merged commit 6e567c1 into main Dec 11, 2025
22 checks passed
@avrabe avrabe deleted the feature/mcp-2025-11-25-phase1 branch December 11, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to MCP 2025-11-25 Specification

1 participant