Provide implementations of advanced data structures
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Integrates MCP App UI with host theming system. Applies host CSS variables, handles onhostcontextchanged, safe area insets, display mode detection, and fullscreen configuration.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Integrate MCP App UIs with the host application's theming system so apps look native in Claude Desktop, ChatGPT, VS Code, Goose, Postman, and other MCP-enabled hosts.
MCP Apps render in sandboxed iframes inside host applications. Each host has its own visual theme (colors, fonts, border radii, spacing). The MCP Apps SDK provides:
--color-*, --font-*, --border-radius-*) injected by the hostapplyDocumentTheme, applyHostStyleVariables, applyHostFonts) to apply themuseHostStyles, useHostStyleVariables, useHostFonts) for React appsonhostcontextchanged event fired when theme changes (e.g., dark mode toggle)The key principle is: always use CSS variable fallbacks so the app looks correct both as an MCP App (host provides variables) and standalone (fallback values apply).
--color-background-primary, --color-background-secondary, --color-text-primary, --color-text-secondary, --color-border-primary--font-sans, --font-mono, --font-text-base-size, --font-text-sm-size--border-radius-sm, --border-radius-md, --border-radius-lgenv(safe-area-inset-top), env(safe-area-inset-bottom), etc.applyDocumentTheme(theme) -- sets document-level theme classapplyHostStyleVariables(context) -- applies all CSS variables from hostapplyHostFonts(context) -- loads and applies host fontsuseHostStyles() -- combined hook applying theme, variables, and fontsuseHostStyleVariables() -- CSS variables onlyuseHostFonts() -- font loading onlyimport {
App,
PostMessageTransport,
applyDocumentTheme,
applyHostStyleVariables,
applyHostFonts,
} from '@modelcontextprotocol/ext-apps';
const app = new App({ transport: new PostMessageTransport() });
// Register handler BEFORE connect()
app.onhostcontextchanged = (params) => {
const ctx = params.context;
// Apply theme (light/dark)
if (ctx.theme) {
applyDocumentTheme(ctx.theme);
}
// Apply CSS variables
applyHostStyleVariables(ctx);
// Load and apply fonts
applyHostFonts(ctx);
};
// THEN connect
await app.connect();
import { useApp, useHostStyles } from '@modelcontextprotocol/ext-apps/react';
function MyApp() {
const app = useApp();
useHostStyles(); // Handles all theme/variable/font application
return (
<div className="app-container">
<h1>My MCP App</h1>
</div>
);
}
/* Always use fallbacks so app works standalone too */
.app-container {
background-color: var(--color-background-primary, #ffffff);
color: var(--color-text-primary, #1a1a1a);
font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
font-size: var(--font-text-base-size, 14px);
border-radius: var(--border-radius-md, 8px);
}
.card {
background-color: var(--color-background-secondary, #f5f5f5);
border: 1px solid var(--color-border-primary, #e0e0e0);
border-radius: var(--border-radius-sm, 4px);
padding: 16px;
}
.label {
color: var(--color-text-secondary, #666666);
font-size: var(--font-text-sm-size, 12px);
}
.code {
font-family: var(--font-mono, 'Courier New', monospace);
}
/* Safe area insets for mobile/embedded contexts */
.app-root {
padding-top: env(safe-area-inset-top, 0px);
padding-bottom: env(safe-area-inset-bottom, 0px);
padding-left: env(safe-area-inset-left, 0px);
padding-right: env(safe-area-inset-right, 0px);
}
| Variable | Category | Description |
|---|---|---|
--color-background-primary | Color | Main background |
--color-background-secondary | Color | Card/section background |
--color-background-tertiary | Color | Nested/subtle background |
--color-text-primary | Color | Main text |
--color-text-secondary | Color | Secondary/muted text |
--color-text-tertiary | Color | Subtle/hint text |
--color-border-primary | Color | Main borders |
--color-border-secondary | Color | Subtle borders |
--color-accent | Color | Interactive elements |
--color-error | Color | Error states |
--color-success | Color | Success states |
--color-warning | Color | Warning states |
--font-sans | Font | Sans-serif font family |
--font-mono | Font | Monospace font family |
--font-text-xs-size | Font | Extra small text size |
--font-text-sm-size | Font | Small text size |
--font-text-base-size | Font | Base text size |
--font-text-lg-size | Font | Large text size |
--font-text-xl-size | Font | Extra large text size |
--border-radius-sm | Layout | Small border radius |
--border-radius-md | Layout | Medium border radius |
--border-radius-lg | Layout | Large border radius |
--border-radius-full | Layout | Full/pill border radius |
/* Works in BOTH modes because of fallback values */
body {
margin: 0;
padding: 0;
background-color: var(--color-background-primary, #ffffff);
color: var(--color-text-primary, #1a1a1a);
font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
}
/* When host provides variables, they override fallbacks automatically */
/* When running standalone, fallback values apply */
// Configure fullscreen in the tool registration
registerAppTool(server, {
name: 'show_dashboard',
resourceUri: 'app:///dashboard',
// Request fullscreen display
displayMode: 'fullscreen',
async handler(args) { /* ... */ },
});
#ffffff or Arial without a variable.onhostcontextchanged.onhostcontextchanged BEFORE app.connect().var(--color-*, fallback) patternvar(--font-*, fallback) patternonhostcontextchanged handler registered BEFORE app.connect()applyDocumentTheme / applyHostStyleVariables / applyHostFonts called in handlerconst mcpHostStylingTask = defineTask({
name: 'mcp-host-styling-integration',
description: 'Integrate MCP App UI with host theming system',
inputs: {
framework: { type: 'string', required: true },
hybrid: { type: 'boolean', default: false },
fullscreen: { type: 'boolean', default: false }
},
outputs: {
cssFileCreated: { type: 'boolean' },
handlerRegistered: { type: 'boolean' },
artifacts: { type: 'array' }
},
async run(inputs, taskCtx) {
return {
kind: 'skill',
title: `Integrate host styling (${inputs.framework})`,
skill: {
name: 'mcp-host-styling-integration',
context: {
framework: inputs.framework,
hybrid: inputs.hybrid,
fullscreen: inputs.fullscreen,
instructions: [
'Create CSS with host variable fallbacks',
'Implement onhostcontextchanged handler',
'Apply theme, style variables, and fonts via SDK helpers',
'Add safe area inset padding',
'Verify styling in both MCP and standalone modes'
]
}
},
io: {
inputJsonPath: `tasks/${taskCtx.effectId}/input.json`,
outputJsonPath: `tasks/${taskCtx.effectId}/result.json`
}
};
}
});
@modelcontextprotocol/ext-apps (applyDocumentTheme, applyHostStyleVariables, applyHostFonts)@modelcontextprotocol/ext-apps/react (useHostStyles, useHostStyleVariables, useHostFonts) -- React only아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Provide implementations of advanced data structures
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Generate visual representations of algorithm execution
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.