Skip to content

fix: handle host context notifications across disconnects - #819

Closed
zwk110 wants to merge 1 commit into
modelcontextprotocol:mainfrom
zwk110:codex/handle-host-context-notification-errors
Closed

zwk110 wants to merge 1 commit into
modelcontextprotocol:mainfrom
zwk110:codex/handle-host-context-notification-errors

Conversation

@zwk110

@zwk110 zwk110 commented Oct 22, 2026

Copy link
Copy Markdown

AppBridge.setHostContext() returns void but discards the promise from sendHostContextChange(). Updating context before connecting or after disconnecting therefore produces an unhandled Not connected rejection. A transport send failure while connected is also left unhandled. Related downstream reports: MCP-UI-Org/mcp-ui#195 and MCP-UI-Org/mcp-ui#208.

Keep disconnected updates in the context returned by the next initialization handshake, and route notification failures through the existing onerror callback. The low-level sendHostContextChange() API is unchanged. Add regressions using linked App/AppBridge transports for initial connection, reconnection, and a failed send; all three fail on the original code and pass with this change.

Validation on Windows, Node 24.14.1 / Bun 1.3.10:

  • npm test: 441 passed, 2 skipped.
  • npm run build, npm run examples:build, and TypeDoc link validation passed.
  • Prettier passed for both changed files. The full formatting check reports only the unchanged CLAUDE.md symlink checked out as a regular file on Windows.

@zwk110 zwk110 closed this Oct 22, 2026
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