Skip to content

Conversation

yjacquin
Copy link
Owner

Update MCP protocol version to 2025-06-18

This branch regroups all issues to come from #109

  • Update PROTOCOL_VERSION constant from '2024-11-05' to '2025-06-18'
  • Add MCP-Protocol-Version header validation to BaseTransport
  • Implement protocol version validation in RackTransport
  • Add proper error responses for unsupported protocol versions
  • Maintain backward compatibility with lenient validation

Closes #109

@yjacquin yjacquin self-assigned this Jun 21, 2025
@yjacquin yjacquin requested a review from Copilot August 16, 2025 18:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive support for the MCP 2025-06-18 protocol revision by updating the protocol version, adding extensive test coverage, and implementing new transport layers with OAuth 2.1 support and metadata validation.

  • Updates PROTOCOL_VERSION constant from '2024-11-05' to '2025-06-18' throughout the codebase
  • Implements new StreamableHTTP transport with unified endpoint support and protocol version validation
  • Adds OAuth 2.1 compliant transport with scope-based authorization and RFC 9728 protected resource metadata

Reviewed Changes

Copilot reviewed 45 out of 53 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
spec/ files Comprehensive test coverage for new OAuth functionality, transport layers, and compliance validation
lib/mcp/transports/ New transport implementations including StreamableHTTP, OAuth, and authenticated variants
lib/mcp/protocol_version.rb Centralized protocol version definition
lib/mcp/oauth/ OAuth 2.1 implementation with token validation and resource server components
lib/mcp/metadata.rb Metadata validation with reserved prefix checking
examples/ Demonstration servers showing new transport capabilities

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

* Update MCP protocol version to 2025-06-18

- Update PROTOCOL_VERSION constant from '2024-11-05' to '2025-06-18'
- Add MCP-Protocol-Version header validation to BaseTransport
- Implement protocol version validation in RackTransport
- Add proper error responses for unsupported protocol versions
- Maintain backward compatibility with lenient validation

This implements Phase 1.1 of the MCP 2025-06-18 specification upgrade.
Implement comprehensive metadata validation and reserved namespace
protection for MCP 2025-06-18 specification compliance.

- **Metadata validation module** (`lib/mcp/metadata.rb`)
  - Reserved prefix protection (`mcp:`, `mcp-`)
  - Metadata structure validation
  - Sanitization and formatting utilities
  - Metadata merging capabilities

- **Tool class** (`lib/mcp/tool.rb`)
  - Metadata validation on key assignment
  - Reserved prefix error handling
  - Enhanced metadata management

- **Resource class** (`lib/mcp/resource.rb`)
  - Metadata module integration
  - Reserved namespace protection

- **Server class** (`lib/mcp/server.rb`)
  - Enhanced metadata sanitization in send_result
  - Automatic filtering of reserved keys
  - Improved metadata formatting

- **Comprehensive test coverage** (39 new tests)
  - Metadata validation tests
  - Reserved prefix protection tests
  - Tool/Resource metadata integration tests
  - Server metadata handling tests
  - Edge case and error condition coverage

- Tools and Resources now validate metadata keys
- Reserved `mcp:` and `mcp-` prefixes are blocked
- Metadata with invalid keys will raise ReservedMetadataError

- Existing valid metadata continues to work unchanged
- Only newly restricted prefixes cause errors
- Automatic sanitization prevents invalid metadata propagation

Resolves #110 - Enhanced _meta Field Support
Part of #109 - Support MCP 2025-06-18 Protocol Revision
* Add Streamable HTTP

* Finish OAuth

* remove authorization server related code and add docs

* Refact attempt for resource server behavior

* oauth and resource server spec fixes

* fix oauth streamable http transport specs

* fix token validator specs

* update docs

* doc changes
yjacquin and others added 10 commits October 4, 2025 17:20
- Fix critical audience binding logic bug in OAuth resource server
- Bump version to 1.7.0
- Add comprehensive CHANGELOG entry for v1.7.0
- Update README to mention MCP Protocol 2025-06-18 support
- Update logger TODO with implementation note
- Complete Rails integration guide documentation
- Remove implementation plan development artifact
- Fix broken cross-references in migration_guide.md, oauth-resource-server.md, and streamable_http_transport.md
- Standardize JWKS parameter name to jwks_uri across all documentation
- Replace references to non-existent files with correct documentation links
- All 370 tests still passing
- Add tests for allowed algorithms (HS256, HS384, HS512)
- Add test for rejecting unallowed algorithms (e.g., RS256)
- Ensures token validator properly validates algorithm whitelist
- All 374 tests passing
…y handle yield

- fixes issue with tools not being detected due to yield being used in
  called method
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.

Support MCP 2025-06-18 Protocol Revision
2 participants