Skip to content

Commit 4a2f8ed

Browse files
committed
Merge branch 'main' of https://github.com/github/github-mcp-server into add-logging-stack-v2
2 parents a8bf0b0 + d44894e commit 4a2f8ed

Some content is hidden

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

47 files changed

+9094
-178
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
@@ -137,7 +137,8 @@ func NewStdioMCPServer(ctx context.Context, cfg github.MCPServerConfig) (*mcp.Se
137137
WithToolsets(github.ResolvedEnabledToolsets(cfg.DynamicToolsets, cfg.EnabledToolsets, cfg.EnabledTools)).
138138
WithTools(github.CleanTools(cfg.EnabledTools)).
139139
WithServerInstructions().
140-
WithFeatureChecker(featureChecker)
140+
WithFeatureChecker(featureChecker).
141+
WithInsidersMode(cfg.InsidersMode)
141142

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

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

159167
return ghServer, nil
@@ -346,6 +354,9 @@ func addUserAgentsMiddleware(cfg github.MCPServerConfig, restClient *gogithub.Cl
346354
message.Params.ClientInfo.Name,
347355
message.Params.ClientInfo.Version,
348356
)
357+
if cfg.InsidersMode {
358+
userAgent += " (insiders)"
359+
}
349360

350361
restClient.UserAgent = userAgent
351362

0 commit comments

Comments
 (0)