1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Allow doc_markdown since this module has many technical terms (ChatGPT, MCP-UI, etc.)
//! MCP Apps Extension - Interactive UI support for multiple MCP hosts.
//!
//! This module provides adapters that transform core UI types for specific MCP host platforms:
//!
//! - **MCP Apps (ext-apps)** - Standard MCP extension (`text/html;profile=mcp-app`)
//! - **ChatGPT Apps** - OpenAI Apps SDK with `window.openai` API
//! - **MCP-UI** - Community standard supporting multiple UI formats
//!
//! # Architecture
//!
//! The adapter pattern allows a single tool implementation to work across multiple hosts:
//!
//! ```text
//! ┌─────────────────────────────────────────────────────────────────┐
//! │ UIResource (Core) │
//! │ │
//! │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
//! │ │McpAppsAdapter│ │ ChatGptAdapter│ │ McpUiAdapter │ │
//! │ └──────────────┘ └──────────────┘ └──────────────────┘ │
//! │ │ │ │ │
//! │ ▼ ▼ ▼ │
//! │ text/html;profile= text/html;profile= text/html │
//! │ mcp-app mcp-app │
//! │ ext-apps SDK window.openai postMessage │
//! └─────────────────────────────────────────────────────────────────┘
//! ```
//!
//! **Widget development:** Widget HTML should use the `@modelcontextprotocol/ext-apps`
//! SDK (`App` class) for host communication. See `GUIDE.md` in this directory.
//!
//! # Example
//!
//! ```rust,ignore
//! use pmcp::server::mcp_apps::{UIAdapter, ChatGptAdapter, MultiPlatformResource};
//! use pmcp::types::ui::UIResource;
//!
//! // Create a core UI resource
//! let resource = UIResource::new("ui://chess/board.html", "Chess Board");
//!
//! // Transform for ChatGPT Apps
//! let chatgpt_adapter = ChatGptAdapter::new();
//! let chatgpt_resource = chatgpt_adapter.transform(&resource);
//!
//! // Or create a multi-platform resource that works everywhere
//! let multi = MultiPlatformResource::new(resource)
//! .with_adapter(ChatGptAdapter::new())
//! .with_adapter(McpAppsAdapter::new());
//! ```
//!
//! # Feature Flag
//!
//! This module requires the `mcp-apps` feature:
//!
//! ```toml
//! [dependencies]
//! pmcp = { version = "1.9", features = ["mcp-apps"] }
//! ```
pub use inline_ext_apps_shim;
pub use ;
pub use ;
pub use ;