Skip to content

Commit 6f9172b

Browse files
committed
Merge remote-tracking branch 'origin/main' into claude/review-mcp-sampling-CkbHh
# Conflicts: # src/app.examples.ts
2 parents 9dc6feb + 01d826a commit 6f9172b

107 files changed

Lines changed: 16913 additions & 1941 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424

2525
- uses: actions/setup-node@v6
2626
with:
27-
node-version: "20"
27+
node-version: "22"
28+
cache: npm
2829

2930
- run: npm ci
3031

@@ -71,12 +72,17 @@ jobs:
7172

7273
- uses: actions/setup-node@v6
7374
with:
74-
node-version: "20"
75+
node-version: "22"
76+
cache: npm
7577

76-
- run: npm install
78+
- run: npm ci
7779

7880
- run: npm run build
7981

82+
- name: Validate TypeDoc links
83+
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
84+
run: npm exec typedoc -- --treatValidationWarningsAsErrors --emit none
85+
8086
- run: npm run examples:build
8187

8288
- name: Verify generated schemas are up-to-date
@@ -97,7 +103,15 @@ jobs:
97103

98104
- name: Build MCPB bundle (pdf-server)
99105
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
100-
run: npx -y @anthropic-ai/mcpb pack
106+
run: node build-mcpb.mjs
107+
working-directory: examples/pdf-server
108+
109+
- name: Smoke-test MCPB bundle starts
110+
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
111+
run: |
112+
unzip -q pdf-server.mcpb -d .mcpb-smoke
113+
node .mcpb-smoke/dist/index.js --stdio < /dev/null 2>&1 | tee /tmp/mcpb-smoke.log
114+
grep -q "Ready" /tmp/mcpb-smoke.log
101115
working-directory: examples/pdf-server
102116

103117
e2e:
@@ -111,7 +125,8 @@ jobs:
111125

112126
- uses: actions/setup-node@v6
113127
with:
114-
node-version: "20"
128+
node-version: "22"
129+
cache: npm
115130

116131
- uses: astral-sh/setup-uv@v7
117132

@@ -147,13 +162,13 @@ jobs:
147162
shell: wsl-bash {0}
148163
run: |
149164
sudo apt-get update
150-
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
165+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
151166
sudo apt-get install -y nodejs
152167
153168
- name: Build and test in WSL
154169
shell: wsl-bash {0}
155170
run: |
156-
npm install
171+
npm ci
157172
npm run build
158173
npm run examples:build
159174
npm test
@@ -182,15 +197,18 @@ jobs:
182197
steps:
183198
- uses: actions/setup-node@v6
184199
with:
185-
node-version: "20"
200+
node-version: "22"
186201

187202
- name: Create test project and install from git
188203
shell: bash
204+
env:
205+
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
206+
HEAD_REF: ${{ github.head_ref || github.ref_name }}
189207
run: |
190208
mkdir test-project
191209
cd test-project
192210
npm init -y
193211
# Install from the PR branch (use head repo for fork PRs)
194-
npm install "git+https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}#${{ github.head_ref || github.ref_name }}"
212+
npm install "git+https://github.com/${HEAD_REPO}#${HEAD_REF}"
195213
# Verify the package is usable (ESM import)
196214
node --input-type=module -e "import { App } from '@modelcontextprotocol/ext-apps'; console.log('Import successful:', typeof App)"

