Skip to content

mcpcompat shim drops progress/logging notifications and cannot forward list_changed downstream #5768

Closed

Description

@JAORMX

Context

While writing regression tests for the mcp-go → go-sdk migration (#5742), two shim limitations were discovered in github.com/stacklok/toolhive-core/mcpcompat v0.0.27:

Finding 1: Client shim drops progress and logging notifications

The mcpcompat client shim's installNotificationHandlers (client.go:417-429) only wires the three *_list_changed handlers. It does NOT install ProgressNotificationHandler or LoggingMessageHandler (both exist in go-sdk v1.6.1 ClientOptions).

Impact: notifications/progress and notifications/message from an upstream backend are silently dropped at the shim boundary. The ToolHive stdio bridge's OnNotification handler never sees them, so they can never be forwarded to stdio clients.

This is tracked as finding 1a in stacklok/toolhive-core#156.

Finding 2: SendNotificationToAllClients drops list_changed notifications

The shim's SendNotificationToAllClients (notifications.go:32-76) only forwards notifications/progress and notifications/message. All other methods (including notifications/tools/list_changed, notifications/resources/list_changed, notifications/prompts/list_changed) hit the default branch and are dropped.

Impact: Even though the bridge's OnNotification handler re-runs forwardAll on *_list_changed (the fix in #5742), the notification itself is never forwarded to the stdio client. The client doesn't know to re-issue tools/list — it only sees the updated set when it happens to list again.

This is tracked as finding 1b in stacklok/toolhive-core#156.

Regression test coverage

  • TestBridge_ToolsListChanged_TriggersReSync in pkg/transport/bridge_test.go — verifies the forwardAll re-sync works (the bridge's local server picks up the new tools)
  • TestBridge_ProgressAndLoggingNotifications_DroppedByShim — skipped test documenting both findings as regression anchors

Acceptance criteria

When the shim is fixed (toolhive-core#156 items 1a and 1b):

  • The skipped test should be un-skipped and pass
  • Progress and logging notifications should be forwarded end-to-end through the bridge
  • *_list_changed notifications should be forwarded to stdio clients

Activity

  1. added
    needs-triage
    on Jul 9, 2026
  2. removed
    needs-triage
    on Jul 13, 2026
  3. JAORMX commented on Aug 3, 2026

    @JAORMX
    CollaboratorAuthor

    Both findings are fixed and verified:

    Finding 1a (client drops progress/logging) — Fixed in toolhive-core via issue #156 (commit a302089, wave 2): the mcpcompat client now wires go-sdk's ProgressNotificationHandler and LoggingMessageHandler into installNotificationHandlers (mcpcompat/client/client.go:735-738) and routes them to OnNotification. ToolHive runs against toolhive-core v0.0.37, which includes the fix.

    Finding 1b (SendNotificationToAllClients drops list_changed) — Fixed shim-side: the mcpcompat server now emits notifications/{tools,prompts,resources}/list_changed automatically via go-sdk's per-session AddTool/RemoveTools reconciliation (syncSessionTools, mcpcompat/server/session.go:384), so the bridge's local server notifies downstream stdio clients when its mirrored feature set changes. The broadcast path intentionally drops them to avoid double-delivery (documented in mcpcompat/server/notifications.go).

    Regression tests (all passing, none skipped):

    • TestBridge_ToolsListChanged_TriggersReSync, TestBridge_ResourcesListChanged_TriggersReSync, TestBridge_PromptsListChanged_TriggersReSync in pkg/transport/bridge_test.go — verify the forwardAll re-sync on each list_changed notification (the bridge's downstream client gets the list_changed via go-sdk's automatic emission when forwardAll re-adds the new features).
    • TestBridge_ProgressAndLoggingNotifications_ForwardedByShim — the un-skipped regression anchor verifying progress + logging notifications flow through the shim to OnNotification.

    Verified locally with go test -race -run TestBridge ./pkg/transport/ — all green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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