Skip to content

Commit 9e97bf3

Browse files
committed
Add styles prop to host context
1 parent 6f14cf3 commit 9e97bf3

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

src/spec.types.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,64 @@ export type McpUiTheme = "light" | "dark";
3636
*/
3737
export type McpUiDisplayMode = "inline" | "fullscreen" | "pip";
3838

39+
/**
40+
* @description CSS variable keys available to MCP apps for theming.
41+
*/
42+
export type McpUiStyleVariableKey =
43+
// Background colors
44+
| "--color-background-primary"
45+
| "--color-background-secondary"
46+
| "--color-background-tertiary"
47+
| "--color-background-inverted"
48+
// Text colors
49+
| "--color-text-primary"
50+
| "--color-text-secondary"
51+
| "--color-text-tertiary"
52+
| "--color-text-inverted"
53+
// Icon colors
54+
| "--color-icon-primary"
55+
| "--color-icon-secondary"
56+
| "--color-icon-tertiary"
57+
| "--color-icon-inverted"
58+
// Border colors
59+
| "--color-border-primary"
60+
| "--color-border-secondary"
61+
// Accent colors
62+
| "--color-accent-info"
63+
| "--color-accent-danger"
64+
| "--color-accent-success"
65+
| "--color-accent-warning"
66+
// Typography - Family
67+
| "--font-family-sans"
68+
// Typography - Size
69+
| "--font-size-heading"
70+
| "--font-size-body"
71+
| "--font-size-caption"
72+
// Typography - Weight
73+
| "--font-weight-regular"
74+
| "--font-weight-emphasized"
75+
// Typography - Line height
76+
| "--font-leading-regular"
77+
| "--font-leading-tight"
78+
// Typography - Composite styles
79+
| "--font-style-heading"
80+
| "--font-style-body"
81+
| "--font-style-body-emphasized"
82+
| "--font-style-caption"
83+
| "--font-style-caption-emphasized"
84+
// Border radius
85+
| "--border-radius-small"
86+
| "--border-radius-medium"
87+
| "--border-radius-large"
88+
| "--border-radius-full"
89+
// Border width
90+
| "--border-width-regular";
91+
92+
/**
93+
* @description Style variables for theming MCP apps.
94+
*/
95+
export type McpUiStyles = Record<McpUiStyleVariableKey, string>;
96+
3997
/**
4098
* @description Request to open an external URL in the host's default browser.
4199
* @see {@link app.App.sendOpenLink} for the method that sends this request
@@ -195,6 +253,8 @@ export interface McpUiHostContext {
195253
};
196254
/** @description Current color theme preference. */
197255
theme?: McpUiTheme;
256+
/** @description CSS variables for theming the app. */
257+
styles?: McpUiStyles;
198258
/** @description How the UI is currently displayed. */
199259
displayMode?: McpUiDisplayMode;
200260
/** @description Display modes the host supports. */

src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export {
1414
LATEST_PROTOCOL_VERSION,
1515
type McpUiTheme,
1616
type McpUiDisplayMode,
17+
type McpUiStyleVariableKey,
18+
type McpUiStyles,
1719
type McpUiOpenLinkRequest,
1820
type McpUiOpenLinkResult,
1921
type McpUiMessageRequest,

0 commit comments

Comments
 (0)