Skip to content

Commit 69f786b

Browse files
mattdhollowayCopilot
authored andcommitted
Align UI resources with MCP Apps 2026-01-26 polish recommendations
* Explicitly set prefersBorder on every UI resource — false for the get_me profile card, true for the issue/PR write forms — since hosts' defaults vary. * Declare an empty csp on issue_write_ui and pr_write_ui to document that they need no external origins. * Point spec link comment at the stable 2026-01-26 location. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 561a4a7 commit 69f786b

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

pkg/github/ui_resources.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
// These are static resources (not templates) that serve HTML content for
1111
// MCP App-enabled tools. The HTML is built from React/Primer components
1212
// in the ui/ directory using `script/build-ui`.
13+
//
14+
// Resource metadata follows the stable 2026-01-26 MCP Apps spec:
15+
// https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
1316
func RegisterUIResources(s *mcp.Server) {
1417
// Register the get_me UI resource
1518
s.AddResource(
@@ -27,14 +30,14 @@ func RegisterUIResources(s *mcp.Server) {
2730
URI: GetMeUIResourceURI,
2831
MIMEType: MCPAppMIMEType,
2932
Text: html,
30-
// MCP Apps UI metadata - CSP configuration to allow loading GitHub avatars
31-
// See: https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx
3233
Meta: mcp.Meta{
3334
"ui": map[string]any{
35+
// Allow loading images from GitHub's avatar CDN.
3436
"csp": map[string]any{
35-
// Allow loading images from GitHub's avatar CDN
3637
"resourceDomains": []string{"https://avatars.githubusercontent.com"},
3738
},
39+
// Profile card renders inline within chat without a host border.
40+
"prefersBorder": false,
3841
},
3942
},
4043
},
@@ -59,6 +62,14 @@ func RegisterUIResources(s *mcp.Server) {
5962
URI: IssueWriteUIResourceURI,
6063
MIMEType: MCPAppMIMEType,
6164
Text: html,
65+
Meta: mcp.Meta{
66+
"ui": map[string]any{
67+
// No external origins required; documents the secure default.
68+
"csp": map[string]any{},
69+
// Form surface benefits from a host-provided border.
70+
"prefersBorder": true,
71+
},
72+
},
6273
},
6374
},
6475
}, nil
@@ -81,6 +92,12 @@ func RegisterUIResources(s *mcp.Server) {
8192
URI: PullRequestWriteUIResourceURI,
8293
MIMEType: MCPAppMIMEType,
8394
Text: html,
95+
Meta: mcp.Meta{
96+
"ui": map[string]any{
97+
"csp": map[string]any{},
98+
"prefersBorder": true,
99+
},
100+
},
84101
},
85102
},
86103
}, nil

0 commit comments

Comments
 (0)