Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

sunpeak API

Overview

The useUserAgent 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.
Known host values:
HostuserAgent value
ChatGPT"chatgpt"
ClaudeBrowser user-agent string (e.g. "Mozilla/5.0 ...")

Wraps onhostcontextchanged

MCP Apps SDK reference

Import

import { useUserAgent } from 'sunpeak';

Signature

function useUserAgent(): string | undefined

Returns

return
string | undefined
The host application identifier string, or undefined if the host does not report one.

Usage

import { useUserAgent } from 'sunpeak';

function MyResource() {
  const userAgent = useUserAgent();

  return <p>Host: {userAgent ?? 'unknown'}</p>;
}