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
Copy file name to clipboardExpand all lines: docs/concepts/apps/apps.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ The key concepts are:
31
31
-**UI capability negotiation** — Client and server declare support via `extensions["io.modelcontextprotocol/ui"]`
32
32
-**UI resources** — HTML content served with the MIME type `text/html;profile=mcp-app`
33
33
-**Tool UI metadata** — Tools declare their associated UI resource in `_meta.ui`
34
+
-**Resource UI metadata** — Resources declare CSP, permissions, domain, and display preferences in `_meta.ui`
34
35
35
36
## Associating tools with UI resources
36
37
@@ -58,7 +59,7 @@ builder.Services.AddMcpServer()
58
59
.WithMcpApps();
59
60
```
60
61
61
-
The `WithMcpApps()` call registers a post-configuration step that processes all registered tools and applies `[McpAppUi]` attribute metadata to their `_meta.ui`field automatically.
62
+
The `WithMcpApps()` call registers a post-configuration step that processes registered tools and resources, applying their MCP Apps attributes to the corresponding `_meta.ui`fields automatically.
62
63
63
64
### Using the attribute with manual processing
64
65
@@ -126,6 +127,34 @@ UI resources are HTML pages registered with the MCP server using the `ui://` URI
126
127
-**Domain** — Dedicated origin for OAuth flows and CORS
127
128
-**PrefersBorder** — Whether the host should render a visual border
128
129
130
+
Use `[McpAppResource]` to configure this metadata without writing raw JSON:
Register the resource before calling `WithMcpApps()`:
149
+
150
+
```csharp
151
+
builder.Services.AddMcpServer()
152
+
.WithResources<WeatherResources>()
153
+
.WithMcpApps();
154
+
```
155
+
156
+
For resources created manually, call `McpApps.ApplyAppResourceAttributes(resource)`, or set a typed `McpUiResourceMeta` directly with `McpApps.SetResourceUi(resource, metadata)`.
157
+
129
158
## App-only tools
130
159
131
160
Tools with `Visibility = [McpUiToolVisibility.App]` are not visible to the LLM — they are intended only for use by the app UI.
0 commit comments