-
Notifications
You must be signed in to change notification settings - Fork 650
[fix] when mcp server not give mcp session id ,mcp session store null… #554
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
[fix] when mcp server not give mcp session id ,mcp session store null… #554
Conversation
Yes, the |
import reactor.core.Disposable; | ||
import reactor.core.publisher.Flux; | ||
import reactor.core.publisher.Mono; | ||
import reactor.util.function.Tuple2; | ||
import reactor.util.function.Tuples; | ||
|
||
import java.io.IOException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should revert unrelated parts, keep null check changes only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, reverted unrelated parts. Submit MR first time, thx reminder. @quaff
if (transportSession.markInitialized( | ||
responseEvent.responseInfo().headers().firstValue("mcp-session-id").orElseGet(() -> null))) { | ||
String mcpSessionId = responseEvent.responseInfo().headers().firstValue("mcp-session-id").orElseGet(() -> null); | ||
if (Objects.nonNull(mcpSessionId) && transportSession.markInitialized(mcpSessionId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API Note:
This method exists to be used as a java.util.function.Predicate, filter(Objects::nonNull)
I think mcpSessionId != null
should be used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. It is used to listen for notifications. thx!
… as session id
Before do reconnect, we should check the session id is null or not
Motivation and Context
Mcp session id is optional, if mcp server did not return mcp session id, we will get a null value. it will throw a MCP Session id missing exception.
How Has This Been Tested?
Build a mcp server, which not return mcp session id in response header.
Breaking Changes
No
Types of changes
Checklist
Additional context