Skip to content

Commit e83440d

Browse files
Add initial PoC for MCP Apps for select tools under Insiders (#1957)
* PoC full flow (hello world example) * add avatar resource domain * add postmessage logic and richer UI * add create issue ui * update ui for issue creatioon * fix * ignore banner * update docs after rebase * update toolsnap for get_me * new UI changes * update docs * update workflows that need ui build * add UI diff * fix build ui step for windows runners to use git bash * fix UI diff * refactor issue creation UI * add AvatarWithFallback component and update UserCard to use it; enhance CreateIssueApp to manage existing issue data * fix formatting of button labels * add create pull request functionality with UI support and insiders * update docs * add test for insiders mode handling in ServerTool schema * remove `show_ui` param for now * make insiders mode metadata stripping generic * remove ui diff * fix CI * remove redundant mention of old app name * add node types to fix ide issues for ts code * remove unused TriangleDownIcon import * update @primer/behaviors and electron-to-chromium versions in package-lock.json * add check to ensure base and head are not the same when creating a new PR * remove old show_ui * fix gitignore for dist so builds dont break * add tests for insiders mode handling and metadata stripping in ServerTool * remove unused state and components from CreatePRApp * fix ui build * update docker build to fix npm issue * remove reference to show_ui * allow insiders to work for non-ui features * formalise insiders inventory support * update docs * fix overflow issues and replace pull request dropdown with matching UI from dotcom * fix createpullrequest test * consolidate fetching tools under `ui_get` tool to remove toolset deps * fix issue data prefill in issue_write form * fix link component when updating issue * fix avatar URL * fix broken issue update logic * remove dbg * fix for new GetFlags * revert to original required fields for create_pull_request * fix for UI form submission * Simplify MCP App UIs for basic branch Remove advanced features to be kept in mcp-ui-apps-advanced: - Strip labels, assignees, milestones, issue types, repo picker from issue-write - Strip repo picker, branch selectors from pr-write - Delete ui_get tool (ui_tools.go, ui_tools_test.go, ui_get.snap) - Remove UIGet registration from tools.go Basic forms retain: title, body, submit with _ui_submitted, draft/regular split button (PR), MarkdownEditor, and SuccessView. * Fix header spacing in issue-write and pr-write UIs Add proper spacing between icon, title text, and repo name in the header bar for both issue-write and create-pull-request forms. * fix UI spacing * Add insiders flag to User-Agent header When InsidersMode is enabled, append '(insiders)' to the User-Agent string sent with GitHub API requests, enabling server-side adoption tracking. * address ui feedback * added ui/no-ui support * improve active state UI for write and preview button. make padding consistent in textarea * return to prev non ui check * use hardcoded client name check for ui support * linter fixes * merge fix * linter fix 2 --------- Co-authored-by: tommaso-moro <tommaso-moro@github.com>
1 parent 09d38df commit e83440d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+8864
-52
lines changed

.github/workflows/code-scanning.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ jobs:
7474
go-version: ${{ fromJSON(steps.resolve-environment.outputs.environment).configuration.go.version }}
7575
cache: false
7676

77+
- name: Set up Node.js
78+
if: matrix.language == 'go'
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: "20"
82+
cache: "npm"
83+
cache-dependency-path: ui/package-lock.json
84+
85+
- name: Build UI
86+
if: matrix.language == 'go'
87+
run: script/build-ui
88+
7789
- name: Autobuild
7890
uses: github/codeql-action/autobuild@v4
7991

.github/workflows/docs-check.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ jobs:
1616
- name: Checkout code
1717
uses: actions/checkout@v6
1818

19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
cache: "npm"
24+
cache-dependency-path: ui/package-lock.json
25+
26+
- name: Build UI
27+
run: script/build-ui
28+
1929
- name: Set up Go
2030
uses: actions/setup-go@v6
2131
with:

.github/workflows/go.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ jobs:
2525
- name: Check out code
2626
uses: actions/checkout@v6
2727

28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "20"
32+
cache: "npm"
33+
cache-dependency-path: ui/package-lock.json
34+
35+
- name: Build UI
36+
shell: bash
37+
run: script/build-ui
38+
2839
- name: Set up Go
2940
uses: actions/setup-go@v6
3041
with:
@@ -34,6 +45,7 @@ jobs:
3445
run: go mod tidy -diff
3546

3647
- name: Run unit tests
48+
shell: bash
3749
run: script/test
3850

3951
- name: Build

.github/workflows/goreleaser.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ jobs:
1616
- name: Check out code
1717
uses: actions/checkout@v6
1818

19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "20"
23+
cache: "npm"
24+
cache-dependency-path: ui/package-lock.json
25+
26+
- name: Build UI
27+
run: script/build-ui
28+
1929
- name: Set up Go
2030
uses: actions/setup-go@v6
2131
with:

.github/workflows/license-check.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ jobs:
3232
GH_TOKEN: ${{ github.token }}
3333
run: gh pr checkout ${{ github.event.pull_request.number }}
3434

35+
- name: Set up Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: "20"
39+
cache: "npm"
40+
cache-dependency-path: ui/package-lock.json
41+
42+
- name: Build UI
43+
run: script/build-ui
44+
3545
- name: Set up Go
3646
uses: actions/setup-go@v6
3747
with:

.github/workflows/lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v6
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "20"
20+
cache: "npm"
21+
cache-dependency-path: ui/package-lock.json
22+
- name: Build UI
23+
run: script/build-ui
1724
- uses: actions/setup-go@v6
1825
with:
1926
go-version: '1.25'

.github/workflows/mcp-diff.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22+
- name: Set up Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
27+
- name: Build UI
28+
run: script/build-ui
29+
2230
- name: Run MCP Server Diff
2331
uses: SamMorrowDrums/mcp-server-diff@v2.3.5
2432
with:

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,12 @@ e2e.test
2323

2424
.history
2525
conformance-report/
26+
27+
# UI build artifacts
28+
ui/dist/
29+
ui/node_modules/
30+
31+
# Embedded UI assets (built from ui/)
32+
pkg/github/ui_dist/*
33+
!pkg/github/ui_dist/.gitkeep
34+
!pkg/github/ui_dist/.placeholder.html

Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
FROM node:20-alpine AS ui-build
2+
WORKDIR /app
3+
COPY ui/package*.json ./ui/
4+
RUN cd ui && npm ci
5+
COPY ui/ ./ui/
6+
# Create output directory and build - vite outputs directly to pkg/github/ui_dist/
7+
RUN mkdir -p ./pkg/github/ui_dist && \
8+
cd ui && npm run build
9+
110
FROM golang:1.25.7-alpine AS build
211
ARG VERSION="dev"
312

@@ -8,11 +17,15 @@ WORKDIR /build
817
RUN --mount=type=cache,target=/var/cache/apk \
918
apk add git
1019

20+
# Copy source code (including ui_dist placeholder)
21+
COPY . .
22+
23+
# Copy built UI assets over the placeholder
24+
COPY --from=ui-build /app/pkg/github/ui_dist/* ./pkg/github/ui_dist/
25+
1126
# Build the server
12-
# go build automatically download required module dependencies to /go/pkg/mod
1327
RUN --mount=type=cache,target=/go/pkg/mod \
1428
--mount=type=cache,target=/root/.cache/go-build \
15-
--mount=type=bind,target=. \
1629
CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=$(git rev-parse HEAD) -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
1730
-o /bin/github-mcp-server ./cmd/github-mcp-server
1831

internal/ghmcp/server.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ func NewStdioMCPServer(ctx context.Context, cfg github.MCPServerConfig) (*mcp.Se
136136
WithToolsets(github.ResolvedEnabledToolsets(cfg.DynamicToolsets, cfg.EnabledToolsets, cfg.EnabledTools)).
137137
WithTools(github.CleanTools(cfg.EnabledTools)).
138138
WithServerInstructions().
139-
WithFeatureChecker(featureChecker)
139+
WithFeatureChecker(featureChecker).
140+
WithInsidersMode(cfg.InsidersMode)
140141

141142
// Apply token scope filtering if scopes are known (for PAT filtering)
142143
if cfg.TokenScopes != nil {
@@ -153,6 +154,13 @@ func NewStdioMCPServer(ctx context.Context, cfg github.MCPServerConfig) (*mcp.Se
153154
return nil, fmt.Errorf("failed to create GitHub MCP server: %w", err)
154155
}
155156

157+
// Register MCP App UI resources if available (requires running script/build-ui).
158+
// We check availability to allow Insiders mode to work for non-UI features
159+
// even when UI assets haven't been built.
160+
if cfg.InsidersMode && github.UIAssetsAvailable() {
161+
github.RegisterUIResources(ghServer)
162+
}
163+
156164
ghServer.AddReceivingMiddleware(addUserAgentsMiddleware(cfg, clients.rest, clients.gqlHTTP))
157165

158166
return ghServer, nil
@@ -345,6 +353,9 @@ func addUserAgentsMiddleware(cfg github.MCPServerConfig, restClient *gogithub.Cl
345353
message.Params.ClientInfo.Name,
346354
message.Params.ClientInfo.Version,
347355
)
356+
if cfg.InsidersMode {
357+
userAgent += " (insiders)"
358+
}
348359

349360
restClient.UserAgent = userAgent
350361

0 commit comments

Comments
 (0)