-
Notifications
You must be signed in to change notification settings - Fork 51
implements the notifications/initialized method #84
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
base: main
Are you sure you want to change the base?
implements the notifications/initialized method #84
Conversation
- According to https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle, "After successful initialization, the client MUST send an initialized notification to indicate it is ready to begin normal operations". - This implementation just replies with an empty response (same as ping).
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.
Yeah, the current behavior that results in the following error is problematic.
{jsonrpc: "2.0", id: "123", error: {code: -32601, message: "Method not found", data: "notifications/initialized"}}
It must be able to respond to notifications/initialized
in accordance with the specification.
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.
This should be implemented as an actual notification, not a method. See https://www.jsonrpc.org/specification#notification
I have changed it to return nil and fixed the test case to not send an |
@jkraemer A single handler suffices because we delegate response handling to the underlying json_rpc_handler gem and it's responsible for handling nil results. |
Also notice that the response code for this request should be 202 (:accepted). In order to have this working with claude.ai I had to implement the following unglines: status, headers, body = @transport.handle_request(rack_request)
if params[:method] == "notifications/initialized"
status = 202
end |
According to https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle, "After successful initialization, the client MUST send an initialized notification to indicate it is ready to begin normal operations".
This implementation just replies with an empty response (same as ping).
Motivation and Context
Claude Code assumed the MCP server wasn't working when this method was not handled gracefully.
How Has This Been Tested?
test case added, works in my app.
Types of changes