You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
applyHostFonts ignores updated fonts from host-context-changed #873
So when a host sends different fonts in ui/notifications/host-context-changed, the View keeps the first fonts. useHostFonts (and useHostStyles) call applyHostFonts from their hostcontextchanged listener and document "apply updated fonts", but the update never takes effect. The spec says a host MAY send host-context-changed "when any context field changes", so a font change after ui/initialize, for example on a theme switch that changes font families, is allowed.
To reproduce
applyHostFonts("@font-face { font-family: A; }");applyHostFonts("@font-face { font-family: B; }");// document.getElementById("__mcp-host-fonts").textContent is still the "A" rule
With useHostStyles(app, app.getHostContext()): connect with fonts in the initial host context, then send host-context-changed with a different styles.css.fonts. The style tag keeps the initial CSS.
Expected behavior
A later call replaces the injected font CSS, still using a single <style> tag, so updated fonts apply and repeated calls don't add duplicate tags.
Proposed fix
Reuse the existing #__mcp-host-fonts element and replace its textContent when the CSS differs. I have this with unit tests and can open a PR.
Environment
@modelcontextprotocol/ext-appsmain at ea3e9d0 (2.1.0).
AI assistance
I used an AI coding assistant (Claude, in the Kiro IDE) to read the source, write the reproduction, and draft this report. I checked the behavior myself.
Activity