-
Notifications
You must be signed in to change notification settings - Fork 107
Description
According to the spec (https://modelcontextprotocol.io/docs/concepts/transports & https://www.jsonrpc.org/specification):
- Requests MUST contain 'id' member
- Notifications do NOT contain 'id' member
Unfortunately, in the HTTP transport there's a single shared function that is used for sending both Requests and Notifications. It always adds 'id'- no matter if Notification or Request is being sent:
mcptools/pkg/transport/http.go
Line 146 in 07e62e4
| ID: t.nextID, |
It is used with the 'notifications/initialized' method:
mcptools/pkg/transport/http.go
Line 103 in 07e62e4
| if err := client.send("notifications/initialized", nil); err != nil { |
I built mcp tools from sources and tested it against Spring-AI-based MCP server. This 'id' member in Notifications was a blocker that prevented Spring AI from communicating with mcp tools client. Once I applied a brute force hack to mcp tools (to the http transport), I managed to make the e2e path (mcp tools -> Spring AI MCP server) work.
BTW, I haven't used the stdio transport in mcp tools, but source code suggests that this issue doesn't apply to the stdio transport. It is only present in the http transport.