> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# useMcpAppContext

> Read a raw MCP Apps host context value by key

An MCP Apps host (Claude and others) exposes [view](https://docs.skybridge.tech/build/view.md) context that Skybridge's cross-host hooks read for you. `useMcpAppContext` is the escape hatch: it reads that context raw, by key, for a protocol-level field the hooks don't surface. It runs only on MCP Apps hosts, not ChatGPT; the `window.openai` counterpart is [`useAppsSdkContext`](https://docs.skybridge.tech/api-reference/use-apps-sdk-context).

## Example

[`useUser`](https://docs.skybridge.tech/api-reference/use-user) gives the locale but not the host time zone, so a schedule reads `timeZone` from the context to render times in the user's zone.

```tsx highlight={4} theme={null}
import { useMcpAppContext } from "skybridge/web";

function Schedule({ events }: { events: Event[] }) {
  const timeZone = useMcpAppContext("timeZone");

  return (
    <ul>
      {events.map((event) => (
        <li key={event.id}>
          {event.start.toLocaleString(undefined, { timeZone })}
        </li>
      ))}
    </ul>
  );
}
```

## Type Parameters

### `K`

```tsx theme={null}
K extends keyof McpAppContext;
```

Inferred from `key`: the literal key you pass fixes the return type to `McpAppContext[K]`.

## Parameters

### `key`

```tsx theme={null}
key: K;
```

**Required.** The context key to read and subscribe to. The hook re-renders only when this key changes; to watch several keys, call it once per key.

### `options`

```tsx theme={null}
options?: Partial<{ appInfo: Implementation }>;
```

`appInfo` (`{ name, version }`) optionally identifies the view to the host. Omit it for a generic default.

## Returns

```tsx theme={null}
value: McpAppContext[K];
```

The requested key's current value, empty until the host provides it: host-context keys are `undefined`, tool-state keys `null`. The table lists each key with the cross-host hook that also surfaces it; hosts may send others not listed.

| Key | Value | Also via |
| - | - | - |
| `theme` | `"light"` or `"dark"` | [`useUser`](https://docs.skybridge.tech/api-reference/use-user) |
| `locale` | BCP-47 locale | [`useUser`](https://docs.skybridge.tech/api-reference/use-user) |
| `timeZone` | IANA time zone | — |
| `displayMode` | current layout (`inline` / `fullscreen` / `pip`) | [`useDisplayMode`](https://docs.skybridge.tech/api-reference/use-display-mode) |
| `availableDisplayModes` | layouts the host supports | — |
| `containerDimensions` | the view's available size (height and width) | [`useViewport`](https://docs.skybridge.tech/api-reference/use-viewport) |
| `userAgent` | raw host user-agent string | — |
| `platform` | `web` / `desktop` / `mobile` | [`useUser`](https://docs.skybridge.tech/api-reference/use-user) |
| `deviceCapabilities` | touch and hover support | [`useUser`](https://docs.skybridge.tech/api-reference/use-user) |
| `safeAreaInsets` | insets to keep clear of host chrome | [`useViewport`](https://docs.skybridge.tech/api-reference/use-viewport) |
| `styles` | host theme tokens | — |
| `toolInfo` | the tool definition that rendered the view | — |
| `toolInput` | the tool call's arguments | [`useToolInfo`](https://docs.skybridge.tech/api-reference/use-tool-info) |
| `toolResult` | the tool's full MCP result (`structuredContent` model-visible) | [`useToolInfo`](https://docs.skybridge.tech/api-reference/use-tool-info) |
| `toolCancelled` | set when the host aborts the call | — |
| `hostCapabilities` | the host's MCP Apps capabilities | [`useHost`](https://docs.skybridge.tech/api-reference/use-host) |
| `openai/deepLink` | ChatGPT only: `{ url }`, the deep link the view was opened on | [`useDeepLink`](https://docs.skybridge.tech/api-reference/use-deep-link) |
| `openai/modelContext` | ChatGPT only: the context this view attached, `null` once the user removed it | [`useModelContext`](https://docs.skybridge.tech/api-reference/use-model-context) |

> [card] [useAppsSdkContext](https://docs.skybridge.tech/api-reference/use-apps-sdk-context.md)
>
> The `window.openai` counterpart for ChatGPT

> [card] [useToolInfo](https://docs.skybridge.tech/api-reference/use-tool-info.md)
>
> Read the tool result across both runtimes

> [card] [ChatGPT Plugins and MCP Apps](https://docs.skybridge.tech/resources/chatgpt-and-mcp-apps.md)
>
> What the raw MCP Apps layer is, and how Skybridge unifies it


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.