Skip to content

Conversation

@4t145
Copy link
Collaborator

@4t145 4t145 commented May 8, 2025

Motivation and Context

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

@4t145 4t145 requested review from Copilot and jokemanfire May 8, 2025 17:42
Copy link
Contributor

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 extracts the HTTP request handling logic into the rmcp extension by introducing an async initialize method in the Counter, refactoring server handlers to use axum’s request::Parts, and updating the JsonRpcMessage implementation to support extension insertion.

  • Added an async initialize method in the Counter implementation that logs HTTP headers and URI.
  • Updated the HTTP server handlers in both axum and SSE server to inject request parts into client messages for downstream processing.
  • Enhanced the meta model to include a helper for inserting extensions into various JsonRpcMessage variants.

Reviewed Changes

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

File Description
examples/servers/src/common/counter.rs Added an async initialize method that logs HTTP request parts from context extensions.
crates/rmcp/src/transport/streamable_http_server/axum.rs Replaced HeaderMap with request::Parts and injected the parts into the JSON RPC message.
crates/rmcp/src/transport/sse_server.rs Updated endpoint to use request::Parts and inserted the parts into the JSON RPC message.
crates/rmcp/src/model/meta.rs Extended JsonRpcMessage with a generic insert_extension function for various JSON RPC types.

@4t145 4t145 merged commit 787cc01 into modelcontextprotocol:main May 9, 2025
9 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants