Skip to content

Commit ede51e6

Browse files
committed
Merge remote-tracking branch 'origin/main' into ochafik/map-interact
2 parents cf66fdd + 2b0d11e commit ede51e6

36 files changed

Lines changed: 127 additions & 80 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 8 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
@@ -111,7 +117,8 @@ jobs:
111117

112118
- uses: actions/setup-node@v6
113119
with:
114-
node-version: "20"
120+
node-version: "22"
121+
cache: npm
115122

116123
- uses: astral-sh/setup-uv@v7
117124

@@ -147,13 +154,13 @@ jobs:
147154
shell: wsl-bash {0}
148155
run: |
149156
sudo apt-get update
150-
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
157+
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
151158
sudo apt-get install -y nodejs
152159
153160
- name: Build and test in WSL
154161
shell: wsl-bash {0}
155162
run: |
156-
npm install
163+
npm ci
157164
npm run build
158165
npm run examples:build
159166
npm test
@@ -182,15 +189,18 @@ jobs:
182189
steps:
183190
- uses: actions/setup-node@v6
184191
with:
185-
node-version: "20"
192+
node-version: "22"
186193

187194
- name: Create test project and install from git
188195
shell: bash
196+
env:
197+
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
198+
HEAD_REF: ${{ github.head_ref || github.ref_name }}
189199
run: |
190200
mkdir test-project
191201
cd test-project
192202
npm init -y
193203
# 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 }}"
204+
npm install "git+https://github.com/${HEAD_REPO}#${HEAD_REF}"
195205
# Verify the package is usable (ESM import)
196206
node --input-type=module -e "import { App } from '@modelcontextprotocol/ext-apps'; console.log('Import successful:', typeof App)"

.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/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

.husky/pre-commit

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ 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)
19+
STAGED=$(git diff --name-only --cached)
20+
1721
npm run build:all
1822
npm run prettier:fix
1923

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

build.bun.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#!/usr/bin/env bun
22
import { $ } from "bun";
3+
import { cpSync, mkdirSync } from "node:fs";
34

45
// Run TypeScript compiler for type declarations
56
await $`tsc`;
67

8+
// Copy schema.json (tsc is emitDeclarationOnly, Bun.build doesn't emit JSON assets).
9+
// Needed for the "./schema.json" package export.
10+
mkdirSync("dist/src/generated", { recursive: true });
11+
cpSync("src/generated/schema.json", "dist/src/generated/schema.json");
12+
713
const isDevelopment = Bun.env.NODE_ENV === "development";
814

915
// Build all JavaScript/TypeScript files
@@ -25,30 +31,34 @@ function buildJs(
2531
});
2632
}
2733

34+
// zod is a peerDependency — keep it external so consumers share a single
35+
// zod instance (instanceof ZodError / schema.extend() break with duplicate copies).
36+
const PEER_EXTERNALS = ["@modelcontextprotocol/sdk", "zod"];
37+
2838
await Promise.all([
2939
buildJs("src/app.ts", {
3040
outdir: "dist/src",
31-
external: ["@modelcontextprotocol/sdk"],
41+
external: PEER_EXTERNALS,
3242
}),
3343
buildJs("src/app.ts", {
3444
outdir: "dist/src",
3545
naming: { entry: "app-with-deps.js" },
3646
}),
3747
buildJs("src/app-bridge.ts", {
3848
outdir: "dist/src",
39-
external: ["@modelcontextprotocol/sdk"],
49+
external: PEER_EXTERNALS,
4050
}),
4151
buildJs("src/react/index.tsx", {
4252
outdir: "dist/src/react",
43-
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
53+
external: ["react", "react-dom", ...PEER_EXTERNALS],
4454
}),
4555
buildJs("src/react/index.tsx", {
4656
outdir: "dist/src/react",
47-
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
57+
external: ["react", "react-dom", ...PEER_EXTERNALS],
4858
naming: { entry: "react-with-deps.js" },
4959
}),
5060
buildJs("src/server/index.ts", {
5161
outdir: "dist/src/server",
52-
external: ["@modelcontextprotocol/sdk"],
62+
external: PEER_EXTERNALS,
5363
}),
5464
]);

examples/basic-host/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"homepage": "https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host",
33
"name": "@modelcontextprotocol/ext-apps-basic-host",
4-
"version": "1.1.2",
4+
"version": "1.2.0",
55
"type": "module",
66
"scripts": {
77
"build": "tsc --noEmit && concurrently \"cross-env INPUT=index.html vite build\" \"cross-env INPUT=sandbox.html vite build\"",

examples/basic-server-preact/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/server-basic-preact",
3-
"version": "1.1.2",
3+
"version": "1.2.0",
44
"type": "module",
55
"description": "Basic MCP App Server example using Preact",
66
"repository": {

0 commit comments

Comments
 (0)