.github/workflows/docs-preview.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Docs Preview
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, closed]
6+
paths:
7+
- "docs/**"
8+
- "src/**"
9+
- "README.md"
10+
- "typedoc.config.mjs"
11+
- "scripts/typedoc-*.mjs"
12+
- ".github/workflows/docs-preview.yml"
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
concurrency:
19+
group: docs-preview-${{ github.event.pull_request.number }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
build-and-deploy:
24+
# Refuse to run for fork PRs — forks do not have access to the Cloudflare
25+
# secrets, so deploys would fail anyway.
26+
if: >-
27+
github.event.action != 'closed' &&
28+
github.event.pull_request.head.repo.full_name == github.repository
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v6
32+
33+
- uses: actions/setup-node@v6
34+
with:
35+
node-version: "22"
36+
cache: npm
37+
38+
- run: npm ci
39+
40+
- run: npm run build
41+
42+
- run: npm run docs
43+
44+
- name: Deploy preview
45+
uses: modelcontextprotocol/actions/cloudflare-pages-preview/deploy@main
46+
with:
47+
directory: docs
48+
project-name: mcp-ext-apps-docs-preview
49+
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
50+
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
51+
comment-title: "📖 Docs Preview Deployed"
52+
comment-marker: "<!-- docs-preview-comment -->"
53+
54+
cleanup:
55+
if: >-
56+
github.event.action == 'closed' &&
57+
github.event.pull_request.head.repo.full_name == github.repository
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: modelcontextprotocol/actions/cloudflare-pages-preview/cleanup@main
61+
with:
62+
project-name: mcp-ext-apps-docs-preview
63+
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
64+
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
65+
comment-marker: "<!-- docs-preview-comment -->"

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ jobs:
1616
- uses: oven-sh/setup-bun@v2
1717
- uses: actions/setup-node@v6
1818
with:
19-
node-version: "20"
20-
- run: npm install
19+
node-version: "22"
20+
cache: npm
21+
- run: npm ci
2122
- run: npm run build
2223
- run: npm run docs
2324
- uses: peaceiris/actions-gh-pages@v4

.github/workflows/npm-publish.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,8 @@ jobs:
159159
cache: npm
160160
- run: npm ci
161161

162-
- name: Build pdf-server
163-
run: npm run build --workspace examples/pdf-server
164-
165-
- name: Pack MCPB bundle
166-
run: npx -y @anthropic-ai/mcpb pack
167-
working-directory: examples/pdf-server
162+
- name: Build pdf-server + MCPB bundle
163+
run: npm run build:mcpb --workspace examples/pdf-server
168164

169165
- name: Upload MCPB to release
170166
run: gh release upload "${{ github.event.release.tag_name }}" examples/pdf-server/*.mcpb --clobber

.github/workflows/update-snapshots.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ permissions:
1616

1717
jobs:
1818
update-snapshots:
19-
# Run on workflow_dispatch OR when someone comments "/update-snapshots" on a PR
19+
# Run on workflow_dispatch OR when a maintainer comments "/update-snapshots" on a PR.
20+
# author_association check prevents arbitrary commenters from triggering a job with
21+
# contents:write that pushes a [skip ci] commit to the PR branch.
2022
if: >
2123
github.event_name == 'workflow_dispatch' ||
22-
(github.event.issue.pull_request && contains(github.event.comment.body, '/update-snapshots'))
24+
(github.event.issue.pull_request &&
25+
contains(github.event.comment.body, '/update-snapshots') &&
26+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
2327
runs-on: ubuntu-latest
2428
steps:
2529
- name: Get PR branch
@@ -59,7 +63,8 @@ jobs:
5963

6064
- uses: actions/setup-node@v6
6165
with:
62-
node-version: "20"
66+
node-version: "22"
67+
cache: npm
6368

6469
- uses: astral-sh/setup-uv@v7
6570

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ __pycache__/
1515
*.pyc
1616

1717
# MCPB bundles (built artifacts)
18-
*.mcpb
18+
*.mcpb
19+
.mcpb-stage/
20+
.mcpb-smoke/

.husky/pre-commit

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,16 @@ if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.o
1414
exit 1
1515
fi
1616

17+
# Capture staged files so we only re-stage what the user intended to commit
18+
# (avoids sweeping unrelated WIP into the commit). --diff-filter=d skips
19+
# deletions so the xargs git add below doesn't fail on removed paths.
20+
STAGED=$(git diff --name-only --cached --diff-filter=d)
21+
1722
npm run build:all
1823
npm run prettier:fix
1924

20-
# Stage any files reformatted by prettier (generated files, source, docs, etc.)
21-
git diff --name-only --diff-filter=M | xargs -r git add
25+
# Re-stage originally-staged files (prettier may have reformatted them)
26+
echo "$STAGED" | xargs -r git add
27+
28+
# Also stage generated files (regenerated by build:all from spec.types.ts)
29+
git add src/generated/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
registry=https://registry.npmjs.org/

AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ npm test
3939
# Check JSDoc comment syntax and `{@link}` references
4040
npm exec typedoc -- --treatValidationWarningsAsErrors --emit none
4141

42-
# Regenerate package-lock.json (especially on setups w/ custom npm registry)
42+
# Regenerate package-lock.json
43+
# Note: repo .npmrc pins registry to npmjs.org, so a plain `npm i` is safe even
44+
# if your global npm config points elsewhere. The Docker step below is optional
45+
# — it locks linux-amd64 optionalDependencies (sharp, rollup, bun) for CI.
4346
rm -fR package-lock.json node_modules && \
4447
docker run --rm -it --platform linux/amd64 -v $PWD:/src:rw -w /src node:latest npm i && \
4548
rm -fR node_modules && \

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ We welcome contributions to the MCP Apps SDK! This document outlines the process
2525
- Update documentation as needed
2626
- Keep changes focused and atomic
2727
- Provide a clear description of changes
28+
- **Keep "Allow edits by maintainers" checked** when opening your PR — this lets maintainers rebase your branch and lets the [`/update-snapshots` workflow](#updating-snapshots-in-ci) push updated screenshots to it
2829

2930
## Running Examples
3031

0 commit comments

Comments
 (0)