Overview
TheuseUserAgent hook returns the host application identifier string from McpUiHostContext.userAgent. This is an opaque string set by the host — not the browser’s navigator.userAgent. It is a convenience wrapper around useHostContext.
The format and content of this string is host-defined. Not all hosts report a user agent, so the value may be
undefined.| Host | userAgent value |
|---|---|
| ChatGPT | "chatgpt" |
| Claude | Browser user-agent string (e.g. "Mozilla/5.0 ...") |
Wraps onhostcontextchanged
MCP Apps SDK reference
Import
Signature
Returns
The host application identifier string, or
undefined if the host does not report one.