Thanks to visit codestin.com
Credit goes to github.com

Skip to content

'id' member present in 'notifications/initialized' Notifications when HTTP transport is used #47

@bkowal

Description

@bkowal

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:

ID: t.nextID,
.
It is used with the 'notifications/initialized' method:
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions