Skip to content

Fix: Add missing notifications/initialized message after client initialization #127

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rmrfslashbin
Copy link

Problem

Python MCP servers (like mcp-server-fetch) require a notifications/initialized message after the initialize response to complete the initialization sequence according to the MCP protocol specification. Without this notification, Python servers reject subsequent requests with "Invalid request parameters" errors.

Root Cause

The Go MCP client was missing the required notifications/initialized notification that signals the client has completed initialization and is ready to receive requests. This is enforced by Python MCP servers but not by TypeScript servers, causing compatibility issues.

Solution

Added the missing notification in the Initialize method after successful initialization:

// Send notifications/initialized message as required by MCP protocol
// This notifies the server that the client has completed initialization
// and is ready to receive requests. Python MCP servers require this.
if err := c.protocol.Notification("notifications/initialized", map[string]interface{}{}); err != nil {
    return nil, errors.Wrap(err, "failed to send initialized notification")
}

Testing

  • ✅ Verified compatibility with Python MCP servers (mcp-server-fetch now works)
  • ✅ Confirmed no breaking changes to TypeScript MCP servers (filesystem server still works)
  • ✅ Follows MCP protocol specification for proper initialization sequence

Impact

This change ensures the Go MCP client properly follows the MCP protocol initialization sequence, making it compatible with both TypeScript and Python MCP server implementations without breaking existing functionality.

Fixes compatibility with Python MCP servers including:

  • mcp-server-fetch
  • mcp-server-git
  • mcp-server-time
  • And other Python-based MCP servers

Checklist

  • Tested with Python MCP servers
  • Tested with TypeScript MCP servers
  • No breaking changes
  • Follows MCP protocol specification

Robert Sigler and others added 4 commits July 17, 2025 22:05
…alization

- Send notifications/initialized notification after successful initialize response
- Required by MCP protocol specification for Python servers
- Fixes compatibility with Python MCP servers like mcp-server-fetch
- Addresses 'Invalid request parameters' errors when listing tools

This change ensures the Go MCP client properly follows the MCP protocol
initialization sequence, making it compatible with both TypeScript and
Python MCP server implementations.
- Try parsing as notification first before request
- Return nil for notifications (no response needed)
- Prevents "field id required" error for notifications

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix HTTP transport to handle notifications properly (parse notifications first)
- Add nil response handling for notifications in HTTP server
- Fix integration test server to handle notifications correctly
- All tests now pass including TestReadResource

This ensures compatibility with Python MCP servers that require
the notifications/initialized message after client initialization.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Documents all changes made to fix notifications/initialized issue:
- Client-side notification implementation
- HTTP transport notification handling fixes
- Integration test server updates
- Complete testing results showing all tests pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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.

1 participant