feat(mcp): the app server and its card for a chat app, and a check in h5p-author that reads no file (#270)
The probe on the owner's machine played an activity in a ChatGPT reply and saved its .h5p from there. This is the same server and card as a part of the toolkit: a second command of @missing-elements/h5p-mcp, with its tests.
What is in it
h5p-mcp-app, an MCP server over HTTP (lib/app.mjs,bin/h5p-mcp-app.mjs).createApp()is a web-standardfetch(request)handler; the command serves it on a port. The endpoint is/mcp.- Two tools.
h5p_types, the local server's, without its lines on folders.h5p_playchecks a source and answers ash5p_builddoes: the problems by their paths, or the type, the notes and what the activity holds. - The card (
lib/card.html): the probe's last one without its test report and without its reports to the server. It frames the play page of the org site and gives it what only the chat has: the attached file's address and size, a save for a package up to 8 MB, an open tab for a link of the site's. lib/answers.mjs: what both servers say alike, moved out ofserver.mjsso neither holds a copy. The local server's answers are unchanged, and its tests pass as they were.- In
h5p-author: a check that reads no file,buildPackage(source, undefined, { check: true, unread: true }). No file is looked for, none downloaded and no site asked; a file named by a path is judged by its name and listed in the result'sunread. The probe told a missing file's problem from another by its wording, and so gave no outline for an activity with a video; now it has one.
What the server holds of a request
Nothing, by the owner's rule that no server of ours processes a person's file:
- It never asks the address of an attached file. The chat sends a reference; the server hands it back to the card in the result's
_meta, which the model does not see, and only the person's browser asks the chat's store. - It stores nothing and logs nothing: all the command ever writes is the line saying where it listens.
- A body over 1 MB is refused.
- It does receive each tool call, with the activity's source in it. The README says so.
For the chat
- The file input's schema is ChatGPT's reference's, to the letter, and comes from the tool's own schema: the probe rewrote the server's answer to put it there.
- A file's name written where the attachment goes is answered ("no attachment came with the call"), not refused unread.
- The instructions say to pass an attachment as it is and not to open it. A reply that began with the chat's own analysis of the file drew no card, twice; without it the card came. One cause is not proven.
- The card's address carries the card's hash, since a chat keeps a card by its address.
Tests
packages/mcp/tests/app.test.ts, new: the command on a free port, asked over HTTP with the SDK's client. The two tools and their words (under 6,000 characters), the file input's schema, the card and its policy, a source checked and one refused, an attachment handed to the card alone with a file store that counts requests never asked, a call whose file is no reference, a body over 1 MB, and that nothing was written.packages/author/tests/confine.test.ts: four tests ofunread.pnpm testinpackages/mcp: 30 pass.pnpm test:unitinpackages/author: 291 pass. Both type checks pass.
Checked by hand
The card as this server serves it, in a page that stands in for a chat: ChatGPT's values on the window, the MCP Apps handshake, a host that saves what it is handed, and the card's frame sandboxed so that it saves no file and opens no tab, as ChatGPT's was found to. The play page was the org site's build, served locally.
| Case | Result |
|---|---|
| A quiz (light at 720 px, dark at 360 px) | plays; Download saves through the chat, 882 kB; "Open in the build page" goes through the chat; no scroller in the card |
| The chat refuses the save | the page's row with the way to save it |
| An Interactive Video with an attached video | plays from the chat's address; Download fetches it, builds and saves through the chat, 6.3 MB |
| The same, the package over the chat's limit (light and dark) | one press hands the chat the link of the saving tab; nothing fetched in the card |
| No activity arrives | "No activity arrived" after six seconds, the loader gone |
Screenshots of the loader and of the played card looked at, light and dark.
Not verified
- Not in ChatGPT yet: the probe's card ran there, this one is its code without the test parts, and the instructions' new line on attachments is untried.
- No model wrote a source against this server here; the tools' words are the local server's and the probe's.
- Other chat apps: Claude was found to drop a card's framed site (claude-code#59351).
- The card is not under the repository's tests; the page that stands in for a chat is not in the repository.
To decide after this
- Releases:
h5p-authorfirst (a minor, forunread), thenh5p-mcp. - Where the server is hosted, the privacy policy and the listing: #210.
Summary by cubic
Closes #270 and part of #210. Adds a second command to @missing-elements/h5p-mcp — h5p-mcp-app, an MCP server over HTTP for a chat app that shows a card in its reply, ChatGPT first — and a check in h5p-author that reads no file.
The app server and its card
createApp()is a web-standardfetch(request)handler, served by the command on a port at/mcp.- Two tools:
h5p_types(the local server's, without its lines on folders) andh5p_play, which checks a source and answers ash5p_builddoes — the problems by their paths, or the type, notes and outline. - The card (
lib/card.html) frames the play page of the org site and gives it what only the chat has: the attached file's address and size, a save for packages up to 8 MB, and an open tab for a link of the site's. - No server of ours processes a person's file: the chat sends the attachment's reference, the server keeps only its id, name and type — never its address — and hands them to the card in the result's
_meta, which the model does not see; only the person's browser asks the chat's store. An attachment is handed to the card only when the source names a file; one it does not name is not used. It stores and logs nothing of a request; a body over 1 MB is refused. - The answers both servers share moved to
lib/answers.mjs; the local server's answers and tests are unchanged. - New tests start the command on a free port and ask it over HTTP with the SDK's client, holding it to the tools, the card and to writing nothing; a file store counts every connection, and no answer carries the file's address.
The unread check in h5p-author
buildPackage(source, undefined, { check: true, unread: true })checks a source whose files are elsewhere, as an attachment in a chat is: no file is looked for, none downloaded and no site asked; a file named by a path is judged by its name — a problem where its field takes no such type — and listed in the result'sunreadwhere it does, andbase,withinandfetchare not used. Withoutcheck,unreadthrows.
Release h5p-author first (a minor, for unread), then h5p-mcp. Hosting, the privacy policy and the listing are #210.