Skip to content

fix: inject part into extension when handing init req #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

4t145
Copy link
Collaborator

@4t145 4t145 commented Jun 23, 2025

Motivation and Context

fix #274

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@github-actions github-actions bot added T-core Core library changes T-transport Transport layer changes labels Jun 23, 2025
@4t145 4t145 requested review from Copilot and jokemanfire June 23, 2025 06:34
@4t145 4t145 mentioned this pull request Jun 23, 2025
Copy link
Contributor

@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

Fixes the missing injection of part into the request extensions when handling initialization requests, addressing issue #274.

  • Inject part into InitializeRequest extensions in two server paths.
  • Introduce unexpected_message_response to handle non-initialization messages.
  • Update imports to include ClientRequest.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/rmcp/src/transport/streamable_http_server/tower.rs Added extension injection and unexpected-message checks
crates/rmcp/src/transport/common/server_side_http.rs Added unexpected_message_response helper for 422 errors
Comments suppressed due to low confidence (2)

crates/rmcp/src/transport/common/server_side_http.rs:111

  • [nitpick] Consider updating the error message to use 'expected' instead of 'expect' for grammatical clarity, e.g., 'Unexpected message, expected {expect}'.
        .body(Full::new(Bytes::from(format!("Unexpected message, expect {expect}"))).boxed_unsync())

crates/rmcp/src/transport/common/server_side_http.rs:106

  • No tests cover the new unexpected_message_response path; consider adding unit tests to validate its status code and message content.
pub(crate) fn unexpected_message_response(

@4t145 4t145 merged commit 6d31905 into modelcontextprotocol:main Jun 23, 2025
11 checks passed
@github-actions github-actions bot mentioned this pull request Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-core Core library changes T-transport Transport layer changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extensions Empty
2 participants