Skip to content

Conversation

@He-Pin
Copy link
Contributor

@He-Pin He-Pin commented Nov 18, 2025

Motivation and Context

Pass TransportContext to sessionFactory.

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

Signed-off-by: He-Pin <hepin1989@gmail.com>
@He-Pin He-Pin marked this pull request as ready for review November 18, 2025 12:25
@Kehrlann
Copy link
Contributor

This is a follow-up to #654 , correct? You mention you wanted to add some info to the session ID.
What information are you trying to encode in the session ID?

@He-Pin
Copy link
Contributor Author

He-Pin commented Nov 18, 2025

@Kehrlann Yes, and I have to do another refactoring based on this PR to achieve that, the current mvc implementation just generates the sessionId very early.

WebMvcMcpSessionTransport just needs a sessionId to work, it works different with the webflux based one.

@Kehrlann
Copy link
Contributor

Could you please clarify what information exactly you're hoping to add to the session ID?

Yes, and I have to do another refactoring based on this PR to achieve that

If I understand correctly, you would like to commit another PR that builds on top of this one to actually make this new "session ID generation" mechanism configurable in all transports?

@He-Pin
Copy link
Contributor Author

He-Pin commented Nov 18, 2025

  1. We are currently encoding our server ip, group, and namespace in the session ID, with rsa encrypted, and our ai gateway will forward to our server with that session, session affinity for both sse and streamable.

And then we can decode that information for logging, if a server restarted eand the ai gateway can not route, it will rr to another mcp server, and then we just response a 404 to let the client reinitialize a session.

We currently are reset the session id after the session is created with a VarHandle , and we are only using WebFlux based one.
2. Yes, I will resubmit another one, because I want to leave this change as minimal as possible.

@Kehrlann
Copy link
Contributor

Thanks for clarifying. It makes sense. Let me discuss a bit with the team, we might want to modify WebMvcSseServerTransportProvider.WebMvcMcpSessionTransport so that it aligns with WebFluxSseServerTransportProvider.WebFluxMcpSessionTransport.

@Kehrlann Kehrlann self-assigned this Nov 18, 2025
@He-Pin
Copy link
Contributor Author

He-Pin commented Nov 18, 2025

Thank you very much.

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