Skip to content

feat(mcp): the app server and its card for a chat app, and a check in h5p-author that reads no file (#270) - #271

Merged
alekswebnet merged 3 commits into
mainfrom
feat/mcp-app
Nov 24, 2026
Merged

alekswebnet merged 3 commits into
mainfrom
feat/mcp-app

Conversation

@alekswebnet

@alekswebnet alekswebnet commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #270. Part of #210.

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-standard fetch(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_play checks a source and answers as h5p_build does: 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 of server.mjs so 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's unread. 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 of unread.
  • pnpm test in packages/mcp: 30 pass. pnpm test:unit in packages/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


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-standard fetch(request) handler, served by the command on a port at /mcp.
  • Two tools: h5p_types (the local server's, without its lines on folders) and h5p_play, which checks a source and answers as h5p_build does — 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's unread where it does, and base, within and fetch are not used. Without check, unread throws.

Release h5p-author first (a minor, for unread), then h5p-mcp. Hosting, the privacy policy and the listing are #210.

Written for commit ed795ce. Summary will update on new commits.

View guided diff Turn on auto-fix

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 15 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/author/lib/media.mjs">

<violation number="1" location="packages/author/lib/media.mjs:199">
P3: The MediaAccess doc says each file under `unread` is judged by its name alone, but web addresses are left as written and never listed in `unread`. Reword the doc to say only path-named files are judged and listed, or list web addresses too.</violation>
</file>

<file name="packages/mcp/README.md">

<violation number="1" location="packages/mcp/README.md:84">
P3: `h5p_types` calls do not carry an activity source or run the source check; restrict this privacy description to `h5p_play` calls.</violation>
</file>

<file name="design/mcp.md">

<violation number="1" location="design/mcp.md:131">
P3: This says ChatGPT integration was hand-checked, but this PR leaves ChatGPT and other chat apps unverified; mark ChatGPT as unverified or limit the claim to the stand-in page.</violation>
</file>

<file name="packages/mcp/lib/card.html">

<violation number="1" location="packages/mcp/lib/card.html:149">
P2: The card handles only one attachment even when the checked source has multiple unread files, despite telling the user it will ask for the others. Accept and map all attachment references, or explicitly reject multi-file sources instead of building with missing or misnamed files.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/mcp/lib/app.mjs Resolved
Comment thread packages/mcp/lib/card.html Resolved
Comment thread packages/mcp/tests/app.test.ts Resolved
Comment thread packages/mcp/lib/card.html Resolved
Comment thread packages/author/lib/media.mjs Resolved
Comment thread packages/mcp/README.md Resolved
Comment thread design/mcp.md Resolved
@alekswebnet alekswebnet self-assigned this Nov 24, 2026
…ress, the card says when a file did not come and guesses no name, and the test counts connections (#270)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread packages/author/lib/media.mjs Resolved
Comment thread packages/mcp/lib/app.mjs Resolved
… and the note on unread says when a file is listed (#270)
@alekswebnet
alekswebnet merged commit cfe50d5 into main Nov 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: the app server and its card for a chat app, in place of the probe (#210)

1 participant