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
- Hosts can provide any subset of standardized variables, or not pass `styles` at all. However, passing all of the standardized properties is recommended for cohesiveness
490
+
- Hosts can use the CSS `light-dark()` function for theme-aware values
491
+
492
+
#### App Behavior
493
+
494
+
- Apps should set default fallback values for CSS variables, to account for hosts who don't pass some or all style variables. This ensures graceful degradation when hosts omit `styles` or specific variables:
495
+
```
496
+
:root {
497
+
--colorTextPrimary: #171717;
498
+
}
499
+
```
500
+
- Apps can use the `applyHostStyles` utility (or `useHostStyles` if they prefer a React hook) to easily populate the host-provided CSS variables into their style sheet
501
+
- Apps can use the `applyDocumentTheme` utility (or `useDocumentTheme` if they prefer a React hook) to easily respond to Host Context `theme` changes in a way that is compatible with the host's light/dark color variables
502
+
503
+
Example usage of standardized CSS variables:
504
+
505
+
```css
506
+
.container {
507
+
background: var(--color-background-primary);
508
+
color: var(--color-text-primary);
509
+
font: var(--font-style-body);
510
+
}
511
+
```
512
+
460
513
### MCP Apps Specific Messages
461
514
462
515
MCP Apps introduces additional JSON-RPC methods for UI-specific functionality:
@@ -1046,6 +1099,24 @@ This proposal synthesizes feedback from the UI CWG and MCP-UI community, host im
1046
1099
-**Include external URLs in MVP:** This is one of the easiest content types for servers to adopt, as it's possible to embed regular apps. However, it was deferred due to concerns around model visibility, inability to screenshot content, and review process.
1047
1100
-**Support multiple content types:** Deferred to maintain a lean MVP.
1048
1101
1102
+
#### 4. Host Theming via CSS Variables
1103
+
1104
+
**Decision:** Provide a standardized set of CSS custom properties for visual cohesion.
1105
+
1106
+
**Rationale:**
1107
+
1108
+
- CSS variables are universal, framework-agnostic, and require no runtime
1109
+
- Apps apply styles via `var(--name)` with fallbacks for graceful degradation
1110
+
- Limited variable set (colors, typography, borders) ensures hosts can realistically provide all values
1111
+
- Spacing intentionally excluded—layouts break when spacing varies from original design
1112
+
- No UI component library—no single library works across all host environments
1113
+
1114
+
**Alternatives considered:**
1115
+
1116
+
-**Full design system:** Rejected as too prescriptive; hosts have different aesthetics
1117
+
-**Inline styles in tool results:** Rejected; separating theming from data enables caching and updates
1118
+
-**CSS-in-JS injection:** Rejected; framework-specific and security concerns with injected code
1119
+
1049
1120
### Backward Compatibility
1050
1121
1051
1122
The proposal builds on the existing core protocol. There are no incompatibilities.
0 commit comments