Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d9bdc7bab |
||
|
|
2be172defb | ||
|
|
352f6ced4d |
||
|
|
ae4f7e0ad0 | ||
|
|
a0dcf16843 | ||
|
|
ae0fe55b84 |
||
|
|
853c9f749c | ||
|
|
12aa50b623 |
||
|
|
218aef167e |
||
|
|
5f6346ef86 | ||
|
|
4eab52e372 | ||
|
|
728b0bf38e | ||
|
|
4cd4273947 |
||
|
|
6d083cd69f | ||
|
|
f722753c8f | ||
|
|
cfdc0c725f | ||
|
|
ea6b89c9e2 | ||
|
|
c5b2543115 | ||
|
|
09bf2aae3c | ||
|
|
0a477bb25d | ||
|
|
7f686ff2b4 | ||
|
|
d6ebcca9a0 | ||
|
|
040942b3af | ||
|
|
50eb30ec8d | ||
|
|
f28f5ddb3c | ||
|
|
90123733bb | ||
|
|
f9c671c323 |
||
|
|
264d9cae44 | ||
|
|
1a713173cc |
||
|
|
10195ad918 |
||
|
|
4e4886c5ff | ||
|
|
92f46a5745 |
||
|
|
c847bc0887 | ||
|
|
e7ffe7c738 | ||
|
|
7d498079e8 |
||
|
|
c55a3a231f |
||
|
|
7664bb1010 | ||
|
|
43eed45404 | ||
|
|
ccae093d1a | ||
|
|
2ca6a59d2f |
||
|
|
9778cf97a2 |
||
|
|
f50ec6ebfb |
||
|
|
f94cb38b0b |
||
|
|
a76e3a7691 |
||
|
|
d19a1fb83a |
||
|
|
59e6ffc6d8 |
||
|
|
209cfc6241 |
||
|
|
b383847bf2 |
||
|
|
cf87f2a2c2 |
||
|
|
cd969dbc31 |
||
|
|
f0d9582eaa |
||
|
|
ea8775dcb5 |
||
|
|
fa12744908 |
||
|
|
ca1d29894f |
||
|
|
0ffe16781e |
||
|
|
a990780293 |
||
|
|
7d4434e991 |
||
|
|
fcc4b03bde |
||
|
|
9a37ad7182 |
||
|
|
1d091e2132 |
||
|
|
3cf5b588a1 |
||
|
|
0008d3b78f |
||
|
|
ba31be1f91 |
||
|
|
30a78b60b4 |
||
|
|
7344d4c966 |
||
|
|
0f6d653b4a |
||
|
|
0b83679909 |
||
|
|
77b8daa1e8 |
||
|
|
64b4fa16de |
||
|
|
3e9950062b |
||
|
|
cc02e17e21 |
||
|
|
9658678eaa |
||
|
|
6fa5d4e6ed |
||
|
|
9d68315720 |
||
|
|
5dfc88f113 |
||
|
|
b170150a82 |
||
|
|
989ddc7568 |
||
|
|
9a75b891b2 |
||
|
|
4995746759 |
||
|
|
3fb521b71f |
||
|
|
926dcb4fe9 |
||
|
|
4f89a6f8ea |
||
|
|
94c94216d4 |
||
|
|
739c0e049d |
||
|
|
01d826aea0 |
||
|
|
c59c6060cd |
||
|
|
4f4dd8b6f0 |
||
|
|
621a70a724 |
||
|
|
61fe39b4db |
||
|
|
3af019144f |
||
|
|
f3bf1065db |
||
|
|
4fc95131bf |
||
|
|
2e55c842ba |
||
|
|
721ccd04b8 |
||
|
|
9da4a75ff6 |
||
|
|
9757f35fd1 |
||
|
|
8e7206cb15 |
||
|
|
04fed524a9 |
||
|
|
68c58b60b7 |
||
|
|
800f6d08fd |
||
|
|
9d55050a00 |
||
|
|
4b3f6252a4 |
||
|
|
38700569e7 |
||
|
|
f987bc43b2 |
||
|
|
0266171b92 |
||
|
|
14969c5da2 |
||
|
|
fd1186cc2d |
||
|
|
a7273bbf42 |
||
|
|
8961b03163 |
||
|
|
e8ca859429 |
||
|
|
e8a4ea5f89 |
||
|
|
6723c8ff10 |
||
|
|
c026b398a1 |
||
|
|
296b5921fb |
||
|
|
83d82a1caa |
||
|
|
704b6e0af9 |
||
|
|
eeb81c08bc |
||
|
|
1aa3c9c106 |
||
|
|
e13732ad38 |
||
|
|
5e4839d1f1 |
||
|
|
22205e6d03 |
||
|
|
a870456893 |
||
|
|
a2d2d8c6d0 |
||
|
|
20d623f20c |
||
|
|
2b0d11e64c |
||
|
|
bf623f832d |
||
|
|
7eb72c7b4c |
||
|
|
b093e39560 |
||
|
|
79744afd41 |
||
|
|
1ea1e9ef43 |
||
|
|
6b12fff1d0 |
||
|
|
9228662557 |
||
|
|
7046d7b1dc |
||
|
|
5d6fff2910 |
||
|
|
38e1f7af14 |
||
|
|
61951a5c78 |
||
|
|
c000ba6dd5 |
||
|
|
19fe73a08a |
||
|
|
ef8fc6e2f0 |
||
|
|
4f9a7ebc74 |
||
|
|
62c75203b6 |
||
|
|
0af4cdc305 |
||
|
|
76f2de7b19 |
||
|
|
b8a1349c07 |
||
|
|
26928b8622 |
||
|
|
134c71c29c |
||
|
|
30f79b9e3f |
||
|
|
87e30edb03 |
||
|
|
627ead3805 |
||
|
|
37533ff4c7 |
||
|
|
5373f01d6f |
||
|
|
02737db779 |
||
|
|
1728617194 |
||
|
|
e4a9766592 |
||
|
|
281a26b021 |
||
|
|
b4642b4338 |
||
|
|
9340bd800e |
||
|
|
ec389f473b |
||
|
|
82b1f29085 |
||
|
|
0be854b244 |
||
|
|
3de035dc8d |
||
|
|
47e437b631 |
||
|
|
4d9ba1ea0e |
||
|
|
219b4b1605 |
||
|
|
f07bdfbe27 |
||
|
|
b4ea8c53a2 |
||
|
|
6e40513dbf | ||
|
|
c49b4b5e5b |
||
|
|
5bbf277882 |
||
|
|
d185099ead |
||
|
|
90ba41720e |
||
|
|
32f7f40f57 |
||
|
|
5710a7e462 |
||
|
|
221e372a28 |
||
|
|
910c417fae |
||
|
|
da4406edc2 |
||
|
|
96c0af577d |
||
|
|
7e0fee6b03 |
||
|
|
2281bcf176 |
||
|
|
7eec75164a |
||
|
|
2af02baf46 |
||
|
|
8543d8d5dc | ||
|
|
3757271641 |
||
|
|
494c73e7ca |
||
|
|
37e127034f |
||
|
|
8cad9f04c0 |
||
|
|
05b1f22cd0 | ||
|
|
f615123711 |
||
|
|
8dbc06a355 |
||
|
|
0b48dfab7d |
||
|
|
5eab6da3fc |
||
|
|
62e1a5a0ae |
||
|
|
512016053d |
||
|
|
c2a0b5ccad |
||
|
|
291006ab73 |
||
|
|
a427e7127d |
||
|
|
22bffa8782 |
||
|
|
8242496f3e |
||
|
|
716d7c1c5c |
||
|
|
09e1684db4 |
||
|
|
c372c1f6a1 |
||
|
|
5c4000bafd |
||
|
|
a8ff280145 |
||
|
|
91c135350d | ||
|
|
666952980f |
||
|
|
0bbbfee8c2 |
||
|
|
a4fda18caa |
||
|
|
93b619cae6 |
||
|
|
c60ee352ae |
||
|
|
10d1f9dc6d |
||
|
|
3b15f063fe |
||
|
|
fd8cc978d4 |
||
|
|
a815f31392 |
||
|
|
f9c96d973c |
||
|
|
6d79123b97 |
||
|
|
0ea69081a0 |
||
|
|
faabb6d1af |
||
|
|
bcfffb6585 |
||
|
|
2dd56c3dce |
||
|
|
78b319e29a |
||
|
|
398f5b4e4a |
||
|
|
c39b40e7c8 |
||
|
|
27196b3b05 |
||
|
|
ec0f2174f3 |
||
|
|
13b6d06399 |
||
|
|
bb4e5c57f3 |
||
|
|
0278af6a2a |
||
|
|
5c4f4969b1 |
||
|
|
d7ff999d40 |
||
|
|
d37a789693 |
||
|
|
c02eb4d006 |
||
|
|
c3d91a13ad |
||
|
|
52cc193e1b |
||
|
|
6905aa8edc |
||
|
|
90b5ac520b |
||
|
|
adf0bbd611 |
||
|
|
2187bd4498 |
||
|
|
e93f8a0d8b |
||
|
|
e4f1a56c76 |
||
|
|
ef46849c09 |
||
|
|
13615613d4 |
||
|
|
246e1ab138 |
||
|
|
7f617b94c1 |
||
|
|
818bd71c9f |
||
|
|
6a2905d17d |
||
|
|
55f0ef0198 |
||
|
|
9acebd7f9f |
||
|
|
6028cf255f |
||
|
|
782756c833 |
||
|
|
c6c2428e0b |
||
|
|
6c8379ff3e |
||
|
|
1215bf33c3 |
||
|
|
f90e0bd090 |
||
|
|
9b1da10da1 |
||
|
|
d6705d970d |
||
|
|
47a5787ec3 |
||
|
|
605e31b6c5 |
||
|
|
ae9b96e1fd |
||
|
|
01fa6287bf |
||
|
|
f9abb74fc0 |
||
|
|
aec5240f22 |
||
|
|
298e884ec3 |
||
|
|
dc948d1af9 |
||
|
|
9c0ba003b4 |
||
|
|
d03123bb5c |
||
|
|
2d4311a25d |
||
|
|
9967693621 |
||
|
|
c2037f3474 |
||
|
|
a57bbd3278 |
||
|
|
ab88e79ec5 |
||
|
|
b695b2e9ba |
||
|
|
3eb467965a |
||
|
|
e479497371 |
||
|
|
ff86ef2ec4 |
||
|
|
d61b5ab4cf |
||
|
|
040ba82d59 |
||
|
|
def96b392a |
||
|
|
4d059e631e |
||
|
|
82a1353f09 |
||
|
|
93df6141c0 |
||
|
|
4546a686c3 |
||
|
|
6c767c4bd4 |
||
|
|
0058ad85bc |
||
|
|
00aecd1baf |
||
|
|
655231ded0 |
||
|
|
ed637a7552 |
||
|
|
d856b8bda6 |
||
|
|
1b537192ca |
||
|
|
2109dccadb |
||
|
|
56a2e79bba |
||
|
|
6eb82b5562 |
||
|
|
9557d41ce7 |
||
|
|
90ccd3a728 |
||
|
|
8c4168a092 |
||
|
|
89f58bf555 |
||
|
|
7bbf2bb250 |
||
|
|
ee5d3f85ac |
||
|
|
cfcbc9605f |
||
|
|
1003c17c2c |
||
|
|
25319cf226 |
||
|
|
1d9b23d0b9 |
||
|
|
58019a48ce |
||
|
|
ac65f46026 |
||
|
|
8a877b36b4 |
||
|
|
023f1fd233 |
||
|
|
4fc71656a3 |
||
|
|
9e42ee05a3 |
||
|
|
d12c2cccfa |
||
|
|
9dd995562a |
||
|
|
eb803723ef |
||
|
|
43c30a7665 |
||
|
|
e719be3cd7 |
||
|
|
c76f827368 |
||
|
|
17813898c0 |
||
|
|
36268be7ef | ||
|
|
8cd96adc5a | ||
|
|
e626b84d44 | ||
|
|
89653cbb7a | ||
|
|
e5b2a13996 | ||
|
|
3398ed49b4 | ||
|
|
05e07a76e7 | ||
|
|
a0265f92d2 | ||
|
|
a1ae100ef0 | ||
|
|
dce143e92e | ||
|
|
566ac58ab7 | ||
|
|
77306d1aaf | ||
|
|
fb5e96a719 | ||
|
|
7c3d1e817f | ||
|
|
78b24ae2ac | ||
|
|
26ae13df0f |
||
|
|
121034709e |
||
|
|
b594fc2dbd |
||
|
|
7078f81ceb | ||
|
|
f6ee5d5bdc |
||
|
|
864bb6dc2d |
||
|
|
24f43927e5 |
||
|
|
198a1be034 |
||
|
|
cba7b71e2b |
||
|
|
ccd41ac721 |
||
|
|
5ef3120e0c |
||
|
|
ad67b3e4bb |
||
|
|
f0c7cc1b14 | ||
|
|
ad04e89745 | ||
|
|
e5c90c7385 | ||
|
|
cac214f2cf |
||
|
|
def51a70ad |
||
|
|
e6983b36d0 |
||
|
|
f3b3c48a83 |
||
|
|
801e1b043a |
||
|
|
6c5aa52c95 |
||
|
|
de8048cb6d |
||
|
|
73ab853dc5 |
||
|
|
f71155ac7c |
||
|
|
a9d8e40fe6 |
||
|
|
8c87715628 |
||
|
|
fcd243a6f3 |
||
|
|
90dad1a86b | ||
|
|
d60224f363 |
||
|
|
f1a00f9e15 |
||
|
|
d27acc42b1 | ||
|
|
7ce5504f9f | ||
|
|
ac1130cda4 |
||
|
|
ed51361511 |
||
|
|
94c5dff983 |
||
|
|
cce8d5c7a3 |
||
|
|
8c3b1daf7e |
||
|
|
be8d725974 |
||
|
|
0936d52d0a |
||
|
|
b78cd74c1b |
||
|
|
89a684546b |
||
|
|
847427aeef |
||
|
|
b94982cc35 |
||
|
|
489d28b6da |
||
|
|
c73d36343b |
||
|
|
dbc7a41550 |
||
|
|
656a0292ae |
||
|
|
65a62a9fae |
||
|
|
75cbf8612c |
||
|
|
75ecd62384 |
||
|
|
5bb0c6b4c7 | ||
|
|
2ee15420a0 |
||
|
|
0927445025 |
||
|
|
db1b48552b |
||
|
|
96daa46a1d |
||
|
|
63b05b4fdd |
||
|
|
4140565b77 | ||
|
|
6166242136 |
||
|
|
969b905c10 |
||
|
|
aa6775485d |
||
|
|
d48e35d88a |
||
|
|
978d8e6fff |
||
|
|
631090f41e |
||
|
|
b231396d2b | ||
|
|
152b953ae6 |
||
|
|
574a768e09 |
||
|
|
8fa2961ffc |
||
|
|
bd892b6ce4 |
435 changed files with 56810 additions and 7275 deletions
14
.claude-plugin/marketplace.json
Normal file
14
.claude-plugin/marketplace.json
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"name": "mcp-apps",
|
||||||
|
"description": "Plugins for MCP Apps development",
|
||||||
|
"owner": {
|
||||||
|
"name": "MCP Apps"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
{
|
||||||
|
"name": "mcp-apps",
|
||||||
|
"source": "./plugins/mcp-apps",
|
||||||
|
"description": "Skills for creating MCP Apps with the MCP Apps SDK"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
114
.github/workflows/ci.yml
vendored
114
.github/workflows/ci.yml
vendored
|
|
@ -10,6 +10,36 @@ permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
prettier-fix:
|
||||||
|
name: Auto-fix formatting
|
||||||
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
token: ${{ github.token }}
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run prettier:fix
|
||||||
|
|
||||||
|
- name: Commit formatting changes
|
||||||
|
run: |
|
||||||
|
git diff --quiet && exit 0
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add -A
|
||||||
|
git commit -m "style: auto-fix prettier formatting"
|
||||||
|
git push
|
||||||
|
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
@ -30,7 +60,7 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Verify no private URLs in package-lock.json
|
- name: Verify no private URLs in package-lock.json
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -40,14 +70,19 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: node scripts/check-versions.mjs
|
run: node scripts/check-versions.mjs
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- run: npm install
|
- run: npm ci
|
||||||
|
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
|
|
||||||
|
- name: Validate TypeDoc links
|
||||||
|
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
|
||||||
|
run: npm exec typedoc -- --treatValidationWarningsAsErrors --emit none
|
||||||
|
|
||||||
- run: npm run examples:build
|
- run: npm run examples:build
|
||||||
|
|
||||||
- name: Verify generated schemas are up-to-date
|
- name: Verify generated schemas are up-to-date
|
||||||
|
|
@ -56,33 +91,72 @@ jobs:
|
||||||
npm run generate:schemas
|
npm run generate:schemas
|
||||||
git diff --exit-code src/generated/ || (echo "Generated schemas are out of date. Run 'npm run generate:schemas' and commit." && exit 1)
|
git diff --exit-code src/generated/ || (echo "Generated schemas are out of date. Run 'npm run generate:schemas' and commit." && exit 1)
|
||||||
|
|
||||||
|
- name: Verify synced snippets are up-to-date
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
npm run sync:snippets
|
||||||
|
git diff --exit-code src/ docs/ || (echo "Synced snippets are out of date. Run 'npm run sync:snippets' and commit." && exit 1)
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- run: npm run prettier
|
- run: npm run prettier
|
||||||
|
|
||||||
|
- name: Build MCPB bundle (pdf-server)
|
||||||
|
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
|
||||||
|
run: node build-mcpb.mjs
|
||||||
|
working-directory: examples/pdf-server
|
||||||
|
|
||||||
|
- name: Smoke-test MCPB bundle starts
|
||||||
|
if: runner.os == 'Linux' && matrix.name == 'Linux x64'
|
||||||
|
run: |
|
||||||
|
unzip -q pdf-server.mcpb -d .mcpb-smoke
|
||||||
|
node .mcpb-smoke/dist/index.js --stdio < /dev/null 2>&1 | tee /tmp/mcpb-smoke.log
|
||||||
|
grep -q "Ready" /tmp/mcpb-smoke.log
|
||||||
|
working-directory: examples/pdf-server
|
||||||
|
|
||||||
|
dependency-isolation:
|
||||||
|
name: Dependency isolation
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run test:dependency-isolation
|
||||||
|
|
||||||
e2e:
|
e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v7
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
|
# Headless runs without a channel use chromium-headless-shell, so the
|
||||||
|
# full Chromium build (about 165 MB) would only be downloaded, never run.
|
||||||
- name: Install Playwright browsers
|
- name: Install Playwright browsers
|
||||||
run: npx playwright install --with-deps chromium
|
run: npx playwright install --with-deps --only-shell chromium
|
||||||
|
|
||||||
- name: Run E2E tests
|
- name: Run E2E tests
|
||||||
run: npx playwright test --reporter=list
|
run: npx playwright test --reporter=list
|
||||||
|
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v6
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
|
|
@ -95,9 +169,9 @@ jobs:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- uses: Vampire/setup-wsl@v5
|
- uses: Vampire/setup-wsl@v6
|
||||||
with:
|
with:
|
||||||
distribution: Ubuntu-24.04
|
distribution: Ubuntu-24.04
|
||||||
|
|
||||||
|
|
@ -105,13 +179,18 @@ jobs:
|
||||||
shell: wsl-bash {0}
|
shell: wsl-bash {0}
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||||
sudo apt-get install -y nodejs
|
sudo apt-get install -y nodejs
|
||||||
|
|
||||||
|
# The checkout lives on the Windows drive, which WSL reaches over 9P;
|
||||||
|
# writing node_modules there is what makes this job slow (npm ci alone
|
||||||
|
# took about 3 minutes). Copy the tree onto the distro's ext4 filesystem
|
||||||
|
# first, as Microsoft's WSL guidance recommends for anything I/O heavy.
|
||||||
- name: Build and test in WSL
|
- name: Build and test in WSL
|
||||||
shell: wsl-bash {0}
|
shell: wsl-bash {0}
|
||||||
run: |
|
run: |
|
||||||
npm install
|
cp -r "$(pwd)" ~/ext-apps && cd ~/ext-apps
|
||||||
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
npm run examples:build
|
npm run examples:build
|
||||||
npm test
|
npm test
|
||||||
|
|
@ -138,17 +217,20 @@ jobs:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "22"
|
||||||
|
|
||||||
- name: Create test project and install from git
|
- name: Create test project and install from git
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
|
||||||
|
HEAD_REF: ${{ github.head_ref || github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
mkdir test-project
|
mkdir test-project
|
||||||
cd test-project
|
cd test-project
|
||||||
npm init -y
|
npm init -y
|
||||||
# Install from the PR branch (use head repo for fork PRs)
|
# Install from the PR branch (use head repo for fork PRs)
|
||||||
npm install "git+https://github.com/${{ github.event.pull_request.head.repo.full_name || github.repository }}#${{ github.head_ref || github.ref_name }}"
|
npm install "git+https://github.com/${HEAD_REPO}#${HEAD_REF}"
|
||||||
# Verify the package is usable (ESM import)
|
# Verify the package is usable (ESM import)
|
||||||
node --input-type=module -e "import { App } from '@modelcontextprotocol/ext-apps'; console.log('Import successful:', typeof App)"
|
node --input-type=module -e "import { App } from '@modelcontextprotocol/ext-apps'; console.log('Import successful:', typeof App)"
|
||||||
|
|
|
||||||
65
.github/workflows/docs-preview.yml
vendored
Normal file
65
.github/workflows/docs-preview.yml
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
name: Docs Preview
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened, closed]
|
||||||
|
paths:
|
||||||
|
- "docs/**"
|
||||||
|
- "src/**"
|
||||||
|
- "README.md"
|
||||||
|
- "typedoc.config.mjs"
|
||||||
|
- "scripts/typedoc-*.mjs"
|
||||||
|
- ".github/workflows/docs-preview.yml"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: docs-preview-${{ github.event.pull_request.number }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
# Refuse to run for fork PRs — forks do not have access to the Cloudflare
|
||||||
|
# secrets, so deploys would fail anyway.
|
||||||
|
if: >-
|
||||||
|
github.event.action != 'closed' &&
|
||||||
|
github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- run: npm run build
|
||||||
|
|
||||||
|
- run: npm run docs
|
||||||
|
|
||||||
|
- name: Deploy preview
|
||||||
|
uses: modelcontextprotocol/actions/cloudflare-pages-preview/deploy@main
|
||||||
|
with:
|
||||||
|
directory: docs
|
||||||
|
project-name: mcp-ext-apps-docs-preview
|
||||||
|
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
|
||||||
|
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
|
||||||
|
comment-title: "📖 Docs Preview Deployed"
|
||||||
|
comment-marker: "<!-- docs-preview-comment -->"
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if: >-
|
||||||
|
github.event.action == 'closed' &&
|
||||||
|
github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: modelcontextprotocol/actions/cloudflare-pages-preview/cleanup@main
|
||||||
|
with:
|
||||||
|
project-name: mcp-ext-apps-docs-preview
|
||||||
|
api-token: ${{ secrets.CF_PAGES_PREVIEW_API_TOKEN }}
|
||||||
|
account-id: ${{ secrets.CF_PAGES_PREVIEW_ACCOUNT_ID }}
|
||||||
|
comment-marker: "<!-- docs-preview-comment -->"
|
||||||
10
.github/workflows/docs.yml
vendored
10
.github/workflows/docs.yml
vendored
|
|
@ -12,12 +12,13 @@ jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "20"
|
node-version: "22"
|
||||||
- run: npm install
|
cache: npm
|
||||||
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run docs
|
- run: npm run docs
|
||||||
- uses: peaceiris/actions-gh-pages@v4
|
- uses: peaceiris/actions-gh-pages@v4
|
||||||
|
|
@ -26,3 +27,4 @@ jobs:
|
||||||
publish_dir: ./docs
|
publish_dir: ./docs
|
||||||
publish_branch: gh-pages
|
publish_branch: gh-pages
|
||||||
keep_files: true
|
keep_files: true
|
||||||
|
cname: apps.extensions.modelcontextprotocol.io
|
||||||
|
|
|
||||||
65
.github/workflows/npm-publish.yml
vendored
65
.github/workflows/npm-publish.yml
vendored
|
|
@ -14,11 +14,11 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
@ -31,17 +31,21 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: npm
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
|
# All publish jobs depend directly on [build, test] (not on each other) so
|
||||||
|
# they all enter "waiting for approval" together and can be approved in a
|
||||||
|
# single "Review deployments" click.
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
|
|
@ -53,11 +57,11 @@ jobs:
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
@ -88,7 +92,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release'
|
||||||
environment: Release
|
environment: Release
|
||||||
needs: [publish]
|
needs: [build, test]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -107,7 +111,10 @@ jobs:
|
||||||
- budget-allocator-server
|
- budget-allocator-server
|
||||||
- cohort-heatmap-server
|
- cohort-heatmap-server
|
||||||
- customer-segmentation-server
|
- customer-segmentation-server
|
||||||
|
- debug-server
|
||||||
|
- lazy-auth-server
|
||||||
- map-server
|
- map-server
|
||||||
|
- pdf-server
|
||||||
- scenario-modeler-server
|
- scenario-modeler-server
|
||||||
- shadertoy-server
|
- shadertoy-server
|
||||||
- sheet-music-server
|
- sheet-music-server
|
||||||
|
|
@ -118,11 +125,11 @@ jobs:
|
||||||
- wiki-explorer-server
|
- wiki-explorer-server
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: oven-sh/setup-bun@v2
|
- uses: oven-sh/setup-bun@v2
|
||||||
with:
|
with:
|
||||||
bun-version: latest
|
bun-version: latest
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: "22"
|
node-version: "22"
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
@ -132,7 +139,45 @@ jobs:
|
||||||
- name: Build example
|
- name: Build example
|
||||||
run: npm run build --workspace examples/${{ matrix.example }}
|
run: npm run build --workspace examples/${{ matrix.example }}
|
||||||
|
|
||||||
|
- name: Determine npm tag
|
||||||
|
id: npm-tag
|
||||||
|
run: |
|
||||||
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
|
if [[ "$VERSION" == *"-"* ]]; then
|
||||||
|
echo "tag=--tag beta" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "tag=" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Publish example
|
- name: Publish example
|
||||||
run: npm publish --workspace examples/${{ matrix.example }} --provenance --access public
|
run: npm publish --workspace examples/${{ matrix.example }} --provenance --access public ${{ steps.npm-tag.outputs.tag }}
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET }}
|
||||||
|
|
||||||
|
publish-mcpb:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
environment: Release
|
||||||
|
needs: [build, test]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- name: Build pdf-server + MCPB bundle
|
||||||
|
run: npm run build:mcpb --workspace examples/pdf-server
|
||||||
|
|
||||||
|
- name: Upload MCPB to release
|
||||||
|
run: gh release upload "${{ github.event.release.tag_name }}" examples/pdf-server/*.mcpb --clobber
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
|
||||||
16
.github/workflows/publish.yml
vendored
16
.github/workflows/publish.yml
vendored
|
|
@ -13,8 +13,8 @@ jobs:
|
||||||
pkg-publish:
|
pkg-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: npm
|
cache: npm
|
||||||
|
|
@ -24,12 +24,24 @@ jobs:
|
||||||
- run: |
|
- run: |
|
||||||
npx pkg-pr-new publish \
|
npx pkg-pr-new publish \
|
||||||
. \
|
. \
|
||||||
|
./examples/basic-server-preact \
|
||||||
./examples/basic-server-react \
|
./examples/basic-server-react \
|
||||||
|
./examples/basic-server-solid \
|
||||||
|
./examples/basic-server-svelte \
|
||||||
./examples/basic-server-vanillajs \
|
./examples/basic-server-vanillajs \
|
||||||
|
./examples/basic-server-vue \
|
||||||
./examples/budget-allocator-server \
|
./examples/budget-allocator-server \
|
||||||
./examples/cohort-heatmap-server \
|
./examples/cohort-heatmap-server \
|
||||||
./examples/customer-segmentation-server \
|
./examples/customer-segmentation-server \
|
||||||
|
./examples/debug-server \
|
||||||
|
./examples/lazy-auth-server \
|
||||||
|
./examples/map-server \
|
||||||
|
./examples/pdf-server \
|
||||||
./examples/scenario-modeler-server \
|
./examples/scenario-modeler-server \
|
||||||
|
./examples/shadertoy-server \
|
||||||
|
./examples/sheet-music-server \
|
||||||
./examples/system-monitor-server \
|
./examples/system-monitor-server \
|
||||||
./examples/threejs-server \
|
./examples/threejs-server \
|
||||||
|
./examples/transcript-server \
|
||||||
|
./examples/video-resource-server \
|
||||||
./examples/wiki-explorer-server
|
./examples/wiki-explorer-server
|
||||||
|
|
|
||||||
108
.github/workflows/update-snapshots.yml
vendored
Normal file
108
.github/workflows/update-snapshots.yml
vendored
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
name: Update E2E Snapshots
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
branch:
|
||||||
|
description: "Branch to update snapshots on"
|
||||||
|
required: true
|
||||||
|
default: "main"
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-snapshots:
|
||||||
|
# Run on workflow_dispatch OR when a maintainer comments "/update-snapshots" on a PR.
|
||||||
|
# author_association check prevents arbitrary commenters from triggering a job with
|
||||||
|
# contents:write that pushes a [skip ci] commit to the PR branch.
|
||||||
|
if: >
|
||||||
|
github.event_name == 'workflow_dispatch' ||
|
||||||
|
(github.event.issue.pull_request &&
|
||||||
|
contains(github.event.comment.body, '/update-snapshots') &&
|
||||||
|
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Get PR branch
|
||||||
|
if: github.event_name == 'issue_comment'
|
||||||
|
id: pr
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const pr = await github.rest.pulls.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: context.issue.number
|
||||||
|
});
|
||||||
|
core.setOutput('ref', pr.data.head.ref);
|
||||||
|
core.setOutput('sha', pr.data.head.sha);
|
||||||
|
|
||||||
|
- name: Add reaction to comment
|
||||||
|
if: github.event_name == 'issue_comment'
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
await github.rest.reactions.createForIssueComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
comment_id: context.payload.comment.id,
|
||||||
|
content: 'rocket'
|
||||||
|
});
|
||||||
|
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.branch || steps.pr.outputs.ref || github.ref }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: latest
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: npm
|
||||||
|
|
||||||
|
- uses: astral-sh/setup-uv@v7
|
||||||
|
|
||||||
|
- run: npm ci
|
||||||
|
|
||||||
|
- name: Install Playwright browsers
|
||||||
|
run: npx playwright install --with-deps chromium
|
||||||
|
|
||||||
|
- name: Update snapshots
|
||||||
|
run: npx playwright test --update-snapshots --reporter=list
|
||||||
|
|
||||||
|
- name: Commit updated snapshots
|
||||||
|
id: commit
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add tests/e2e/**/*.png
|
||||||
|
if git diff --staged --quiet; then
|
||||||
|
echo "changed=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "No snapshot changes to commit"
|
||||||
|
else
|
||||||
|
git commit -m "chore: update e2e snapshots [skip ci]"
|
||||||
|
git push
|
||||||
|
echo "changed=true" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Comment on PR
|
||||||
|
if: github.event_name == 'issue_comment'
|
||||||
|
uses: actions/github-script@v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const changed = '${{ steps.commit.outputs.changed }}' === 'true';
|
||||||
|
const body = changed
|
||||||
|
? '✅ Snapshots updated and pushed to this branch.'
|
||||||
|
: '✅ No snapshot changes needed - all snapshots are up to date.';
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
body
|
||||||
|
});
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -11,3 +11,10 @@ intermediate-findings/
|
||||||
# Playwright
|
# Playwright
|
||||||
playwright-report/
|
playwright-report/
|
||||||
test-results/
|
test-results/
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# MCPB bundles (built artifacts)
|
||||||
|
*.mcpb
|
||||||
|
.mcpb-stage/
|
||||||
|
.mcpb-smoke/
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
# Load Node.js environment for GUI apps (GitHub Desktop, etc.)
|
||||||
|
# that don't inherit shell PATH
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # nvm
|
||||||
|
[ -s "$HOME/.fnm/fnm" ] && eval "$(~/.fnm/fnm env)" # fnm
|
||||||
|
[ -s "$HOME/.volta/bin/volta" ] && export PATH="$HOME/.volta/bin:$PATH" # volta
|
||||||
|
[ -d "/opt/homebrew/bin" ] && export PATH="/opt/homebrew/bin:$PATH" # homebrew (macOS ARM)
|
||||||
|
[ -d "/usr/local/bin" ] && export PATH="/usr/local/bin:$PATH" # homebrew (macOS Intel)
|
||||||
|
|
||||||
# Verify no private registry URLs in package-lock.json
|
# Verify no private registry URLs in package-lock.json
|
||||||
if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.org > /dev/null; then
|
if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.org > /dev/null; then
|
||||||
echo "ERROR: package-lock.json contains non-npmjs.org URLs"
|
echo "ERROR: package-lock.json contains non-npmjs.org URLs"
|
||||||
|
|
@ -5,8 +14,16 @@ if grep -E '"resolved": "https?://' package-lock.json | grep -v registry.npmjs.o
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Capture staged files so we only re-stage what the user intended to commit
|
||||||
|
# (avoids sweeping unrelated WIP into the commit). --diff-filter=d skips
|
||||||
|
# deletions so the xargs git add below doesn't fail on removed paths.
|
||||||
|
STAGED=$(git diff --name-only --cached --diff-filter=d)
|
||||||
|
|
||||||
npm run build:all
|
npm run build:all
|
||||||
npm run prettier:fix
|
npm run prettier:fix
|
||||||
|
|
||||||
# Stage any changes to generated files (they may have been reformatted by prettier)
|
# Re-stage originally-staged files (prettier may have reformatted them)
|
||||||
|
echo "$STAGED" | xargs -r git add
|
||||||
|
|
||||||
|
# Also stage generated files (regenerated by build:all from spec.types.ts)
|
||||||
git add src/generated/
|
git add src/generated/
|
||||||
|
|
|
||||||
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
registry=https://registry.npmjs.org/
|
||||||
|
|
@ -2,4 +2,8 @@ examples/basic-host/**/*.ts
|
||||||
examples/basic-host/**/*.tsx
|
examples/basic-host/**/*.tsx
|
||||||
examples/basic-server-*/**/*.ts
|
examples/basic-server-*/**/*.ts
|
||||||
examples/basic-server-*/**/*.tsx
|
examples/basic-server-*/**/*.tsx
|
||||||
|
examples/quickstart/**/*.ts
|
||||||
**/vendor/**
|
**/vendor/**
|
||||||
|
**/.build/**
|
||||||
|
**/.claude/**
|
||||||
|
SKILL.md
|
||||||
|
|
|
||||||
40
AGENTS.md
40
AGENTS.md
|
|
@ -6,11 +6,11 @@ MCP Apps SDK (`@modelcontextprotocol/ext-apps`) enables MCP servers to display i
|
||||||
|
|
||||||
Key abstractions:
|
Key abstractions:
|
||||||
|
|
||||||
- **Guest** - UI running in an iframe, uses `App` class with `PostMessageTransport` to communicate with host
|
- **View** - UI running in an iframe, uses `App` class with `PostMessageTransport` to communicate with host
|
||||||
- **Host** - Chat client embedding the iframe, uses `AppBridge` class to proxy MCP requests
|
- **Host** - Chat client embedding the iframe, uses `AppBridge` class to proxy MCP requests
|
||||||
- **Server** - MCP server that registers tools/resources with UI metadata
|
- **Server** - MCP server that registers tools/resources with UI metadata
|
||||||
|
|
||||||
Specification (draft): `specification/draft/apps.mdx`
|
Specification (stable): `specification/2026-01-26/apps.mdx`
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
|
|
@ -39,7 +39,10 @@ npm test
|
||||||
# Check JSDoc comment syntax and `{@link}` references
|
# Check JSDoc comment syntax and `{@link}` references
|
||||||
npm exec typedoc -- --treatValidationWarningsAsErrors --emit none
|
npm exec typedoc -- --treatValidationWarningsAsErrors --emit none
|
||||||
|
|
||||||
# Regenerate package-lock.json (especially on setups w/ custom npm registry)
|
# Regenerate package-lock.json
|
||||||
|
# Note: repo .npmrc pins registry to npmjs.org, so a plain `npm i` is safe even
|
||||||
|
# if your global npm config points elsewhere. The Docker step below is optional
|
||||||
|
# — it locks linux-amd64 optionalDependencies (sharp, rollup, bun) for CI.
|
||||||
rm -fR package-lock.json node_modules && \
|
rm -fR package-lock.json node_modules && \
|
||||||
docker run --rm -it --platform linux/amd64 -v $PWD:/src:rw -w /src node:latest npm i && \
|
docker run --rm -it --platform linux/amd64 -v $PWD:/src:rw -w /src node:latest npm i && \
|
||||||
rm -fR node_modules && \
|
rm -fR node_modules && \
|
||||||
|
|
@ -57,8 +60,8 @@ rm -fR package-lock.json node_modules && \
|
||||||
|
|
||||||
### Key Source Files
|
### Key Source Files
|
||||||
|
|
||||||
- `src/app.ts` - `App` class extends MCP Protocol, handles guest initialization, tool calls, messaging
|
- `src/app.ts` - `App` subclasses `Protocol` from `@modelcontextprotocol/client`, handles View initialization, tool calls, and messaging
|
||||||
- `src/app-bridge.ts` - `AppBridge` class for hosts, proxies MCP requests, sends tool input/results to guests
|
- `src/app-bridge.ts` - `AppBridge` subclasses `Protocol` from `@modelcontextprotocol/client` for the iframe channel and proxies through a separate outer `Client`
|
||||||
- `src/server/index.ts` - Helpers for MCP servers to register tools/resources with UI metadata
|
- `src/server/index.ts` - Helpers for MCP servers to register tools/resources with UI metadata
|
||||||
- `src/types.ts` - Protocol types re-exported from `spec.types.ts` and Zod schemas from `generated/schema.ts` (auto-generated during build)
|
- `src/types.ts` - Protocol types re-exported from `spec.types.ts` and Zod schemas from `generated/schema.ts` (auto-generated during build)
|
||||||
- `src/message-transport.ts` - `PostMessageTransport` for iframe communication
|
- `src/message-transport.ts` - `PostMessageTransport` for iframe communication
|
||||||
|
|
@ -67,21 +70,34 @@ rm -fR package-lock.json node_modules && \
|
||||||
### Protocol Flow
|
### Protocol Flow
|
||||||
|
|
||||||
```
|
```
|
||||||
Guest UI (App) <--PostMessageTransport--> Host (AppBridge) <--MCP Client--> MCP Server
|
View (App/Protocol) <--PostMessageTransport--> Host (AppBridge/Protocol) <--separate MCP Client--> MCP Server
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Host creates iframe with Guest UI HTML
|
1. Host creates iframe with view HTML
|
||||||
2. Guest UI creates `App` instance and calls `connect()` with `PostMessageTransport`
|
2. View creates `App` instance and calls `connect()` with `PostMessageTransport`
|
||||||
3. App sends `ui/initialize` request, receives host capabilities and context
|
3. View sends `ui/initialize` (the only handshake on the iframe channel) and receives authoritative Apps capabilities and context
|
||||||
4. Host sends `sendToolInput()` with tool arguments after initialization
|
4. Host sends `sendToolInput()` with tool arguments after initialization
|
||||||
5. Guest UI can call server tools via `app.callServerTool()` or send messages via `app.sendMessage()`
|
5. View can call server tools via `app.callServerTool()` or send messages via `app.sendMessage()`
|
||||||
6. Host sends `sendToolResult()` when tool execution completes
|
6. Host sends `sendToolResult()` when tool execution completes
|
||||||
7. Host calls `teardownResource()` before unmounting iframe
|
7. Host calls `teardownResource()` before unmounting iframe
|
||||||
|
|
||||||
## Examples
|
## Documentation
|
||||||
|
|
||||||
Uses npm workspaces. Examples in `examples/` are separate packages:
|
JSDoc `@example` tags should pull type-checked code from companion `.examples.ts` files (e.g., `app.ts` → `app.examples.ts`). Use ` ```ts source="./file.examples.ts#regionName" ` fences referencing `//#region regionName` blocks; region names follow `exportedName_variant` or `ClassName_methodName_variant` pattern (e.g., `useApp_basicUsage`, `App_hostCapabilities_checkAfterConnection`). For whole-file inclusion (any file type), omit the `#regionName`. Run `npm run sync:snippets` to sync.
|
||||||
|
|
||||||
|
Standalone docs in `docs/` (listed in `typedoc.config.mjs` `projectDocuments`) can also have type-checked companion `.ts`/`.tsx` files using the same pattern.
|
||||||
|
|
||||||
|
## Full Examples
|
||||||
|
|
||||||
|
Uses npm workspaces. Full examples in `examples/` are separate packages:
|
||||||
|
|
||||||
- `basic-server-*` - Starter templates (vanillajs, react, vue, svelte, preact, solid). Use these as the basis for new examples.
|
- `basic-server-*` - Starter templates (vanillajs, react, vue, svelte, preact, solid). Use these as the basis for new examples.
|
||||||
- `basic-host` - Reference host implementation
|
- `basic-host` - Reference host implementation
|
||||||
- Other examples showcase specific features (charts, 3D, video, etc.)
|
- Other examples showcase specific features (charts, 3D, video, etc.)
|
||||||
|
|
||||||
|
## Claude Code Plugin
|
||||||
|
|
||||||
|
The `plugins/mcp-apps/` directory contains a Claude Code plugin distributed via the plugin marketplace. It provides the following Claude Code skills files:
|
||||||
|
|
||||||
|
- `plugins/mcp-apps/skills/create-mcp-app/SKILL.md` — for creating an MCP App
|
||||||
|
- `plugins/mcp-apps/skills/migrate-oai-app/SKILL.md` — for migrating an app from the OpenAI Apps SDK to the MCP Apps SDK
|
||||||
|
|
|
||||||
458
CONTRIBUTING.md
458
CONTRIBUTING.md
|
|
@ -25,6 +25,15 @@ We welcome contributions to the MCP Apps SDK! This document outlines the process
|
||||||
- Update documentation as needed
|
- Update documentation as needed
|
||||||
- Keep changes focused and atomic
|
- Keep changes focused and atomic
|
||||||
- Provide a clear description of changes
|
- Provide a clear description of changes
|
||||||
|
- **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
|
||||||
|
|
||||||
|
## Examples Policy
|
||||||
|
|
||||||
|
The examples in `examples/` are maintained by the core team. **We do not accept pull requests that add new example servers from outside contributors.** Each example carries an ongoing maintenance cost — keeping it building, tested, and up to date with SDK changes — so we are deliberate about what we add.
|
||||||
|
|
||||||
|
If you have an idea for an example that would provide significant educational value, please [open an issue](https://github.com/modelcontextprotocol/ext-apps/issues) describing what the example would demonstrate and why it would be useful, and maintainers will evaluate the request.
|
||||||
|
|
||||||
|
PRs that add new examples without a prior approved issue may be closed.
|
||||||
|
|
||||||
## Running Examples
|
## Running Examples
|
||||||
|
|
||||||
|
|
@ -40,6 +49,408 @@ Or build and run examples:
|
||||||
npm run examples:start
|
npm run examples:start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### With MCP Clients
|
||||||
|
|
||||||
|
To use these examples with MCP clients that support the stdio transport (such as Claude Desktop or VS Code), add this MCP server configuration to your client's settings:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>MCP client configuration for all examples (using stdio)</summary>
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"basic-react": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-react",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-vanillajs": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-vanillajs",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-vue": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-vue",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-svelte": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-svelte",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-preact": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-preact",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-solid": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-basic-solid",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"budget-allocator": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-budget-allocator",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cohort-heatmap": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-cohort-heatmap",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"customer-segmentation": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-customer-segmentation",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"map": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-map",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pdf": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-pdf",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scenario-modeler": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-scenario-modeler",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shadertoy": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-shadertoy",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sheet-music": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-sheet-music",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system-monitor": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-system-monitor",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"threejs": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-threejs",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"transcript": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-transcript",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"video-resource": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-video-resource",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"wiki-explorer": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": [
|
||||||
|
"-y",
|
||||||
|
"--silent",
|
||||||
|
"--registry=https://registry.npmjs.org/",
|
||||||
|
"@modelcontextprotocol/server-wiki-explorer",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"qr": {
|
||||||
|
"command": "uv",
|
||||||
|
"args": [
|
||||||
|
"run",
|
||||||
|
"/path/to/ext-apps/examples/qr-server/server.py",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"say": {
|
||||||
|
"command": "uv",
|
||||||
|
"args": [
|
||||||
|
"run",
|
||||||
|
"--default-index",
|
||||||
|
"https://pypi.org/simple",
|
||||||
|
"https://raw.githubusercontent.com/modelcontextprotocol/ext-apps/refs/heads/main/examples/say-server/server.py",
|
||||||
|
"--stdio"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The `qr` server requires cloning the repository first. See [qr-server README](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) for details.
|
||||||
|
|
||||||
|
### Local Development
|
||||||
|
|
||||||
|
To test local modifications with MCP clients, first clone and install the repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/modelcontextprotocol/ext-apps.git
|
||||||
|
cd ext-apps
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
Then configure your MCP client to build and run the local server. Replace `~/src/ext-apps` with your actual clone path.
|
||||||
|
|
||||||
|
Most example servers have a `start:stdio` script that builds and launches in stdio mode:
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>MCP client configuration for local development (all examples)</summary>
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"basic-react": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-react && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-vanillajs": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-vanillajs && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-vue": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-vue && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-svelte": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-svelte && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-preact": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-preact && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"basic-solid": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/basic-server-solid && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"budget-allocator": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/budget-allocator-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"cohort-heatmap": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/cohort-heatmap-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"customer-segmentation": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/customer-segmentation-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"map": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/map-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"pdf": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/pdf-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"scenario-modeler": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/scenario-modeler-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"shadertoy": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/shadertoy-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sheet-music": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/sheet-music-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"system-monitor": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/system-monitor-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"threejs": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/threejs-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"transcript": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/transcript-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"video-resource": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/video-resource-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"wiki-explorer": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/src/ext-apps/examples/wiki-explorer-server && npm --silent run start:stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"qr": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"uv run ~/src/ext-apps/examples/qr-server/server.py --stdio"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"say": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"uv run --index https://pypi.org/simple ~/src/ext-apps/examples/say-server/server.py --stdio"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
This configuration rebuilds each server on launch, ensuring your local changes are picked up.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
@ -79,9 +490,19 @@ npm run test:e2e:update -- --grep "Three.js"
|
||||||
|
|
||||||
**Note**: Golden screenshots are platform-agnostic. Tests use canvas masking and tolerance thresholds to handle minor cross-platform rendering differences.
|
**Note**: Golden screenshots are platform-agnostic. Tests use canvas masking and tolerance thresholds to handle minor cross-platform rendering differences.
|
||||||
|
|
||||||
|
#### Updating Snapshots in CI
|
||||||
|
|
||||||
|
If E2E tests fail in CI due to screenshot mismatches, you can update snapshots directly from your PR:
|
||||||
|
|
||||||
|
1. Comment `/update-snapshots` on the PR
|
||||||
|
2. The workflow will update snapshots and push to your branch
|
||||||
|
3. A comment will confirm when complete
|
||||||
|
|
||||||
|
Alternatively, use the [workflow dispatch](https://github.com/modelcontextprotocol/ext-apps/actions/workflows/update-snapshots.yml) to manually trigger updates for any branch.
|
||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
This project follows our [Code of Conduct](CODE_OF_CONDUCT.md). Please review it before contributing.
|
This project follows our [Code of Conduct](https://github.com/modelcontextprotocol/.github/blob/main/CODE_OF_CONDUCT.md). Please review it before contributing.
|
||||||
|
|
||||||
## Reporting Issues
|
## Reporting Issues
|
||||||
|
|
||||||
|
|
@ -118,40 +539,17 @@ Before publishing releases, ensure the following are configured:
|
||||||
|
|
||||||
### Publishing a Release
|
### Publishing a Release
|
||||||
|
|
||||||
Releases are published automatically via GitHub Actions when a GitHub Release is created.
|
1. **Bump the version** across the root and all workspace packages:
|
||||||
|
|
||||||
#### Steps to publish:
|
|
||||||
|
|
||||||
1. **Update the version** in `package.json`:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# For a regular release
|
npm run bump -- minor # or: patch | major | prerelease --preid=beta | 1.7.0
|
||||||
npm version patch # or minor, or major
|
|
||||||
|
|
||||||
# For a beta release
|
|
||||||
npm version prerelease --preid=beta
|
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Commit the version bump** (if not done by `npm version`):
|
Commit and open a PR with a grouped changelog in the body (see prior `chore: bump …` PRs for the format).
|
||||||
|
|
||||||
```bash
|
2. **Merge the PR**, then [draft a GitHub Release](https://github.com/modelcontextprotocol/ext-apps/releases/new) — create a `vX.Y.Z` tag on `main`, paste the changelog, publish.
|
||||||
git add package.json
|
|
||||||
git commit -m "Bump version to X.Y.Z"
|
|
||||||
git push origin main
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **Create a GitHub Release**:
|
3. **Approve the deployment** — publishing the Release triggers the [npm-publish workflow](https://github.com/modelcontextprotocol/ext-apps/actions/workflows/npm-publish.yml); all publish jobs wait together for a single "Review deployments" approval.
|
||||||
- Go to [Releases](https://github.com/modelcontextprotocol/ext-apps/releases)
|
|
||||||
- Click "Draft a new release"
|
|
||||||
- Create a new tag matching the version (e.g., `v0.1.0`)
|
|
||||||
- Set the target branch (usually `main`)
|
|
||||||
- Write release notes describing the changes
|
|
||||||
- Click "Publish release"
|
|
||||||
|
|
||||||
4. **Monitor the workflow**:
|
|
||||||
- The [npm-publish workflow](https://github.com/modelcontextprotocol/ext-apps/actions/workflows/npm-publish.yml) will trigger automatically
|
|
||||||
- It runs build and test jobs before publishing
|
|
||||||
- On success, the package is published to npm with provenance
|
|
||||||
|
|
||||||
#### npm Tags
|
#### npm Tags
|
||||||
|
|
||||||
|
|
@ -175,7 +573,7 @@ To release a patch for an older version:
|
||||||
|
|
||||||
### Testing Pre-releases
|
### Testing Pre-releases
|
||||||
|
|
||||||
Every commit and PR automatically publishes a preview package via [pkg-pr-new](https://github.com/pkg-pr-new/pkg-pr-new). Check the PR comments or workflow logs for the install command.
|
Every commit and PR automatically publishes a preview package via [pkg-pr-new](https://github.com/stackblitz-labs/pkg.pr.new). Check the PR comments or workflow logs for the install command.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
197
LICENSE
197
LICENSE
|
|
@ -1,6 +1,193 @@
|
||||||
|
The MCP project is undergoing a licensing transition from the MIT License to the Apache License, Version 2.0 ("Apache-2.0"). All new code and specification contributions to the project are licensed under Apache-2.0. Documentation contributions (excluding specifications) are licensed under CC-BY-4.0.
|
||||||
|
|
||||||
|
Contributions for which relicensing consent has been obtained are licensed under Apache-2.0. Contributions made by authors who originally licensed their work under the MIT License and who have not yet granted explicit permission to relicense remain licensed under the MIT License.
|
||||||
|
|
||||||
|
No rights beyond those granted by the applicable original license are conveyed for such contributions.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to the Licensor for inclusion in the Work by the copyright
|
||||||
|
owner or by an individual or Legal Entity authorized to submit on behalf
|
||||||
|
of the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 Anthropic, PBC
|
Copyright (c) 2024-2025 Model Context Protocol a Series of LF Projects, LLC.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
@ -19,3 +206,11 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Creative Commons Attribution 4.0 International (CC-BY-4.0)
|
||||||
|
|
||||||
|
Documentation in this project (excluding specifications) is licensed under
|
||||||
|
CC-BY-4.0. See https://creativecommons.org/licenses/by/4.0/legalcode for
|
||||||
|
the full license text.
|
||||||
|
|
|
||||||
303
README.md
303
README.md
|
|
@ -1,85 +1,284 @@
|
||||||
# @modelcontextprotocol/ext-apps
|
<!-- LOGO -->
|
||||||
|
<div align="center">
|
||||||
|
<picture>
|
||||||
|
<source media="(prefers-color-scheme: dark)" srcset="media/mcp-white.svg">
|
||||||
|
<source media="(prefers-color-scheme: light)" srcset="media/mcp.svg">
|
||||||
|
<img src="media/mcp.svg" alt="MCP Apps" width="128">
|
||||||
|
</picture>
|
||||||
|
<h1>MCP Apps</h1>
|
||||||
|
<p>
|
||||||
|
Build interactive UIs for MCP tools — charts, forms, dashboards — that render inline in Claude, ChatGPT and any other compliant chat client.
|
||||||
|
<br /><br />
|
||||||
|
<a href="#why-mcp-apps">Why</a>
|
||||||
|
·
|
||||||
|
<a href="https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html">Quickstart</a>
|
||||||
|
·
|
||||||
|
<a href="https://apps.extensions.modelcontextprotocol.io/api/">API Docs</a>
|
||||||
|
·
|
||||||
|
<a href="https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx">Spec</a>
|
||||||
|
·
|
||||||
|
<a href="CONTRIBUTING.md">Contributing</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@modelcontextprotocol/ext-apps) [](https://modelcontextprotocol.github.io/ext-apps/api/)
|
<p align="center">
|
||||||
|
<a href="https://github.com/modelcontextprotocol/ext-apps/actions/workflows/ci.yml"><img src="https://github.com/modelcontextprotocol/ext-apps/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
||||||
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License: Apache 2.0"></a>
|
||||||
|
<a href="https://www.npmjs.com/package/@modelcontextprotocol/ext-apps"><img src="https://img.shields.io/npm/v/@modelcontextprotocol/ext-apps.svg" alt="npm version"></a>
|
||||||
|
<a href="https://www.npmjs.com/package/@modelcontextprotocol/ext-apps"><img src="https://img.shields.io/npm/dm/@modelcontextprotocol/ext-apps.svg" alt="npm downloads"></a>
|
||||||
|
<a href="https://github.com/modelcontextprotocol/ext-apps"><img src="https://img.shields.io/github/stars/modelcontextprotocol/ext-apps" alt="GitHub stars"></a>
|
||||||
|
<a href="https://apps.extensions.modelcontextprotocol.io/api/"><img src="https://img.shields.io/badge/docs-API%20Reference-blue" alt="API Documentation"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
This repo contains the SDK and [specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx) for MCP Apps Extension ([SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
|
<p align="center">
|
||||||
|
<img src="media/excalidraw.gif" alt="MCP Apps demo" width="600">
|
||||||
|
<br><em>Excalidraw built with MCP Apps, running in Claude</em>
|
||||||
|
</p>
|
||||||
|
|
||||||
MCP Apps are a proposed standard inspired by [MCP-UI](https://mcpui.dev/) and [OpenAI's Apps SDK](https://developers.openai.com/apps-sdk/) to allow MCP Servers to display interactive UI elements in conversational MCP clients / chatbots.
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Build with Agent Skills](#build-with-agent-skills)
|
||||||
|
- [Supported Clients](#supported-clients)
|
||||||
|
- [Why MCP Apps?](#why-mcp-apps)
|
||||||
|
- [How It Works](#how-it-works)
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
- [Using the SDK](#using-the-sdk)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [Specification](#specification)
|
||||||
|
- [Resources](#resources)
|
||||||
|
- [Contributing](#contributing)
|
||||||
|
|
||||||
|
## Build with Agent Skills
|
||||||
|
|
||||||
|
The fastest way to build an MCP App is to let your AI coding agent do it. This
|
||||||
|
repo ships four [Agent Skills](https://agentskills.io/) — install them once,
|
||||||
|
then just ask:
|
||||||
|
|
||||||
|
| Skill | What it does | Try it |
|
||||||
|
| --------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------- |
|
||||||
|
| [`create-mcp-app`](./plugins/mcp-apps/skills/create-mcp-app/SKILL.md) | Scaffolds a new MCP App with an interactive UI from scratch | _"Create an MCP App"_ |
|
||||||
|
| [`migrate-oai-app`](./plugins/mcp-apps/skills/migrate-oai-app/SKILL.md) | Converts an existing OpenAI App to use MCP Apps | _"Migrate from OpenAI Apps SDK"_ |
|
||||||
|
| [`add-app-to-server`](./plugins/mcp-apps/skills/add-app-to-server/SKILL.md) | Adds interactive UI to an existing MCP server's tools | _"Add UI to my MCP server"_ |
|
||||||
|
| [`convert-web-app`](./plugins/mcp-apps/skills/convert-web-app/SKILL.md) | Turns an existing web app into a hybrid web + MCP App | _"Add MCP App support to my web app"_ |
|
||||||
|
|
||||||
|
### Install the Skills
|
||||||
|
|
||||||
|
**Claude Code** — install via the plugin marketplace:
|
||||||
|
|
||||||
|
```
|
||||||
|
/plugin marketplace add modelcontextprotocol/ext-apps
|
||||||
|
/plugin install mcp-apps@modelcontextprotocol-ext-apps
|
||||||
|
```
|
||||||
|
|
||||||
|
**Other agents** — any AI coding agent that supports
|
||||||
|
[Agent Skills](https://agentskills.io/) can use these skills. See the
|
||||||
|
[agent skills guide](./docs/agent-skills.md) for manual installation
|
||||||
|
instructions.
|
||||||
|
|
||||||
|
Once installed, verify by asking your agent _"What skills do you have?"_ — you
|
||||||
|
should see `create-mcp-app`, `migrate-oai-app`, `add-app-to-server`, and
|
||||||
|
`convert-web-app` in the list. Then just ask it to create or migrate an app and
|
||||||
|
it will guide you through the rest.
|
||||||
|
|
||||||
|
## Supported Clients
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://developers.openai.com/apps-sdk/mcp-apps-in-chatgpt/"><img src="https://img.shields.io/badge/ChatGPT-docs-74aa9c?logo=openai&logoColor=white" alt="ChatGPT"></a>
|
||||||
|
<a href="https://claude.com/docs/connectors/building/mcp-apps/getting-started"><img src="https://img.shields.io/badge/Claude-docs-d97706?logo=claude&logoColor=white" alt="Claude"></a>
|
||||||
|
<a href="https://code.visualstudio.com/blogs/2026/01/26/mcp-apps-support"><img src="https://img.shields.io/badge/VS_Code-docs-007ACC?logo=visualstudiocode&logoColor=white" alt="VS Code"></a>
|
||||||
|
<a href="https://block.github.io/goose/docs/tutorials/building-mcp-apps/"><img src="https://img.shields.io/badge/Goose-docs-000000?logo=goose&logoColor=white" alt="Goose"></a>
|
||||||
|
<a href="https://learning.postman.com/docs/postman-ai/mcp-requests/interact"><img src="https://img.shields.io/badge/Postman-docs-FF6C37?logo=postman&logoColor=white" alt="Postman"></a>
|
||||||
|
<a href="https://www.mcpjam.com/blog/mcp-apps-example"><img src="https://img.shields.io/badge/MCPJam-docs-8B5CF6" alt="MCPJam"></a>
|
||||||
|
<a href="https://manufact.com/inspector"><img src="https://img.shields.io/badge/mcp--use-inspector-E5F3FD" alt="mcp-use"></a>
|
||||||
|
<a href="https://docs.alpic.ai/distribution/playground"><img src="https://img.shields.io/badge/Alpic-playground-E90060?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAKlBMVEUKDhz%2F%2F%2F%2BjpaogJDFBRE%2Fw8PHHyMvh4eNmaHF1d4CUlpuFho2ztLhWWWP5YkbJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1klEQVR42u2Y0ZKDIAxFBQQF8f9%2FdyW7dhAu7U7Iy87mzvShGfXU3CTGLotKpVKpVCqV6h%2FI2VuxfF3tUwcdVEccA2LNS%2BWCq2mUykG%2BCtg5iNmv76mllOApCPHrFQgNxJf8HHIQs10XdFtDKcEKPQ0x4brg6htKWGr0PIR8jq0tj4oQgJiIzD8rtATErMAWMj%2FxIYcBPjuPgoENcW3Jks%2BdLeXS32jLmise%2BZxQ8GRD%2BkkCbSlByi0Pgm3p0P6nJ1meXJ%2F8K1tKo7qUOFM4wdxEMMS4iSp9sqFJQrZ4hOZBTEa5gbaQ%2BTwI%2FcCu8TOq482xIWZkSx8MfAi0xcOEJTZkULKohXjm29epGU2SIGK%2BfT9J%2Bjre%2BRBYsiUYBSHkaEI2B0EInRx%2BkbApiB89EaMgBNdx7u5vDoJH79ne3yQElqxvEzYLKY%2Bl81PCZiFUsvlDwqYhw80uSkJg4z8Ttsss3OltwgQgMGGPlpSAwITVM0wCgius6iARCGzJcn%2BHJCSMXraCIATPsPW2SggCh364a1sIgveUew%2BTgtBGsuE9zDspyLBZ3M5aVCOCUDFlqXUbrm8j7%2FnvJ2B9G3kf%2BZBlt0iu%2Fr%2BNxHqRU6lUKpVKpVL9UX0BOrAPfcbTY8UAAAAASUVORK5CYII%3D" alt="Alpic Playground"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> MCP Apps is an extension to the
|
||||||
|
> [core MCP specification](https://modelcontextprotocol.io/specification). Host
|
||||||
|
> support varies — see the
|
||||||
|
> [clients page](https://modelcontextprotocol.io/clients) for the full list.
|
||||||
|
|
||||||
|
## Why MCP Apps?
|
||||||
|
|
||||||
|
MCP tools return text and structured data. That works for many cases, but not
|
||||||
|
when you need an interactive UI, like a chart, form, design canvas or video player.
|
||||||
|
|
||||||
|
MCP Apps provide a standardized way to deliver interactive UIs from MCP servers.
|
||||||
|
Your UI renders inline in the conversation, in context, in any compliant host.
|
||||||
|
|
||||||
## How It Works
|
## How It Works
|
||||||
|
|
||||||
MCP Apps extend the Model Context Protocol to let servers deliver **interactive UIs** to MCP hosts. Here's how it works:
|
MCP Apps extend the Model Context Protocol by letting tools declare UI
|
||||||
|
resources:
|
||||||
|
|
||||||
1. **Tool call** — The LLM calls a tool on your server
|
1. **Tool definition** — Your tool declares a `ui://` resource containing its
|
||||||
2. **UI Resource** — The tool's definition links to a predeclared `ui://` resource containing its HTML interface
|
HTML interface
|
||||||
3. **Host renders** — The host fetches the resource and displays it in a sandboxed iframe
|
2. **Tool call** — The LLM calls the tool on your server
|
||||||
4. **Bidirectional communication** — The host passes tool data to the UI via notifications, and the UI can call other tools through the host
|
3. **Host renders** — The host fetches the resource and displays it in a
|
||||||
|
sandboxed iframe
|
||||||
|
4. **Bidirectional communication** — The host passes tool data to the UI via
|
||||||
|
notifications, and the UI can call other tools through the host
|
||||||
|
|
||||||
This enables dashboards, forms, visualizations, and other rich experiences inside chat interfaces.
|
## Getting Started
|
||||||
|
|
||||||
## Overview
|
Requires Node.js 20+. The base MCP SDK packages are `^2.0.0` peers of
|
||||||
|
`ext-apps` (`@modelcontextprotocol/core` is a required peer that `client` already depends on, so npm installs it for you).
|
||||||
|
|
||||||
This SDK serves two audiences:
|
For a View or host:
|
||||||
|
|
||||||
### App Developers
|
|
||||||
|
|
||||||
Build interactive UIs that run inside MCP-enabled chat clients.
|
|
||||||
|
|
||||||
- **SDK for Apps**: `@modelcontextprotocol/ext-apps` — [API Docs](https://modelcontextprotocol.github.io/ext-apps/api/modules/app.html)
|
|
||||||
- **React hooks**: `@modelcontextprotocol/ext-apps/react` — [API Docs](https://modelcontextprotocol.github.io/ext-apps/api/modules/_modelcontextprotocol_ext-apps_react.html)
|
|
||||||
|
|
||||||
### Host Developers
|
|
||||||
|
|
||||||
Embed and communicate with MCP Apps in your chat application.
|
|
||||||
|
|
||||||
- **SDK for Hosts**: `@modelcontextprotocol/ext-apps/app-bridge` — [API Docs](https://modelcontextprotocol.github.io/ext-apps/api/modules/app-bridge.html)
|
|
||||||
|
|
||||||
There's no _supported_ host implementation in this repo (beyond the [examples/basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example).
|
|
||||||
|
|
||||||
We have [contributed a tentative implementation](https://github.com/MCP-UI-Org/mcp-ui/pull/147) of hosting / iframing / sandboxing logic to the [MCP-UI](https://github.com/idosal/mcp-ui) repository, and expect OSS clients may use it, while other clients might roll their own hosting logic.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install -S @modelcontextprotocol/ext-apps
|
npm install -S @modelcontextprotocol/ext-apps \
|
||||||
|
@modelcontextprotocol/client@^2.0.0 \
|
||||||
|
zod@^4.2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
Or edit your `package.json` manually:
|
For an MCP server, add the server package (and, for HTTP transports, the Node
|
||||||
|
and Express adapters):
|
||||||
|
|
||||||
```json
|
```bash
|
||||||
{
|
npm install -S @modelcontextprotocol/ext-apps \
|
||||||
"dependencies": {
|
@modelcontextprotocol/client@^2.0.0 \
|
||||||
"@modelcontextprotocol/ext-apps": "^0.0.1"
|
@modelcontextprotocol/server@^2.0.0 \
|
||||||
}
|
@modelcontextprotocol/node@^2.0.0 \
|
||||||
}
|
@modelcontextprotocol/express@^2.0.0 \
|
||||||
|
zod@^4.2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The wire protocol is unchanged between `ext-apps` 1.x and 2.x: a 2.x View works
|
||||||
|
in a 1.x host and a 2.x host renders 1.x Views. See the
|
||||||
|
[migration guide](https://apps.extensions.modelcontextprotocol.io/api/documents/migrate-to-v2.html)
|
||||||
|
when upgrading from 1.x.
|
||||||
|
|
||||||
|
**New here?** Start with the
|
||||||
|
[Quickstart Guide](https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html)
|
||||||
|
to build your first MCP App.
|
||||||
|
|
||||||
|
## Using the SDK
|
||||||
|
|
||||||
|
The SDK serves three roles: app developers building interactive Views, host
|
||||||
|
developers embedding those Views, and MCP server authors registering tools with
|
||||||
|
UI metadata.
|
||||||
|
|
||||||
|
| Package | Purpose | Docs |
|
||||||
|
| ------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `@modelcontextprotocol/ext-apps` | Build interactive Views (App class, PostMessageTransport) | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/app.html) |
|
||||||
|
| `@modelcontextprotocol/ext-apps/react` | React hooks for Views (useApp, useHostStyles, etc.) | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/_modelcontextprotocol_ext-apps_react.html) |
|
||||||
|
| `@modelcontextprotocol/ext-apps/app-bridge` | Embed and communicate with Views in your chat client | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/app-bridge.html) |
|
||||||
|
| `@modelcontextprotocol/ext-apps/server` | Register tools and resources on your MCP server | [API Docs →](https://apps.extensions.modelcontextprotocol.io/api/modules/server-helpers.html) |
|
||||||
|
|
||||||
|
There's no _supported_ host implementation in this repo (beyond the
|
||||||
|
[examples/basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host)
|
||||||
|
example).
|
||||||
|
|
||||||
|
The [MCP-UI](https://github.com/idosal/mcp-ui) client SDK offers a
|
||||||
|
fully-featured MCP Apps framework used by a few hosts. Clients may choose to use
|
||||||
|
it or roll their own implementation.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Start with these foundational examples to learn the SDK:
|
The
|
||||||
|
[`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples)
|
||||||
|
directory contains demo apps showcasing real-world use cases.
|
||||||
|
|
||||||
- [`examples/basic-server-vanillajs`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) — MCP server + MCP App using vanilla JS
|
<!-- prettier-ignore-start -->
|
||||||
- [`examples/basic-server-react`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) — MCP server + MCP App using [React](https://github.com/facebook/react)
|
| | | |
|
||||||
- [`examples/basic-server-vue`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vue) — MCP server + MCP App using [Vue](https://github.com/vuejs/vue)
|
|:---:|:---:|:---:|
|
||||||
- [`examples/basic-server-svelte`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-svelte) — MCP server + MCP App using [Svelte](https://github.com/sveltejs/svelte)
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
|
||||||
- [`examples/basic-server-preact`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-preact) — MCP server + MCP App using [Preact](https://github.com/preactjs/preact)
|
| [**Map**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [**Three.js**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [**ShaderToy**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
|
||||||
- [`examples/basic-server-solid`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-solid) — MCP server + MCP App using [Solid](https://github.com/solidjs/solid)
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
|
||||||
- [`examples/basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) — MCP host application supporting MCP Apps
|
| [**Sheet Music**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [**Wiki Explorer**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [**Cohort Heatmap**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
|
||||||
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
|
||||||
|
| [**Scenario Modeler**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [**Budget Allocator**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [**Customer Segmentation**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
|
||||||
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
|
||||||
|
| [**System Monitor**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [**Transcript**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [**Video Resource**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
|
||||||
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
|
||||||
|
| [**PDF Server**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [**QR Code (Python)**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [**Say Demo**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
|
||||||
|
|
||||||
The [`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples) directory contains additional demo apps showcasing real-world use cases.
|
### Starter Templates
|
||||||
|
|
||||||
To run all examples together:
|
| | |
|
||||||
|
|:---:|:---|
|
||||||
|
| [](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) | The same app built with different frameworks — pick your favorite!<br><br>[React](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) · [Vue](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vue) · [Svelte](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-svelte) · [Preact](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-preact) · [Solid](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-solid) · [Vanilla JS](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) |
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
### Running the Examples
|
||||||
|
|
||||||
|
#### With basic-host
|
||||||
|
|
||||||
|
To run all examples locally using
|
||||||
|
[basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host)
|
||||||
|
(the reference host implementation included in this repo):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
git clone https://github.com/modelcontextprotocol/ext-apps.git
|
||||||
|
cd ext-apps
|
||||||
npm install
|
npm install
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
Then open http://localhost:8080/.
|
Then open http://localhost:8080/.
|
||||||
|
|
||||||
|
#### With MCP Clients
|
||||||
|
|
||||||
|
Every Node.js example is published as `@modelcontextprotocol/server-<name>`. To
|
||||||
|
add one to an MCP client that supports stdio (Claude Desktop, VS Code, etc.),
|
||||||
|
use this pattern:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"<name>": {
|
||||||
|
"command": "npx",
|
||||||
|
"args": ["-y", "@modelcontextprotocol/server-<name>", "--stdio"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, to add the map server: `@modelcontextprotocol/server-map`. The
|
||||||
|
Python examples (`qr-server`, `say-server`) use `uv run` instead — see their
|
||||||
|
READMEs for details.
|
||||||
|
|
||||||
|
#### Local Development
|
||||||
|
|
||||||
|
To test local modifications with an MCP client, clone the repo, install, then
|
||||||
|
point your client at a local build:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"<name>": {
|
||||||
|
"command": "bash",
|
||||||
|
"args": [
|
||||||
|
"-c",
|
||||||
|
"cd ~/code/ext-apps/examples/<name>-server && npm run build >&2 && node dist/index.js --stdio"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Specification
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
| Version | Status | Link |
|
||||||
|
| -------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| **2026-01-26** | Stable | [specification/2026-01-26/apps.mdx](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx) |
|
||||||
|
| **draft** | Development | [specification/draft/apps.mdx](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx) |
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [Quickstart Guide](https://modelcontextprotocol.github.io/ext-apps/api/documents/Quickstart.html)
|
- [Quickstart Guide](https://apps.extensions.modelcontextprotocol.io/api/documents/quickstart.html)
|
||||||
- [API Documentation](https://modelcontextprotocol.github.io/ext-apps/api/)
|
- [API Documentation](https://apps.extensions.modelcontextprotocol.io/api/)
|
||||||
- [Draft Specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx)
|
- [Specification (2026-01-26)](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx)
|
||||||
|
([Draft](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx))
|
||||||
- [SEP-1865 Discussion](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)
|
- [SEP-1865 Discussion](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for
|
||||||
|
guidelines on how to get started, submit pull requests, and report issues.
|
||||||
|
|
|
||||||
21
SECURITY.md
Normal file
21
SECURITY.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Security Policy
|
||||||
|
|
||||||
|
Thank you for helping keep the Model Context Protocol and its ecosystem secure.
|
||||||
|
|
||||||
|
## Reporting Security Issues
|
||||||
|
|
||||||
|
If you discover a security vulnerability in this repository, please report it through
|
||||||
|
the [GitHub Security Advisory process](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability)
|
||||||
|
for this repository.
|
||||||
|
|
||||||
|
Please **do not** report security vulnerabilities through public GitHub issues, discussions,
|
||||||
|
or pull requests.
|
||||||
|
|
||||||
|
## What to Include
|
||||||
|
|
||||||
|
To help us triage and respond quickly, please include:
|
||||||
|
|
||||||
|
- A description of the vulnerability
|
||||||
|
- Steps to reproduce the issue
|
||||||
|
- The potential impact
|
||||||
|
- Any suggested fixes (optional)
|
||||||
29
build.bun.ts
29
build.bun.ts
|
|
@ -1,9 +1,18 @@
|
||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
import { $ } from "bun";
|
import { $ } from "bun";
|
||||||
|
import { cpSync, mkdirSync, rmSync } from "node:fs";
|
||||||
|
|
||||||
|
// Avoid publishing artifacts left behind by an earlier build or branch.
|
||||||
|
rmSync("dist", { recursive: true, force: true });
|
||||||
|
|
||||||
// Run TypeScript compiler for type declarations
|
// Run TypeScript compiler for type declarations
|
||||||
await $`tsc`;
|
await $`tsc`;
|
||||||
|
|
||||||
|
// Copy schema.json (tsc is emitDeclarationOnly, Bun.build doesn't emit JSON assets).
|
||||||
|
// Needed for the "./schema.json" package export.
|
||||||
|
mkdirSync("dist/src/generated", { recursive: true });
|
||||||
|
cpSync("src/generated/schema.json", "dist/src/generated/schema.json");
|
||||||
|
|
||||||
const isDevelopment = Bun.env.NODE_ENV === "development";
|
const isDevelopment = Bun.env.NODE_ENV === "development";
|
||||||
|
|
||||||
// Build all JavaScript/TypeScript files
|
// Build all JavaScript/TypeScript files
|
||||||
|
|
@ -25,10 +34,20 @@ function buildJs(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peer dependencies stay external in the standard entry points so consumers
|
||||||
|
// share one base MCP SDK and Zod instance. The *-with-deps entry points keep
|
||||||
|
// bundling these dependencies for standalone browser use.
|
||||||
|
const PEER_EXTERNALS = [
|
||||||
|
"@modelcontextprotocol/client",
|
||||||
|
"@modelcontextprotocol/core",
|
||||||
|
"@modelcontextprotocol/server",
|
||||||
|
"zod",
|
||||||
|
];
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
buildJs("src/app.ts", {
|
buildJs("src/app.ts", {
|
||||||
outdir: "dist/src",
|
outdir: "dist/src",
|
||||||
external: ["@modelcontextprotocol/sdk"],
|
external: PEER_EXTERNALS,
|
||||||
}),
|
}),
|
||||||
buildJs("src/app.ts", {
|
buildJs("src/app.ts", {
|
||||||
outdir: "dist/src",
|
outdir: "dist/src",
|
||||||
|
|
@ -36,19 +55,19 @@ await Promise.all([
|
||||||
}),
|
}),
|
||||||
buildJs("src/app-bridge.ts", {
|
buildJs("src/app-bridge.ts", {
|
||||||
outdir: "dist/src",
|
outdir: "dist/src",
|
||||||
external: ["@modelcontextprotocol/sdk"],
|
external: PEER_EXTERNALS,
|
||||||
}),
|
}),
|
||||||
buildJs("src/react/index.tsx", {
|
buildJs("src/react/index.tsx", {
|
||||||
outdir: "dist/src/react",
|
outdir: "dist/src/react",
|
||||||
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
|
external: ["react", "react-dom", ...PEER_EXTERNALS],
|
||||||
}),
|
}),
|
||||||
buildJs("src/react/index.tsx", {
|
buildJs("src/react/index.tsx", {
|
||||||
outdir: "dist/src/react",
|
outdir: "dist/src/react",
|
||||||
external: ["react", "react-dom", "@modelcontextprotocol/sdk"],
|
external: ["react", "react-dom"],
|
||||||
naming: { entry: "react-with-deps.js" },
|
naming: { entry: "react-with-deps.js" },
|
||||||
}),
|
}),
|
||||||
buildJs("src/server/index.ts", {
|
buildJs("src/server/index.ts", {
|
||||||
outdir: "dist/src/server",
|
outdir: "dist/src/server",
|
||||||
external: ["@modelcontextprotocol/sdk"],
|
external: PEER_EXTERNALS,
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
73
docs/agent-skills.md
Normal file
73
docs/agent-skills.md
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
---
|
||||||
|
title: Agent Skills
|
||||||
|
group: Getting Started
|
||||||
|
description: Use Agent Skills to build, migrate, and extend MCP Apps with AI coding agents. Install skills that scaffold new apps, convert OpenAI Apps, and add UI to existing servers.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Agent Skills
|
||||||
|
|
||||||
|
[Agent Skills](https://agentskills.io/) are instruction sets that guide AI coding agents through tasks. When you invoke a skill, the agent takes the lead — it asks clarifying questions, makes decisions based on your codebase, and executes the work.
|
||||||
|
|
||||||
|
This repository provides four skills:
|
||||||
|
|
||||||
|
- [**create-mcp-app**](https://github.com/modelcontextprotocol/ext-apps/blob/main/plugins/mcp-apps/skills/create-mcp-app/SKILL.md) — scaffolds a new MCP App with an interactive UI
|
||||||
|
- [**migrate-oai-app**](https://github.com/modelcontextprotocol/ext-apps/blob/main/plugins/mcp-apps/skills/migrate-oai-app/SKILL.md) — migrates an existing OpenAI App to the MCP Apps SDK
|
||||||
|
- [**add-app-to-server**](https://github.com/modelcontextprotocol/ext-apps/blob/main/plugins/mcp-apps/skills/add-app-to-server/SKILL.md) — adds interactive UI to an existing MCP server's tools
|
||||||
|
- [**convert-web-app**](https://github.com/modelcontextprotocol/ext-apps/blob/main/plugins/mcp-apps/skills/convert-web-app/SKILL.md) — converts an existing web application into an MCP App
|
||||||
|
|
||||||
|
## Install the Skills
|
||||||
|
|
||||||
|
Choose one of the following installation methods based on your agent:
|
||||||
|
|
||||||
|
### Option 1: Claude Code Plugin
|
||||||
|
|
||||||
|
Install via Claude Code:
|
||||||
|
|
||||||
|
```
|
||||||
|
/plugin marketplace add modelcontextprotocol/ext-apps
|
||||||
|
/plugin install mcp-apps@modelcontextprotocol-ext-apps
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 2: Vercel Skills CLI
|
||||||
|
|
||||||
|
Use the [Vercel Skills CLI](https://skills.sh/) to install skills across different AI coding agents:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npx skills add modelcontextprotocol/ext-apps
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 3: Manual Installation
|
||||||
|
|
||||||
|
Clone the repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/modelcontextprotocol/ext-apps.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Then copy the skills from `plugins/mcp-apps/skills/` to your agent's skills directory. See your agent's documentation for the correct location:
|
||||||
|
|
||||||
|
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code/skills)
|
||||||
|
- [VS Code](https://code.visualstudio.com/docs/copilot/customization/agent-skills) / [GitHub Copilot](https://docs.github.com/en/copilot/concepts/agents/about-agent-skills)
|
||||||
|
- [Codex](https://developers.openai.com/codex/skills/)
|
||||||
|
- [Gemini CLI](https://geminicli.com/docs/cli/skills/)
|
||||||
|
- [Cline](https://docs.cline.bot/features/skills#skills)
|
||||||
|
- [Goose](https://block.github.io/goose/docs/guides/context-engineering/using-skills/)
|
||||||
|
|
||||||
|
## Verify Installation
|
||||||
|
|
||||||
|
Ask your agent "What skills do you have?" — you should see `create-mcp-app`, `migrate-oai-app`, `add-app-to-server`, and `convert-web-app` among the available skills.
|
||||||
|
|
||||||
|
## Invoke a Skill
|
||||||
|
|
||||||
|
Try invoking the skills by asking your agent:
|
||||||
|
|
||||||
|
- "Create an MCP App" — scaffolds a new MCP App with an interactive UI
|
||||||
|
- "Migrate from OpenAI Apps SDK" — converts an existing OpenAI App to use the MCP Apps SDK
|
||||||
|
- "Add UI to my MCP server" — adds interactive UI to an existing MCP server's tools
|
||||||
|
- "Convert my web app to an MCP App" — converts an existing web application into an MCP App
|
||||||
|
|
||||||
|
The agent will guide you through the process, asking clarifying questions as needed.
|
||||||
|
|
||||||
|
## Test Your App
|
||||||
|
|
||||||
|
After creating or migrating your MCP App, see the [Testing MCP Apps](./testing-mcp-apps.md) guide to run and debug it locally.
|
||||||
211
docs/authorization.md
Normal file
211
docs/authorization.md
Normal file
|
|
@ -0,0 +1,211 @@
|
||||||
|
---
|
||||||
|
title: Authorization
|
||||||
|
group: Security
|
||||||
|
description: Learn how to protect MCP App tools with OAuth authorization, including per-server and per-tool auth patterns, token verification, and UI-initiated auth escalation.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Authorization
|
||||||
|
|
||||||
|
MCP Apps can protect tools behind OAuth-based authorization, as defined in the [MCP specification](https://modelcontextprotocol.io/specification/latest/basic/authorization). There are two approaches:
|
||||||
|
|
||||||
|
- **Per-server authorization** — The entire MCP server requires authorization at connection time. Every request must include a valid token, regardless of which tool is being called. This is the simpler model when all tools are sensitive.
|
||||||
|
- **Per-tool authorization** — Only specific tools require authorization. Public tools work without a token, and the OAuth flow is triggered only when the user calls a protected tool. This lets you mix public and protected tools in the same server.
|
||||||
|
|
||||||
|
## Shared setup
|
||||||
|
|
||||||
|
Regardless of which approach you choose, you need OAuth discovery metadata and token verification. These are the same for both.
|
||||||
|
|
||||||
|
### OAuth discovery metadata
|
||||||
|
|
||||||
|
The MCP specification requires servers to implement [authorization server discovery](https://modelcontextprotocol.io/specification/latest/basic/authorization#authorization-server-discovery) so clients know how to obtain authorization. Two well-known endpoints are needed:
|
||||||
|
|
||||||
|
**[Protected Resource Metadata](https://datatracker.ietf.org/doc/html/rfc9728)** (`/.well-known/oauth-protected-resource`) — describes the resource server and identifies which authorization server(s) can issue tokens for it. The MCP SDK's `mcpAuthRouter` handles this automatically.
|
||||||
|
|
||||||
|
**Authorization Server Metadata** (`/.well-known/oauth-authorization-server`) — advertises the authorization and token endpoints, supported scopes, and whether [Client ID Metadata Documents](https://modelcontextprotocol.io/specification/latest/basic/authorization#client-id-metadata-documents) (CIMD) is supported:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
app.get("/.well-known/oauth-authorization-server", (_req, res) => {
|
||||||
|
res.json({
|
||||||
|
...oauthMetadata,
|
||||||
|
client_id_metadata_document_supported: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Setting `client_id_metadata_document_supported: true` tells MCP clients to use CIMD instead of [Dynamic Client Registration](https://modelcontextprotocol.io/specification/latest/basic/authorization#dynamic-client-registration) (DCR). With CIMD, the `client_id` is a URL that serves the client's metadata document, removing the need for a registration endpoint. See [Client Registration Approaches](https://modelcontextprotocol.io/specification/latest/basic/authorization#client-registration-approaches) in the spec for the full list of options and priority order.
|
||||||
|
|
||||||
|
### Token verification
|
||||||
|
|
||||||
|
Verify access tokens as JWTs against the identity provider's JWKS endpoint. The `jose` library handles key fetching and caching:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { createRemoteJWKSet, jwtVerify } from "jose";
|
||||||
|
|
||||||
|
const JWKS = createRemoteJWKSet(new URL(`${IDP_DOMAIN}/.well-known/jwks.json`));
|
||||||
|
|
||||||
|
const { payload } = await jwtVerify(token, JWKS, {
|
||||||
|
issuer: IDP_DOMAIN,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
MCP servers must validate that tokens were issued specifically for them — see [Token Handling](https://modelcontextprotocol.io/specification/latest/basic/authorization#token-handling) and [Access Token Privilege Restriction](https://modelcontextprotocol.io/specification/latest/basic/authorization#access-token-privilege-restriction) in the spec for the full requirements.
|
||||||
|
|
||||||
|
## Per-server authorization
|
||||||
|
|
||||||
|
With per-server authorization, every request to the `/mcp` endpoint must include a valid Bearer token. Any unauthorized request receives HTTP `401`, and the host must complete the OAuth flow before the client can use any tools. This is the right choice when all tools are sensitive and there's no value in allowing unauthorized access.
|
||||||
|
|
||||||
|
The TypeScript MCP SDK supports this out of the box via `mcpAuthRouter` and `ProxyOAuthServerProvider` — no custom HTTP handler logic is needed. See the [MCP SDK documentation](https://github.com/modelcontextprotocol/typescript-sdk) for setup details.
|
||||||
|
|
||||||
|
## Per-tool authorization
|
||||||
|
|
||||||
|
With per-tool authorization, the `/mcp` endpoint handler inspects the raw JSON-RPC request body, checks whether any message targets a protected tool, and only enforces authorization for those calls. Public tools pass through without a token.
|
||||||
|
|
||||||
|
### How it works
|
||||||
|
|
||||||
|
1. The server maintains a set of tool names that require authorization
|
||||||
|
2. When a JSON-RPC request arrives at the `/mcp` endpoint, the server inspects the request body to determine if any message is a `tools/call` targeting a protected tool
|
||||||
|
3. If a protected tool is being called and no valid Bearer token is present, the server returns HTTP `401` with a [`WWW-Authenticate` header](https://modelcontextprotocol.io/specification/latest/basic/authorization#protected-resource-metadata-discovery-requirements) pointing to its [Protected Resource Metadata](https://datatracker.ietf.org/doc/html/rfc9728)
|
||||||
|
4. The MCP host (e.g., Claude Desktop) sees the `401`, discovers the authorization server via the metadata URL, runs the [OAuth flow](https://modelcontextprotocol.io/specification/latest/basic/authorization#authorization-flow-steps) with the user, and retries the request with the acquired token
|
||||||
|
5. On retry, the server verifies the token, extracts the user identity, and creates a per-request MCP server instance with that auth context
|
||||||
|
6. Unprotected tools pass through without any token check — they work for everyone
|
||||||
|
|
||||||
|
This design means authorization is enforced at the HTTP boundary (as [required by the spec](https://modelcontextprotocol.io/specification/latest/basic/authorization#access-token-usage)), not as a tool-level error. The MCP server itself never sees unauthorized requests for protected tools.
|
||||||
|
|
||||||
|
### Enforcing HTTP 401
|
||||||
|
|
||||||
|
The [MCP auth specification](https://modelcontextprotocol.io/specification/latest/basic/authorization#access-token-usage) requires protected resources to return HTTP `401` responses — not tool-level errors.
|
||||||
|
|
||||||
|
Start by defining which tools require authorization. Then, in the `/mcp` endpoint handler, inspect the raw JSON-RPC request body, check whether any message targets a protected tool, and either verify the Bearer token or return `401` before the request ever reaches the MCP server:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
/** Tools that require a valid Bearer token — checked at the HTTP level for proper 401. */
|
||||||
|
const PROTECTED_TOOLS = new Set(["get_account_balance", "manage_branch_admin"]);
|
||||||
|
|
||||||
|
app.all("/mcp", async (req, res) => {
|
||||||
|
// Parse the JSON-RPC body — it may be a single message or a batch
|
||||||
|
const messages = Array.isArray(req.body) ? req.body : [req.body];
|
||||||
|
|
||||||
|
// Check if any message is a tools/call for a protected tool
|
||||||
|
const needsAuth = messages.some(
|
||||||
|
(msg: any) =>
|
||||||
|
msg?.method === "tools/call" && PROTECTED_TOOLS.has(msg.params?.name),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Extract and verify the Bearer token
|
||||||
|
let authInfo: AuthInfo | undefined;
|
||||||
|
const authHeader = req.headers.authorization;
|
||||||
|
|
||||||
|
if (authHeader?.startsWith("Bearer ")) {
|
||||||
|
try {
|
||||||
|
const token = authHeader.slice(7);
|
||||||
|
const { payload } = await jwtVerify(token, JWKS, {
|
||||||
|
issuer: IDP_DOMAIN,
|
||||||
|
});
|
||||||
|
authInfo = { token, sub: payload.sub as string };
|
||||||
|
} catch {
|
||||||
|
if (needsAuth) {
|
||||||
|
return res
|
||||||
|
.status(401)
|
||||||
|
.set(
|
||||||
|
"WWW-Authenticate",
|
||||||
|
`Bearer resource_metadata="${resourceMetadataUrl}"`,
|
||||||
|
)
|
||||||
|
.json({
|
||||||
|
error: "invalid_token",
|
||||||
|
error_description: "The access token is invalid",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (needsAuth) {
|
||||||
|
return res
|
||||||
|
.status(401)
|
||||||
|
.set(
|
||||||
|
"WWW-Authenticate",
|
||||||
|
`Bearer resource_metadata="${resourceMetadataUrl}"`,
|
||||||
|
)
|
||||||
|
.json({
|
||||||
|
error: "invalid_token",
|
||||||
|
error_description: "Authorization required",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a per-request MCP server with the auth context.
|
||||||
|
// authInfo is undefined for public tool calls, populated for
|
||||||
|
// authenticated requests — tool handlers use it to scope data
|
||||||
|
// to the authenticated user.
|
||||||
|
const server = createServer(authInfo);
|
||||||
|
// ... handle the request with transport
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
The `WWW-Authenticate` header includes the [Protected Resource Metadata](https://modelcontextprotocol.io/specification/latest/basic/authorization#authorization-server-location) URL, which tells the client where to discover the authorization server.
|
||||||
|
|
||||||
|
### Defence-in-depth in tool handlers
|
||||||
|
|
||||||
|
Even though the HTTP layer enforces authorization, protected tool handlers should also verify `authInfo` as a defence-in-depth measure. If the HTTP layer is misconfigured or bypassed, the tool handler catches unauthorized access:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
registerAppTool(
|
||||||
|
server,
|
||||||
|
"get_account_balance",
|
||||||
|
{
|
||||||
|
description: "Get account balance",
|
||||||
|
inputSchema: z.object({ accountId: z.string() }),
|
||||||
|
},
|
||||||
|
async ({ accountId }) => {
|
||||||
|
if (!authInfo) {
|
||||||
|
return {
|
||||||
|
isError: true,
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
type: "text",
|
||||||
|
text: "Authorization required to access account data.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const balance = await getBalance(authInfo.sub, accountId);
|
||||||
|
return {
|
||||||
|
content: [{ type: "text", text: `Balance: ${balance}` }],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
### UI-initiated auth escalation
|
||||||
|
|
||||||
|
A powerful pattern is mixing public and protected tools in the same app. The app loads with public data (no authorization required), and the OAuth flow is triggered only when the user performs a protected action. This is a practical application of the [step-up authorization flow](https://modelcontextprotocol.io/specification/latest/basic/authorization#step-up-authorization-flow) described in the spec:
|
||||||
|
|
||||||
|
1. A public tool (e.g., `manage_branch`) loads the UI without requiring authorization
|
||||||
|
2. The user clicks a button that calls a protected tool via `app.callServerTool()`
|
||||||
|
3. The MCP host receives HTTP `401` and automatically runs the OAuth flow
|
||||||
|
4. After the user completes the OAuth flow, the host retries the tool call with the acquired token
|
||||||
|
5. The protected data appears in the UI
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
function BranchItem({ branch }: { branch: Branch }) {
|
||||||
|
const [adminData, setAdminData] = useState(null);
|
||||||
|
|
||||||
|
async function handleManage() {
|
||||||
|
// This call may trigger the OAuth flow if the user
|
||||||
|
// hasn't been authorized yet — the host handles it
|
||||||
|
// transparently.
|
||||||
|
const result = await app.callServerTool({
|
||||||
|
name: "manage_branch_admin",
|
||||||
|
arguments: { branch_id: branch.id },
|
||||||
|
});
|
||||||
|
setAdminData(result.structuredContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<span>{branch.name}</span>
|
||||||
|
<button onClick={handleManage}>Manage</button>
|
||||||
|
{adminData && <AdminPanel data={adminData} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This pattern keeps the initial experience fast (no login wall) while securing sensitive operations behind authorization. The host manages the entire OAuth flow — the app code simply calls the tool and handles the result.
|
||||||
64
docs/csp-cors.md
Normal file
64
docs/csp-cors.md
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
---
|
||||||
|
title: CSP and CORS
|
||||||
|
group: Security
|
||||||
|
description: Configure Content Security Policy and CORS for MCP Apps that make network requests from sandboxed iframes, including connectDomains, resourceDomains, and stable origin setup.
|
||||||
|
---
|
||||||
|
|
||||||
|
# CSP & CORS
|
||||||
|
|
||||||
|
Unlike regular web apps, MCP Apps HTML is served as an MCP resource and runs in a sandboxed iframe with no same-origin server. Any app that makes network requests must configure Content Security Policy (CSP) and possibly CORS.
|
||||||
|
|
||||||
|
**CSP** controls what the _browser_ allows. You must declare _all_ origins in {@link types!McpUiResourceMeta.csp `_meta.ui.csp`} ({@link types!McpUiResourceCsp `McpUiResourceCsp`}) — including `localhost` during development. Declare `connectDomains` for fetch/XHR/WebSocket requests and `resourceDomains` for scripts, stylesheets, images, and fonts.
|
||||||
|
|
||||||
|
**CORS** controls what the _API server_ allows. Public APIs that respond with `Access-Control-Allow-Origin: *` or use API key authentication work without CORS configuration. For APIs that allowlist specific origins, use {@link types!McpUiResourceMeta.domain `_meta.ui.domain`} to give the app a stable origin that the API server can allowlist. The format is host-specific, so check each host's documentation for its supported format.
|
||||||
|
|
||||||
|
<!-- prettier-ignore -->
|
||||||
|
```ts source="../src/server/index.examples.ts#registerAppResource_withDomain"
|
||||||
|
// Computes a stable origin from an MCP server URL for hosting in Claude.
|
||||||
|
function computeAppDomainForClaude(mcpServerUrl: string): string {
|
||||||
|
const hash = crypto
|
||||||
|
.createHash("sha256")
|
||||||
|
.update(mcpServerUrl)
|
||||||
|
.digest("hex")
|
||||||
|
.slice(0, 32);
|
||||||
|
return `${hash}.claudemcpcontent.com`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const APP_DOMAIN = computeAppDomainForClaude("https://example.com/mcp");
|
||||||
|
|
||||||
|
registerAppResource(
|
||||||
|
server,
|
||||||
|
"Company Dashboard",
|
||||||
|
"ui://dashboard/view.html",
|
||||||
|
{
|
||||||
|
description: "Internal dashboard with company data",
|
||||||
|
},
|
||||||
|
async () => ({
|
||||||
|
contents: [
|
||||||
|
{
|
||||||
|
uri: "ui://dashboard/view.html",
|
||||||
|
mimeType: RESOURCE_MIME_TYPE,
|
||||||
|
text: dashboardHtml,
|
||||||
|
_meta: {
|
||||||
|
ui: {
|
||||||
|
// CSP: tell browser the app is allowed to make requests
|
||||||
|
csp: {
|
||||||
|
connectDomains: ["https://api.example.com"],
|
||||||
|
},
|
||||||
|
// CORS: give app a stable origin for the API server to allowlist
|
||||||
|
//
|
||||||
|
// (Public APIs that use `Access-Control-Allow-Origin: *` or API
|
||||||
|
// key auth don't need this.)
|
||||||
|
domain: APP_DOMAIN,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that `_meta.ui.csp` and `_meta.ui.domain` are set in the `contents[]` objects returned by the resource read callback, not in `registerAppResource()`'s config object.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> For full examples that configures CSP, see: [`examples/sheet-music-server/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) (`connectDomains`) and [`examples/map-server/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) (`connectDomains` and `resourceDomains`).
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue