From 441b75c7fc89eac3085f914982cfa7b743247968 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Tue, 17 Nov 2026 16:24:13 +0200 Subject: [PATCH 1/8] feat(mcp): a local MCP server that builds, checks and previews packages (#226) @missing-elements/h5p-mcp, H5P Author MCP by Missing Elements: three tools over stdio for an app with no shell. h5p_types lists the pack's content types and answers a type with its file from the author package, or its fields; h5p_build builds a source into the person's folder with its .source.json, never over a file, refuses a source with problems by path, and answers with the outline, the verifier's summary and its screenshot; h5p_preview opens the verifier's preview. Every answer about a type names the folders the server may use, since a model cannot know them. It holds no rules of its own: author exports inside(), and the verifier previewPackage() and openBrowser(), for it. The folders are --allow, else the app's roots, else Desktop, Documents and Downloads. The MCP SDK and zod are bundled with esbuild, so npx installs none of the SDK's HTTP dependencies. --- .gitignore | 1 + AGENTS.md | 3 +- README.md | 1 + SECURITY.md | 2 + design/layout.md | 4 +- design/mcp.md | 51 +++ docs/compatibility.md | 3 +- packages/author/README.md | 4 +- packages/author/lib/author.mjs | 2 +- packages/author/tests/package-types.ts | 5 +- packages/mcp/README.md | 63 +++ packages/mcp/bin/h5p-mcp.mjs | 59 +++ packages/mcp/lib/folders.mjs | 48 ++ packages/mcp/lib/server.mjs | 223 +++++++++ packages/mcp/package.json | 59 +++ packages/mcp/scripts/build.mjs | 50 +++ packages/mcp/tests/folders.test.ts | 38 ++ packages/mcp/tests/server.test.ts | 138 ++++++ packages/mcp/tsconfig.json | 17 + packages/mcp/vitest.config.ts | 12 + packages/verify/README.md | 4 + packages/verify/lib/preview.mjs | 2 - packages/verify/lib/verify.mjs | 1 + packages/verify/tests/package-types.ts | 10 +- pnpm-lock.yaml | 597 +++++++++++++++++++++++++ 25 files changed, 1387 insertions(+), 10 deletions(-) create mode 100644 design/mcp.md create mode 100644 packages/mcp/README.md create mode 100644 packages/mcp/bin/h5p-mcp.mjs create mode 100644 packages/mcp/lib/folders.mjs create mode 100644 packages/mcp/lib/server.mjs create mode 100644 packages/mcp/package.json create mode 100644 packages/mcp/scripts/build.mjs create mode 100644 packages/mcp/tests/folders.test.ts create mode 100644 packages/mcp/tests/server.test.ts create mode 100644 packages/mcp/tsconfig.json create mode 100644 packages/mcp/vitest.config.ts diff --git a/.gitignore b/.gitignore index ae5d3238..ce53c7d9 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ packages/player/LICENSE packages/normalize/LICENSE packages/verify/LICENSE packages/author/LICENSE +packages/mcp/LICENSE # The h5p-author skill's text and build routes, which the author's `prepack` copies beside its type files (#178, #204). packages/author/SKILL.md packages/author/references/authoring.md diff --git a/AGENTS.md b/AGENTS.md index 27c6e3ae..dca5f5ff 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,7 +40,7 @@ by assumption, and asks a page for what only a page can do through the frame: ## Where things are, and whose rules -A pnpm workspace of nine packages and two apps. [`design/layout.md`](design/layout.md) maps the +A pnpm workspace of ten packages and two apps. [`design/layout.md`](design/layout.md) maps the folders; in `design/`, `src/…` and `scripts/…` mean the player's unless a file says otherwise. | Part | What it is | Rules | @@ -51,6 +51,7 @@ folders; in `design/`, `src/…` and `scripts/…` mean the player's unless a fi | `packages/normalize/` | rewrites a package so it streams | [normalize](design/normalize.md) | | `packages/verify/` | plays a package headless and reports | [verify](design/verify.md) | | `packages/author/`, `skills/h5p-author/` | a playable package of any content type from a short source | [author](design/author.md) | +| `packages/mcp/` | the local MCP server: builds, checks and previews in an app with no shell | [mcp](design/mcp.md) | | `packages/cmi5/` | the element as a cmi5 assignable unit | [cmi5](design/cmi5.md) | | `packages/embed/`, `skills/h5p-to-scorm/` | the embed site for a player domain, and a package as a SCORM zip | [embed](design/embed.md), [scorm](design/scorm.md) | | `packages/vscode/` | H5P Preview, the VS Code extension | [vscode](design/vscode.md) | diff --git a/README.md b/README.md index db10d0ef..582b1c4e 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ esbuild, and the one-prompt install on Lovable; | [`@missing-elements/h5p-verify`](https://github.com/missing-elements/h5p-offline-player/tree/main/packages/verify#readme) | Plays a package headless and reports whether it works, or opens it in your browser | | [`@missing-elements/h5p-normalize`](https://github.com/missing-elements/h5p-offline-player/tree/main/packages/normalize#readme) | Rewrites a package so its video streams | | [`@missing-elements/h5p-author`](https://github.com/missing-elements/h5p-offline-player/tree/main/packages/author#readme) | Builds a package of any content type from a short JSON source | +| [`@missing-elements/h5p-mcp`](https://github.com/missing-elements/h5p-offline-player/tree/main/packages/mcp#readme) | A local MCP server: an app such as Claude Desktop builds a package onto your disk, checks it and opens it in your browser | | [`@missing-elements/h5p-cmi5`](https://github.com/missing-elements/h5p-offline-player/tree/main/packages/cmi5#readme) | Makes a page holding the element a cmi5 assignable unit | | [H5P Preview](https://marketplace.visualstudio.com/items?itemName=MissingElements.h5p-preview) | Plays `.h5p` files in VS Code, and from [Open VSX](https://open-vsx.org/extension/MissingElements/h5p-preview) in Cursor and VSCodium | diff --git a/SECURITY.md b/SECURITY.md index 92b047be..ef4db3f1 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -14,6 +14,8 @@ versions of the packages in this repository: | `@missing-elements/h5p-embed` | Latest release and `main` | | `@missing-elements/h5p-runtime` | Latest release and `main` | | `@missing-elements/h5p-libraries` | Latest release and `main` | +| `@missing-elements/h5p-author` | Latest release and `main` | +| `@missing-elements/h5p-mcp` | Latest release and `main` | | Demo and installable app | Deployment from `main` | Older releases may receive a fix when practical, but users should upgrade to a diff --git a/design/layout.md b/design/layout.md index 627b758c..3e6aa301 100644 --- a/design/layout.md +++ b/design/layout.md @@ -1,6 +1,6 @@ # Layout -A pnpm workspace of nine packages and two apps. Eight packages are published to npm; the VS Code +A pnpm workspace of ten packages and two apps. Nine packages are published to npm; the VS Code extension is a `.vsix`. Paths in `design/` are relative to their part: `src/…` and `scripts/…` mean the player's unless a file says otherwise. `dist/`, `types/`, the player's `public/` and the runtime's `index.js` are generated and not in git. @@ -30,6 +30,8 @@ packages/verify/ a package played headless (lib/verify.mjs) and in a brows packages/author/ a playable .h5p from a short source: lib/build.mjs both builds, node.mjs Node's, generator.mjs content from semantics, check.mjs, outline.mjs, types.mjs the editor widgets' rules; scripts/ the skill's sync and copy +packages/mcp/ the local MCP server: lib/server.mjs its three tools, lib/folders.mjs the + folders it may use; scripts/build.mjs bundles the MCP SDK into dist/ packages/cmi5/ the element as a cmi5 AU: src/index.ts startCmi5, src/client.ts the protocol packages/embed/ site/ the embed page and the SCORM page; lib/build.mjs the site, lib/scorm*.mjs the SCORM zip in Node and in a page; scorm/ its launch page diff --git a/design/mcp.md b/design/mcp.md new file mode 100644 index 00000000..a2f91f41 --- /dev/null +++ b/design/mcp.md @@ -0,0 +1,51 @@ +# The MCP server + +`packages/mcp` is `@missing-elements/h5p-mcp`, shown as **H5P Author MCP by Missing Elements**: a +local MCP server over standard input and output that builds a package onto the person's disk, +checks it, and opens it in their browser. It is for apps with no shell, Claude Desktop first; in an +app with a shell, the skill and `npx` build already. A remote server, for ChatGPT or Claude on the +web, is #210 and not this. + +- **It holds no rules of its own.** The build, its checks, the outline and the confinement to + folders (`buildPackage`, `within`, `publicFetch`, `inside`) are h5p-author's; the check, the + preview and opening the browser (`verifyPackage`, `summarize`, `previewPackage`, `openBrowser`) + are h5p-verify's. A rule a tool needs goes into those packages first, exported, so the author + package and the verifier are published before a server that uses something new of theirs. +- **Three tools, and the skill's flow as the instructions.** `h5p_types` lists the pack's content + types, those with a type file marked, and the skill's brief; given a type, read as a build reads + one (`sourceType`, so "true false" works), it answers with the type's file, or with `schemaOf` for + a type with none. `h5p_build` builds a source and `h5p_preview` opens a package. The instructions + are the flow in a few lines: the type is the one question, its answer is read before the source is + written, then the build, where the file is and what the check found, and the preview offered. + Not `SKILL.md`, whose build routes do not apply here. An app sends the descriptions and the + instructions with every message, so they stay under about 1,500 tokens; `server.test.ts` holds + them under 6,000 characters. +- **The folders: `--allow`, else the app's roots, else Desktop, Documents and Downloads.** A folder + the person named when adding the server is their choice and comes first; the app's roots come + next, asked on every call, since they change; never the home folder whole. A build reads local + files and writes its package only there (`within`) and fetches from the public internet only + (`publicFetch`); the preview opens only a package there (`inside`). +- **A build never writes over a file.** With no `output`, the package is named from its title + (`fileStem`: the title's letters and digits, in any script), with the next number where the name + is taken; a taken `output` gets the next number too, as the build itself refuses to write over a + file. The answer names the path written. Beside the package goes its source, `.source.json`, + which the build page opens to change and build again. +- **A build answers with the content, the check and a picture.** The build's line, its notes, the + outline (80 lines at most) and, with `verify`, the default, the verifier's summary of a check run + in a temporary folder, with its screenshot as an image. Where no Chromium-based browser is found, + the answer says "Not verified" and why. A source with problems is refused, every problem by its + path, and nothing is written. +- **The SDK is bundled.** `scripts/build.mjs` bundles the command with `@modelcontextprotocol/sdk` + and zod into `dist/h5p-mcp.mjs` with esbuild, the author package and the verifier left as + dependencies. `npx` then installs neither Express nor Hono nor the SDK's other HTTP dependencies, + which a server over standard input never loads. `dist/NOTICE.txt` lists what is bundled, with the + licences. Standard output is the protocol's, so the command sends `console.log` to standard error, + and loads the server only after `--help` and `--version` have had their turn. +- **Tested as an app runs it.** `tests/server.test.ts` starts the bundle over standard input and + output with the SDK's own client, given one folder, and calls each tool: the list, a type by a + loose name and one with no file, a build checked in Chromium, a taken name, a source with a + problem, an output outside the folder, a preview served and one refused. The test script first + copies the skill's type files into the author package, as the author's `prepack` does. + +Not built yet: reading a package back to a source (step 3 of #219), checking a video's bytes +(#218), the MCP registry's `server.json` and Claude Desktop's one-click bundle. diff --git a/docs/compatibility.md b/docs/compatibility.md index 19587004..d6530824 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -129,7 +129,8 @@ long as the player streams the result at least as well. The command's options, its exit codes — 0 plays, 1 does not, 2 could not run; with `--preview`, 0 when the preview ends and 2 when it could not start — `report.json`, to -which fields may be added, and `verifyPackage()` and `summarize()`, with their types: `VerifyReport` +which fields may be added, and `verifyPackage()`, `summarize()`, `previewPackage()` and +`openBrowser()`, with their types: `VerifyReport` is `report.json`'s shape, and gains fields the same way. The verifier is a step in other people's pipelines, so a check that turns a pass into a fail comes in a minor, never a patch; a new warning can come in any release. diff --git a/packages/author/README.md b/packages/author/README.md index 99a9f9ea..285f63c0 100644 --- a/packages/author/README.md +++ b/packages/author/README.md @@ -194,7 +194,9 @@ plain lines for a review, made when it is first read: what the author wrote, the marked, slides, chapters and questions numbered, a scenario's links and a video's times written, interface texts and settings left out. `outlineOf(libraries, content, { limit })` makes one from what `loadLibraries` loaded for a content and the content, `{ type, params }`, as `checkContent` -takes them, cut at `limit` lines where one is given. +takes them, cut at `limit` lines where one is given. `inside(path, folders)` is the confinement +`within` applies, for a tool beside the build that reads files of its own: whether a path, links +followed, is in one of the folders. ```js import { readFile } from 'node:fs/promises' diff --git a/packages/author/lib/author.mjs b/packages/author/lib/author.mjs index ee5c3385..98bc5d2a 100644 --- a/packages/author/lib/author.mjs +++ b/packages/author/lib/author.mjs @@ -16,7 +16,7 @@ import { schemaLines, schemaMarkdown } from './schema.mjs' import { LAYOUTS } from './types.mjs' export * from './core.mjs' -export { buildPackage, openPack, publicFetch, writeBundle, writeBundles } from './node.mjs' +export { buildPackage, inside, openPack, publicFetch, writeBundle, writeBundles } from './node.mjs' /** * @typedef {import('./node.mjs').BuildResult} BuildResult diff --git a/packages/author/tests/package-types.ts b/packages/author/tests/package-types.ts index cd58e342..92da51f1 100644 --- a/packages/author/tests/package-types.ts +++ b/packages/author/tests/package-types.ts @@ -1,7 +1,7 @@ // The package as a caller sees it, by its own name: through the `types` condition, so this checks the // published declarations, not the source. `pnpm typecheck` writes them first. import { - allowedTags, buildPackage, bundleLibraries, checkContent, ContentGenerator, contentTypes, GENERATED_START, loadLibraries, markupText, openPack, packageLibraries, plainText, schemaOf, SourceError, + allowedTags, buildPackage, bundleLibraries, checkContent, ContentGenerator, contentTypes, GENERATED_START, inside, loadLibraries, markupText, openPack, packageLibraries, plainText, schemaOf, SourceError, writeBundle, writeBundles, type BuildResult, type BundleResult, type CheckedContent, type LibraryRecord, type LibrarySource, type PackageFiles, type Source, type TranslationReport } from '@missing-elements/h5p-author' @@ -23,6 +23,9 @@ export async function check(): Promise<[BuildResult, string, string]> { const generator = new ContentGenerator(new Map(), { lenient: true, id: (count) => String(count) }) generator.problems.length = 0 void readSource + // A tool that confines what it reads to folders asks as a confined build does. + const confined: boolean = await inside('lesson/picture.png', ['lesson']) + void confined return [built, await schemaOf('H5P.Blanks', { markdown: true }), GENERATED_START] } diff --git a/packages/mcp/README.md b/packages/mcp/README.md new file mode 100644 index 00000000..1d10beb0 --- /dev/null +++ b/packages/mcp/README.md @@ -0,0 +1,63 @@ +# H5P Author MCP by Missing Elements + +`@missing-elements/h5p-mcp` lets an AI app make H5P content on your computer: quizzes, fill in the +blanks, flash cards, presentations, interactive books, branching scenarios and the rest of the 55 +content types the H5P hub serves. It writes a playable `.h5p` that carries its libraries, checks +that it plays in a real H5P player, and opens it in your browser. No H5P site, server or account. + +It is a local [MCP](https://modelcontextprotocol.io) server: your app starts it on your computer, +and it sends nothing to a server of ours. It needs Node 22 or newer, and for the check Chrome, Edge +or another Chromium-based browser. + +## Add it to your app + +**Claude Desktop**: Settings, Developer, Edit Config, then in `claude_desktop_config.json`: + +```json +{ + "mcpServers": { + "h5p": { "command": "npx", "args": ["-y", "@missing-elements/h5p-mcp"] } + } +} +``` + +**Claude Code**: `claude mcp add h5p -- npx -y @missing-elements/h5p-mcp` + +**VS Code**: in `.vscode/mcp.json`: + +```json +{ "servers": { "h5p": { "command": "npx", "args": ["-y", "@missing-elements/h5p-mcp"] } } } +``` + +Then ask, for example: "Make a five-question quiz about the water cycle as an H5P file." + +## The folders it uses + +It reads the files your content names, and writes packages, only in its folders: those you give +with `--allow`, as in `"args": ["-y", "@missing-elements/h5p-mcp", "--allow", "/Users/me/Lessons"]` +(repeat it for more); else the folders your app gives it; else your Desktop, Documents and +Downloads. Never your home folder whole. It never writes over a file: a name that is taken gets a +number, and it says which. + +## Tools + +- `h5p_types`: the content types, and how to write a source for one. +- `h5p_build`: a package from a source, its source beside it as `.source.json`. A source with + problems is refused, each problem named. It checks the package and says what it holds. +- `h5p_preview`: opens a package in your browser, in the real player, served from your computer + until its tab is closed. + +## What leaves your computer + +The build downloads a picture or video your content names by web address, from the public internet +only. The check and the preview play the package from your computer; content that embeds a YouTube +video or shows math loads those from the web, as H5P does anywhere. Your app sends your +conversation to its model, as it does without this server. + +## Licence + +MIT. The H5P libraries a package carries are under their own licences, listed in it. +`dist/NOTICE.txt` lists the packages bundled into the server. + +H5P is a trademark of H5P Group. This server is made by Missing Elements and is not affiliated with +or endorsed by H5P Group. diff --git a/packages/mcp/bin/h5p-mcp.mjs b/packages/mcp/bin/h5p-mcp.mjs new file mode 100644 index 00000000..d66d37b9 --- /dev/null +++ b/packages/mcp/bin/h5p-mcp.mjs @@ -0,0 +1,59 @@ +#!/usr/bin/env node +import { readFile } from 'node:fs/promises' +import { parseArgs } from 'node:util' +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' + +// Standard output is the protocol's: anything a library prints there would break a message. +console.log = console.error +console.info = console.error + +const HELP = `Usage: h5p-mcp [--allow ]... [--no-open] + +H5P Author MCP by Missing Elements: an MCP server over standard input and output that builds +.h5p packages, checks that they play, and opens them in the browser. An app such as Claude +Desktop starts it; it does nothing on its own. + +Options: + --allow a folder builds may read files from and write packages to; repeat it for + more. Without it: the folders the app gives, else Desktop, Documents and + Downloads + --no-open answer a preview with its address instead of opening the browser + --version + -h, --help +` + +let values +try { + ;({ values } = parseArgs({ + options: { + allow: { type: 'string', multiple: true }, + 'no-open': { type: 'boolean' }, + version: { type: 'boolean' }, + help: { type: 'boolean', short: 'h' } + } + })) +} catch (error) { + console.error(`h5p-mcp: ${error instanceof Error ? error.message : error}\n\n${HELP}`) + process.exit(2) +} +if (values.help) { + process.stdout.write(HELP) + process.exit(0) +} +if (values.version) { + const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')) + process.stdout.write(`@missing-elements/h5p-mcp ${version}\n`) + process.exit(0) +} + +// Loaded only now, so that --help and --version answer without loading the build and the pack. +const { createServer } = await import('../lib/server.mjs') +const { server, close } = await createServer({ allow: values.allow, open: !values['no-open'] }) +// The app ends the server by closing its input; a preview still open would keep it alive. +const stop = () => { + close() + process.exit(0) +} +process.stdin.on('end', stop) +process.stdin.on('close', stop) +await server.connect(new StdioServerTransport()) diff --git a/packages/mcp/lib/folders.mjs b/packages/mcp/lib/folders.mjs new file mode 100644 index 00000000..173f2037 --- /dev/null +++ b/packages/mcp/lib/folders.mjs @@ -0,0 +1,48 @@ +import { stat } from 'node:fs/promises' +import { homedir } from 'node:os' +import { join } from 'node:path' +import { fileURLToPath } from 'node:url' + +/** + * Where a build may read and write when neither the person nor the app named a folder: Desktop, + * Documents and Downloads, those that exist. Never the home folder whole, which holds keys and + * settings no build has a reason to read. + * @param {string} [home] + * @returns {Promise} + */ +export async function defaultFolders(home = homedir()) { + /** @type {string[]} */ + const found = [] + for (const name of ['Desktop', 'Documents', 'Downloads']) { + const path = join(home, name) + if ((await stat(path).catch(() => null))?.isDirectory()) found.push(path) + } + return found +} + +/** + * The folders among an app's roots: those it names by a `file:` address. A root of another scheme + * is no folder on this computer. + * @param {{ uri: string }[]} roots + * @returns {string[]} + */ +export function rootFolders(roots) { + return roots.filter((root) => root.uri.startsWith('file:')).map((root) => fileURLToPath(root.uri)) +} + +/** + * A file name for a package from its title: its letters and digits, in any script and as written, + * joined by `-`, at most 60 characters; `h5p-content` for a title with none of them. + * @param {unknown} title + * @returns {string} + */ +export function fileStem(title) { + const stem = String(title ?? '') + .normalize('NFC') + .toLowerCase() + .replace(/[^\p{L}\p{M}\p{N}]+/gu, '-') + .replace(/^-+|-+$/g, '') + .slice(0, 60) + .replace(/-+$/, '') + return stem || 'h5p-content' +} diff --git a/packages/mcp/lib/server.mjs b/packages/mcp/lib/server.mjs new file mode 100644 index 00000000..d4b1dd07 --- /dev/null +++ b/packages/mcp/lib/server.mjs @@ -0,0 +1,223 @@ +import { access, mkdtemp, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { basename, dirname, join, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' +import { z } from 'zod' +import { SourceError, buildPackage, contentTypes, inside, openPack, publicFetch, schemaOf, sourceType } from '@missing-elements/h5p-author' +import { VerifyError, openBrowser, previewPackage, summarize, verifyPackage } from '@missing-elements/h5p-verify' +import { defaultFolders, fileStem, rootFolders } from './folders.mjs' + +/** + * @typedef {object} ServerOptions + * @property {string[]} [allow] the folders a build may read and write, given when the server starts; + * they take precedence over the app's roots, which take precedence over Desktop, Documents and + * Downloads + * @property {boolean} [open] open a preview in the person's browser; default true + * @property {string} [libraries] the pack's `parts/` folder to build from; the installed pack by default + */ + +/** The skill's flow, which every app shows the model with the tools. */ +const INSTRUCTIONS = `Builds H5P content as a .h5p file from a short JSON source, checks that it plays, and opens it in the person's browser. +1. The content type is chosen with the person: where their request names none, ask which, and ask nothing else. h5p_types with no type lists them. +2. Call h5p_types with the type and write the source from its notes, example and fields: only what differs from the defaults. +3. Call h5p_build. Where it lists problems, fix each at its path and build again. +4. Tell the person where the file is and what the check found, and offer h5p_preview. +The author and the licence are what the person gave; otherwise the name you know them by, or "Unknown", and the licence "U". Say which you used.` + +const TYPES = `The H5P content types and how to write a source for one. With no type: the list, and how to write good content. With a type: its notes, a tested example and its fields. Read the type's answer before writing its source.` + +const BUILD = `Builds a .h5p package from a source, { type, title, language, license, authors, params }, params holding only what differs from the type's defaults. A file is { "path": ... }, in a folder this server may use or at a web address. Writes the package and its source (.source.json) to output, or under a new name in the first folder it may use. A source with problems is refused, each problem named by its path. With verify (the default), plays the package in a headless browser and reports whether it works.` + +const PREVIEW = `Opens a .h5p package in the person's browser in the real player, served from this computer until its tab is closed. Answers with the address.` + +const LIST_HEAD = `The content types the library pack has, by the name a source's "type" takes. Those marked * have notes and a tested example; for the rest h5p_types gives their fields.` + +/** @param {string} text */ +const answer = (text) => ({ content: [{ type: /** @type {const} */ ('text'), text }] }) +/** @param {string} text */ +const refusal = (text) => ({ content: [{ type: /** @type {const} */ ('text'), text }], isError: true }) + +/** @param {number} bytes */ +const sized = (bytes) => (bytes < 1e6 ? `${Math.max(1, Math.round(bytes / 1e3))} kB` : `${(bytes / 1e6).toFixed(1)} MB`) + +/** + * Where the person's files are, for the model: it cannot know, and a path it guesses is refused. + * @param {string[]} folders + */ +const whereFiles = (folders) => folders.length + ? `This server reads files and writes packages only in ${folders.join(', ')}. A file's path written alone, as { "path": "picture.png" }, is read from ${folders[0]}.` + : 'This server has no folder to read or write in: start it with --allow .' + +/** Lines of an outline past which an answer says how many more there are. */ +const OUTLINE_LINES = 80 + +/** + * The server and its three tools. It holds no rules of its own: the build, its checks and the + * confinement to folders are h5p-author's, the check and the preview h5p-verify's. + * @param {ServerOptions} [options] + */ +export async function createServer(options = {}) { + const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')) + const server = new McpServer({ name: 'h5p-mcp', title: 'H5P Author MCP by Missing Elements', version }, { instructions: INSTRUCTIONS }) + const author = dirname(fileURLToPath(import.meta.resolve('@missing-elements/h5p-author/package.json'))) + const typeFiles = join(author, 'references', 'types') + /** @type {Set<{ close: () => void }>} */ + const previews = new Set() + + /** The folders a build may read and write, asked of the app on each call, since its roots can change. */ + async function folders() { + if (options.allow?.length) return options.allow.map((folder) => resolve(folder)) + if (server.server.getClientCapabilities()?.roots) { + try { + const found = rootFolders((await server.server.listRoots(undefined, { timeout: 5_000 })).roots) + if (found.length) return found + } catch { + // An app that says it has roots and does not answer gets the default folders. + } + } + return defaultFolders() + } + + /** @type {Promise<{ name: string, title: string }[]> | undefined} */ + let typeList + /** The pack's content types, read once: each needs its part opened. */ + function types() { + typeList ??= (async () => { + const pack = await openPack(options.libraries) + try { + return (await contentTypes(pack)).map((part) => ({ name: part.library.machineName, title: part.library.title })) + } finally { + await pack.close() + } + })() + return typeList + } + + /** The content types the skill has a file for, as the author package carries them. */ + async function filed() { + const names = await readdir(typeFiles).catch(() => []) + return new Set(names.filter((name) => name.endsWith('.md')).map((name) => name.slice(0, -3))) + } + + /** + * A package's path in the folder, with a number added to the name where it is taken: a build + * never writes over a file, so a package built again takes the next number. + * @param {string} folder + * @param {string} stem the file name without `.h5p` + */ + async function freeName(folder, stem) { + for (let n = 1; ; n++) { + const path = join(folder, `${stem}${n === 1 ? '' : `-${n}`}.h5p`) + if (!(await access(path).then(() => true, () => false))) return path + } + } + + server.registerTool('h5p_types', { + title: 'H5P content types', + description: TYPES, + inputSchema: { type: z.string().optional().describe('A content type, as H5P.MultiChoice or "multiple choice"') }, + annotations: { readOnlyHint: true, openWorldHint: false } + }, async ({ type }) => { + const list = await types() + const files = await filed() + // Said with every answer, before a source is written: a model cannot know the folders, and a + // path it guesses is refused. + const where = whereFiles(await folders()) + if (!type) { + const lines = list.map(({ name, title }) => `${files.has(name) ? '*' : '-'} ${name}: ${title}`) + const brief = await readFile(join(author, 'references', 'authoring.md'), 'utf8').catch(() => '') + return answer([LIST_HEAD, ...lines, '', where, ...(brief ? ['', brief] : [])].join('\n')) + } + const name = sourceType({ type }, list.map((each) => each.name)) + if (!name) return refusal(`The library pack has no content type "${type}". h5p_types with no type lists them.`) + const text = files.has(name) ? await readFile(join(typeFiles, `${name}.md`), 'utf8') : await schemaOf(name, { markdown: true, libraries: options.libraries }) + return answer(`${text.trimEnd()}\n\n${where}`) + }) + + server.registerTool('h5p_build', { + title: 'Build an H5P package', + description: BUILD, + inputSchema: { + source: z.record(z.string(), z.unknown()).describe('The source, as h5p_types describes it for its type'), + output: z.string().optional().describe('Leave it out unless the person named a place: a file name, or a path in a folder this server may use'), + verify: z.boolean().optional().describe('Play it and report whether it works; default true') + }, + annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true } + }, async ({ source, output, verify = true }) => { + const allowed = await folders() + if (!allowed.length) return refusal('This server has no folder to write in: start it with --allow , or give it a folder from the app.') + let target = output ? resolve(allowed[0], output) : await freeName(allowed[0], fileStem(source.title)) + if (!/\.h5p$/i.test(target)) target += '.h5p' + // Said here, with the folders, since a model cannot know them: the build's own refusal names none. + if (!(await inside(target, allowed))) return refusal(`${target} is outside the folders this server may write in: ${allowed.join(', ')}. Give a file name alone, or leave output out.`) + // A name that is taken gets a number, as a build never writes over a file. + if (output) target = await freeName(dirname(target), basename(target).replace(/\.h5p$/i, '')) + let result + try { + result = await buildPackage(source, target, { base: dirname(target), within: allowed, fetch: publicFetch, libraries: options.libraries }) + } catch (error) { + if (error instanceof SourceError) return refusal(`${error.message}\nFix each at its path and build again.${/outside the folders/.test(error.message) ? ` ${whereFiles(allowed)}` : ''}`) + return refusal(error instanceof Error ? error.message : String(error)) + } + const sourceFile = target.replace(/\.h5p$/i, '.source.json') + await writeFile(sourceFile, `${JSON.stringify(source, null, 2)}\n`) + const install = result.install.length ? `, ${result.install.length} more for installing on an H5P site` : '' + const media = result.media.length ? `, ${result.media.length} media file${result.media.length === 1 ? '' : 's'}` : '' + const lines = [ + `Built ${target} (${sized((await stat(target)).size)}): ${result.manifest.mainLibrary}, ${result.libraries.length} libraries${install}${media}.`, + `Its source is beside it, ${basename(sourceFile)}: https://missing-elements.github.io/h5p/build/ opens it under "Or open a file", to change and build again.` + ] + for (const { path, message } of result.notes) lines.push(`Note: ${path} ${message}`) + const outline = result.outline.split('\n') + lines.push('', 'What it holds:', ...outline.slice(0, OUTLINE_LINES)) + if (outline.length > OUTLINE_LINES) lines.push(`… and ${outline.length - OUTLINE_LINES} more lines.`) + /** @type {{ type: 'image', data: string, mimeType: string }[]} */ + const images = [] + if (verify) { + const out = await mkdtemp(join(tmpdir(), 'h5p-mcp-')) + try { + const report = await verifyPackage({ file: target, out, libraries: options.libraries }) + // Its screenshot goes with the answer as an image; the path it was written to is gone. + lines.push('', summarize(report).split('\n').filter((line) => !/^\s*screenshot:/.test(line)).join('\n')) + const shot = await readFile(join(out, 'screenshot.png')).catch(() => null) + if (shot) images.push({ type: 'image', data: shot.toString('base64'), mimeType: 'image/png' }) + } catch (error) { + lines.push('', `Not verified: ${error instanceof VerifyError || error instanceof Error ? error.message : String(error)}`) + } finally { + await rm(out, { recursive: true, force: true }) + } + } + return { content: [{ type: /** @type {const} */ ('text'), text: lines.join('\n') }, ...images] } + }) + + server.registerTool('h5p_preview', { + title: 'Preview an H5P package', + description: PREVIEW, + inputSchema: { package: z.string().describe('The .h5p to open, in a folder this server may use') }, + annotations: { readOnlyHint: true, openWorldHint: false } + }, async ({ package: file }) => { + const allowed = await folders() + const path = resolve(allowed[0] ?? '.', file) + if (!allowed.length || !(await inside(path, allowed))) return refusal(`${file} is not in a folder this server may use.`) + let preview + try { + preview = await previewPackage({ file: path, libraries: options.libraries }) + } catch (error) { + return refusal(error instanceof Error ? error.message : String(error)) + } + previews.add(preview) + preview.closed.then(() => previews.delete(preview)) + const address = `${preview.url}/` + const opened = options.open !== false && (await openBrowser(address)) + return answer(`${opened ? `Opened ${basename(path)} in the browser at ${address}.` : `The preview of ${basename(path)} is at ${address}: open it in a browser.`} It is served from this computer until its tab is closed.`) + }) + + return { + server, + /** Ends every preview still open, as the server stops. */ + close() { + for (const preview of previews) preview.close() + } + } +} diff --git a/packages/mcp/package.json b/packages/mcp/package.json new file mode 100644 index 00000000..2bda4cc0 --- /dev/null +++ b/packages/mcp/package.json @@ -0,0 +1,59 @@ +{ + "name": "@missing-elements/h5p-mcp", + "version": "0.1.0", + "description": "H5P Author MCP by Missing Elements: a local MCP server that builds playable H5P packages of any content type from a short source, checks them in a real player and opens them in the person's browser. No H5P server needed.", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/missing-elements/h5p-offline-player.git", + "directory": "packages/mcp" + }, + "homepage": "https://github.com/missing-elements/h5p-offline-player/tree/main/packages/mcp#readme", + "bugs": { + "url": "https://github.com/missing-elements/h5p-offline-player/issues" + }, + "publishConfig": { + "access": "public" + }, + "type": "module", + "bin": { + "h5p-mcp": "./dist/h5p-mcp.mjs" + }, + "exports": { + "./package.json": "./package.json" + }, + "files": [ + "dist" + ], + "keywords": [ + "h5p", + "mcp", + "model-context-protocol", + "authoring", + "elearning", + "quiz", + "ai" + ], + "scripts": { + "build": "node scripts/build.mjs", + "test": "pnpm --filter @missing-elements/h5p-offline-player build && pnpm --filter @missing-elements/h5p-author exec node scripts/copy-skill.mjs && pnpm build && vitest run", + "typecheck": "tsc -p tsconfig.json", + "prepack": "node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\" && pnpm build", + "prepublishOnly": "node -e \"if (!/^pnpm\\//.test(process.env.npm_config_user_agent || '')) { console.error('Publish with pnpm publish: npm would ship the workspace:^ dependency ranges as they are, and the package would not install.'); process.exit(1) }\" && pnpm typecheck && pnpm test" + }, + "dependencies": { + "@missing-elements/h5p-author": "workspace:^", + "@missing-elements/h5p-verify": "workspace:^" + }, + "devDependencies": { + "@modelcontextprotocol/sdk": "^1.32.2", + "@types/node": "^26.6.6", + "esbuild": "^0.28.2", + "typescript": "^7.0.2", + "vitest": "^5.1.0", + "zod": "^4.6.7" + }, + "engines": { + "node": ">=22" + } +} diff --git a/packages/mcp/scripts/build.mjs b/packages/mcp/scripts/build.mjs new file mode 100644 index 00000000..a3084440 --- /dev/null +++ b/packages/mcp/scripts/build.mjs @@ -0,0 +1,50 @@ +// dist/h5p-mcp.mjs: the command with the MCP SDK and zod bundled into it, so that `npx` installs +// the author package and the verifier and not the SDK's HTTP servers (Express, Hono and the rest), +// which a server over standard input never loads. dist/NOTICE.txt holds the licences of what is +// bundled. +import { build } from 'esbuild' +import { mkdir, readFile, rm, writeFile } from 'node:fs/promises' +import { dirname, join, resolve } from 'node:path' +import { existsSync } from 'node:fs' + +const root = resolve(import.meta.dirname, '..') +const dist = join(root, 'dist') +await rm(dist, { recursive: true, force: true }) +await mkdir(dist, { recursive: true }) + +const { metafile } = await build({ + entryPoints: [join(root, 'bin', 'h5p-mcp.mjs')], + outfile: join(dist, 'h5p-mcp.mjs'), + bundle: true, + platform: 'node', + format: 'esm', + target: 'node22', + // The author package and the verifier are dependencies, installed beside it. + external: ['@missing-elements/*'], + // A CommonJS module bundled into an ES module calls `require`, which an ES module lacks. + banner: { js: "import { createRequire as __h5pMcpRequire } from 'node:module';\nconst require = __h5pMcpRequire(import.meta.url);" }, + legalComments: 'none', + metafile: true, + logLevel: 'warning' +}) + +/** @type {Map} */ +const bundled = new Map() +for (const input of Object.keys(metafile.inputs)) { + if (!input.includes('node_modules')) continue + let folder = dirname(resolve(root, input)) + while (!existsSync(join(folder, 'package.json')) || !JSON.parse(await readFile(join(folder, 'package.json'), 'utf8')).name) folder = dirname(folder) + if (bundled.has(folder)) continue + const { name, version, license } = JSON.parse(await readFile(join(folder, 'package.json'), 'utf8')) + const licenceFile = ['LICENSE', 'LICENSE.md', 'LICENSE.txt', 'license'].map((file) => join(folder, file)).find((path) => existsSync(path)) + bundled.set(folder, { name, version, license, text: licenceFile ? (await readFile(licenceFile, 'utf8')).trim() : '' }) +} +const packages = [...bundled.values()].sort((a, b) => a.name.localeCompare(b.name)) +await writeFile(join(dist, 'NOTICE.txt'), [ + 'dist/h5p-mcp.mjs carries these packages, bundled, each under its own licence:', + '', + ...packages.map(({ name, version, license }) => ` ${name} ${version}: ${license}`), + '', + ...packages.flatMap(({ name, version, text }) => [`--- ${name} ${version}`, '', text || '(no licence file in the package)', '']) +].join('\n')) +console.log(`dist/h5p-mcp.mjs, with ${packages.map(({ name }) => name).join(', ')} bundled`) diff --git a/packages/mcp/tests/folders.test.ts b/packages/mcp/tests/folders.test.ts new file mode 100644 index 00000000..a5a7a0c3 --- /dev/null +++ b/packages/mcp/tests/folders.test.ts @@ -0,0 +1,38 @@ +import { mkdir, mkdtemp, rm } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { pathToFileURL } from 'node:url' +import { describe, expect, it } from 'vitest' +import { defaultFolders, fileStem, rootFolders } from '../lib/folders.mjs' + +describe('the folders a build may use', () => { + it('are Desktop, Documents and Downloads where they exist, never the home folder whole', async () => { + const home = await mkdtemp(join(tmpdir(), 'h5p-mcp-home-')) + try { + await mkdir(join(home, 'Desktop')) + await mkdir(join(home, 'Downloads')) + expect(await defaultFolders(home)).toEqual([join(home, 'Desktop'), join(home, 'Downloads')]) + } finally { + await rm(home, { recursive: true, force: true }) + } + }) + + it('are the app\'s roots that are folders on this computer', () => { + const folder = join(tmpdir(), 'lesson') + expect(rootFolders([{ uri: pathToFileURL(folder).href }, { uri: 'https://example.com/repo' }])).toEqual([folder]) + }) +}) + +describe('a package\'s file name', () => { + it('is its title\'s letters and digits, in any script', () => { + expect(fileStem('Water cycle: 3 questions!')).toBe('water-cycle-3-questions') + expect(fileStem('Мій тест')).toBe('мій-тест') + expect(fileStem('Größe & Maß')).toBe('größe-maß') + }) + + it('is cut at 60 characters, and stands in for a title with none', () => { + expect(fileStem('a'.repeat(40) + ' ' + 'b'.repeat(40))).toBe(`${'a'.repeat(40)}-${'b'.repeat(19)}`) + expect(fileStem('?!')).toBe('h5p-content') + expect(fileStem(undefined)).toBe('h5p-content') + }) +}) diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts new file mode 100644 index 00000000..52a2dd1b --- /dev/null +++ b/packages/mcp/tests/server.test.ts @@ -0,0 +1,138 @@ +import { mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises' +import { tmpdir } from 'node:os' +import { join, resolve } from 'node:path' +import { Client } from '@modelcontextprotocol/sdk/client/index.js' +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' +import { afterAll, beforeAll, describe, expect, it } from 'vitest' + +/** + * The server as an app runs it: the bundle the package ships, started over standard input and + * output, given one folder, asked through the SDK's own client. The build's rules are the author + * package's and tested there; these hold the server to calling them, to its folders, and to its + * answers. + */ + +const BUNDLE = resolve(import.meta.dirname, '../dist/h5p-mcp.mjs') +const SOURCE = { + type: 'H5P.TrueFalse', + title: 'Boiling point', + language: 'en', + license: 'U', + authors: [{ name: 'Unknown', role: 'Author' }], + params: { question: '

Water boils at 100 °C at sea level.

', correct: 'true' } +} + +type Content = { type: string, text?: string, data?: string, mimeType?: string } +type Answer = { content: Content[], isError?: boolean } + +let folder: string +let client: Client + +const call = async (name: string, args: Record = {}) => (await client.callTool({ name, arguments: args })) as Answer +const textOf = (answer: Answer) => answer.content.filter((part) => part.type === 'text').map((part) => part.text).join('\n') + +beforeAll(async () => { + folder = await mkdtemp(join(tmpdir(), 'h5p-mcp-')) + client = new Client({ name: 'h5p-mcp-test', version: '0' }) + await client.connect(new StdioClientTransport({ command: process.execPath, args: [BUNDLE, '--allow', folder, '--no-open'], stderr: 'pipe' })) +}) + +afterAll(async () => { + await client?.close() + await rm(folder, { recursive: true, force: true }) +}) + +describe('the server', () => { + it('offers three tools and the flow, in few words', async () => { + const { tools } = await client.listTools() + expect(tools.map((tool) => tool.name).sort()).toEqual(['h5p_build', 'h5p_preview', 'h5p_types']) + expect(client.getInstructions()).toMatch(/h5p_types[\s\S]*h5p_build[\s\S]*h5p_preview/) + // What an app sends the model with every message: under about 1,500 tokens at four characters each. + expect(JSON.stringify(tools).length + (client.getInstructions()?.length ?? 0)).toBeLessThan(6_000) + }) +}) + +describe('h5p_types', () => { + it('lists the pack\'s content types, marking those with a type file, and how to write good content', async () => { + const answer = await call('h5p_types') + const text = textOf(answer) + expect(answer.isError).toBeFalsy() + expect(text).toContain('* H5P.QuestionSet: ') + expect(text).toContain('- H5P.AdvancedBlanks: ') + expect(text).toContain('# The brief, and good content') + }) + + it('answers a type named loosely with its file, and where the person\'s files are', async () => { + const text = textOf(await call('h5p_types', { type: 'true false' })) + expect(text).toContain('(H5P.TrueFalse)') + expect(text).toContain('"correct"') + expect(text).toContain(`This server reads files and writes packages only in ${folder}.`) + }) + + it('answers a type with no file with its fields', async () => { + const answer = await call('h5p_types', { type: 'H5P.AdvancedBlanks' }) + expect(answer.isError).toBeFalsy() + expect(textOf(answer)).toContain('H5P.AdvancedBlanks') + }) + + it('refuses a type the pack has not', async () => { + const answer = await call('h5p_types', { type: 'no such type' }) + expect(answer.isError).toBe(true) + expect(textOf(answer)).toContain('h5p_types with no type lists them') + }) +}) + +describe('h5p_build', () => { + it('writes the package and its source in its folder, checks it, and says what it holds', async () => { + const answer = await call('h5p_build', { source: SOURCE }) + const text = textOf(answer) + expect(answer.isError).toBeFalsy() + expect(text).toContain(`Built ${join(folder, 'boiling-point.h5p')}`) + expect(text).toContain('Water boils at 100 °C at sea level.') + expect(text).toMatch(/^pass {2}boiling-point\.h5p/m) + expect(text).not.toMatch(/screenshot:/) + expect(answer.content.some((part) => part.type === 'image' && part.mimeType === 'image/png')).toBe(true) + expect(JSON.parse(await readFile(join(folder, 'boiling-point.source.json'), 'utf8'))).toEqual(SOURCE) + }) + + it('takes the next number rather than write over a file', async () => { + await writeFile(join(folder, 'mine.h5p'), 'the person\'s own file') + const again = textOf(await call('h5p_build', { source: SOURCE, verify: false })) + expect(again).toContain(`Built ${join(folder, 'boiling-point-2.h5p')}`) + const named = textOf(await call('h5p_build', { source: SOURCE, output: 'mine.h5p', verify: false })) + expect(named).toContain(`Built ${join(folder, 'mine-2.h5p')}`) + expect(await readFile(join(folder, 'mine.h5p'), 'utf8')).toBe('the person\'s own file') + }) + + it('refuses a source with problems, each by its path, and writes nothing', async () => { + const before = await readdir(folder) + const answer = await call('h5p_build', { source: { ...SOURCE, title: 'Broken', params: { ...SOURCE.params, correct: 'maybe' } }, verify: false }) + expect(answer.isError).toBe(true) + expect(textOf(answer)).toMatch(/params\.correct/) + expect(await readdir(folder)).toEqual(before) + }) + + it('writes nowhere but its folders', async () => { + const elsewhere = join(tmpdir(), 'h5p-mcp-elsewhere.h5p') + const answer = await call('h5p_build', { source: SOURCE, output: elsewhere, verify: false }) + expect(answer.isError).toBe(true) + // A model cannot know the folders, so the refusal names them and the way out. + expect(textOf(answer)).toContain(`outside the folders this server may write in: ${folder}. Give a file name alone, or leave output out.`) + }) +}) + +describe('h5p_preview', () => { + it('serves a package in its folders, and answers with the address', async () => { + const answer = await call('h5p_preview', { package: 'boiling-point.h5p' }) + expect(answer.isError).toBeFalsy() + const address = /http:\/\/127\.0\.0\.1:\d+\//.exec(textOf(answer))?.[0] + expect(address).toBeTruthy() + expect((await fetch(address!)).status).toBe(200) + }) + + it('refuses a file outside its folders', async () => { + const answer = await call('h5p_preview', { package: resolve(tmpdir(), 'elsewhere.h5p') }) + expect(answer.isError).toBe(true) + expect(textOf(answer)).toContain('not in a folder this server may use') + }) +}) diff --git a/packages/mcp/tsconfig.json b/packages/mcp/tsconfig.json new file mode 100644 index 00000000..788405fd --- /dev/null +++ b/packages/mcp/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "Bundler", + "lib": ["ES2022"], + "types": ["node"], + "strict": true, + "noEmit": true, + "allowJs": true, + "isolatedModules": true, + "esModuleInterop": true, + "skipLibCheck": true, + "checkJs": true + }, + "include": ["bin/**/*.mjs", "lib/**/*.mjs", "scripts/**/*.mjs", "tests/**/*.ts"] +} diff --git a/packages/mcp/vitest.config.ts b/packages/mcp/vitest.config.ts new file mode 100644 index 00000000..d6b253c8 --- /dev/null +++ b/packages/mcp/vitest.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'vitest/config' + +// The server runs as its user's app runs it: the bundle, started over standard input and output. +// A build with its check plays the package in Chromium, which takes seconds. +export default defineConfig({ + test: { + environment: 'node', + include: ['tests/**/*.test.ts'], + testTimeout: 120_000, + hookTimeout: 120_000 + } +}) diff --git a/packages/verify/README.md b/packages/verify/README.md index ea6b2727..2d343831 100644 --- a/packages/verify/README.md +++ b/packages/verify/README.md @@ -116,6 +116,10 @@ if (report.verdict !== 'pass') process.exit(1) TypeScript declarations ship with the package: `VerifyReport` is `report.json`'s shape. +`previewPackage({ file, libraries, untrusted })` serves the preview as `--preview` does and gives +its `url`, a `closed` promise that settles once its last tab has gone, and `close()`; +`openBrowser(url)` opens an address in the default browser, false where no opener started. + An [agent skill](https://agentskills.io) for it ships in the repository: `npx skills add missing-elements/h5p-offline-player --skill h5p-verify`. diff --git a/packages/verify/lib/preview.mjs b/packages/verify/lib/preview.mjs index a12e3cc1..6b275d91 100644 --- a/packages/verify/lib/preview.mjs +++ b/packages/verify/lib/preview.mjs @@ -55,7 +55,6 @@ const HEARTBEAT_MS = 15_000 * Serves the package and its page until the preview is stopped or stops by itself: `closed` * settles with `closed` once its last tab has gone, `unopened` when no tab came within `openWait`, * and `stopped` after `close()`. - * @internal * @param {PreviewOptions} options * @returns {Promise<{ url: string, closed: Promise<'closed' | 'unopened' | 'stopped'>, close: () => void }>} */ @@ -214,7 +213,6 @@ export function byteRange(header, size) { /** * Opens `url` in the default browser. False when no opener could be started, `xdg-open` missing on * a server for one; the command prints the address either way. - * @internal * @param {string} url * @returns {Promise} */ diff --git a/packages/verify/lib/verify.mjs b/packages/verify/lib/verify.mjs index 4549dd80..fdbc30bc 100644 --- a/packages/verify/lib/verify.mjs +++ b/packages/verify/lib/verify.mjs @@ -6,6 +6,7 @@ import { chromium, errors as playwrightErrors } from 'playwright-core' import { VerifyError, librarySources, packageFile, playerDist, sendFile, serve } from './serve.mjs' export { VerifyError } +export { openBrowser, previewPackage } from './preview.mjs' /** @import { DowngradedLibrary, H5PPlayerElement, PlayerErrorDetail, PlayerState, RefreshedLibrary } from '@missing-elements/h5p-offline-player' */ diff --git a/packages/verify/tests/package-types.ts b/packages/verify/tests/package-types.ts index bd6d4658..7c851874 100644 --- a/packages/verify/tests/package-types.ts +++ b/packages/verify/tests/package-types.ts @@ -3,7 +3,7 @@ * of its `exports`, from the declarations `pnpm types` generates from the JSDoc. Type-checked by * `pnpm typecheck`; nothing here runs. */ -import { VerifyError, summarize, verifyPackage, type VerifyReport } from '@missing-elements/h5p-verify' +import { VerifyError, openBrowser, previewPackage, summarize, verifyPackage, type VerifyReport } from '@missing-elements/h5p-verify' // @ts-expect-error a helper the tests use, not part of the package's API (#60) import { contentChanges } from '@missing-elements/h5p-verify' @@ -17,6 +17,12 @@ export async function asACallerWould(): Promise { // @ts-expect-error an option the verifier does not take await verifyPackage({ file: 'course.h5p', timeout: 1_000 }) - void [passed, missing, changed, refreshed, contentChanges, new VerifyError('could not run') instanceof Error] + // The preview, as a tool beside the verifier opens one: its address, and when it ended. + const preview = await previewPackage({ file: 'course.h5p', untrusted: true }) + const opened: boolean = await openBrowser(`${preview.url}/`) + const ended: 'closed' | 'unopened' | 'stopped' = await preview.closed + preview.close() + + void [passed, missing, changed, refreshed, opened, ended, contentChanges, new VerifyError('could not run') instanceof Error] return summarize(report) } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba21d292..7e020076 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -184,6 +184,34 @@ importers: specifier: ^2.24.0 version: 2.24.0 + packages/mcp: + dependencies: + '@missing-elements/h5p-author': + specifier: workspace:^ + version: link:../author + '@missing-elements/h5p-verify': + specifier: workspace:^ + version: link:../verify + devDependencies: + '@modelcontextprotocol/sdk': + specifier: ^1.32.2 + version: 1.32.2(zod@4.6.7) + '@types/node': + specifier: ^26.6.6 + version: 26.6.6 + esbuild: + specifier: ^0.28.2 + version: 0.28.2 + typescript: + specifier: ^7.0.2 + version: 7.0.2 + vitest: + specifier: ^5.1.0 + version: 5.1.0(@types/node@26.6.6)(@vitest/browser-playwright@5.1.0)(@vitest/ui@5.1.0)(vite@8.3.6(@types/node@26.6.6)(esbuild@0.28.2)) + zod: + specifier: ^4.6.7 + version: 4.6.7 + packages/normalize: dependencies: '@zip.js/zip.js': @@ -528,6 +556,12 @@ packages: cpu: [x64] os: [win32] + '@hono/node-server@2.1.9': + resolution: {integrity: sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==} + engines: {node: '>=20'} + peerDependencies: + hono: ^4 || ^5.0.0-0 + '@inquirer/ansi@1.0.2': resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} engines: {node: '>=18'} @@ -679,6 +713,16 @@ packages: resolution: {integrity: sha512-8/12nvkR9dlOZIrTKJhqFs0NLTZkJlQrA9hNP68mUmJwuVKJ1DicTDhW3S50OqefpYGFts/GhFpURbwllmEhvw==} engines: {node: '>=20'} + '@modelcontextprotocol/sdk@1.32.2': + resolution: {integrity: sha512-SWsVtH/0vULSQStoZ6xxH2K09Li8fXYTMC64ZeogCdpZ3XSi1eCPOByV1OpuJxuI3OcmHhosDWYyii07tpPsLw==} + engines: {node: '>=18'} + peerDependencies: + '@cfworker/json-schema': ^4.1.1 + zod: ^3.25 || ^4.0 + peerDependenciesMeta: + '@cfworker/json-schema': + optional: true + '@napi-rs/keyring-darwin-arm64@1.3.0': resolution: {integrity: sha512-pl76hJvdYUBn6I24bXiOBMA9nbDapo3I5B+f3OorjDU4dUMSypXeKbOVehJe8fhgTiH24flMyTS3aAIy43xegQ==} engines: {node: '>= 10'} @@ -1282,10 +1326,25 @@ packages: resolution: {integrity: sha512-WlaVKzdqBK+RF3bdiXZWbdCnvGB6PdO4IHC1mn/2Yfl3bASgqUNegnU3+PNg61iecwoPfUi5BgLUPqBukXpyWw==} engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=18.0.0'} + accepts@2.0.0: + resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} + engines: {node: '>= 0.6'} + agent-base@7.1.4: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} + ajv-formats@3.0.1: + resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} @@ -1313,6 +1372,10 @@ packages: resolution: {integrity: sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==} engines: {node: '>=4'} + body-parser@2.4.0: + resolution: {integrity: sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==} + engines: {node: '>=18'} + boundary@2.0.0: resolution: {integrity: sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==} @@ -1330,6 +1393,10 @@ packages: resolution: {integrity: sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==} engines: {node: '>=18'} + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + call-bind-apply-helpers@1.0.2: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} @@ -1395,17 +1462,45 @@ packages: resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} engines: {node: '>=20'} + content-disposition@2.0.1: + resolution: {integrity: sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==} + engines: {node: '>=18'} + + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + + content-type@2.1.0: + resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==} + engines: {node: '>=18'} + convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + cookie-signature@1.2.2: + resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} + engines: {node: '>=6.6.0'} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + cors@2.8.6: + resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==} + engines: {node: '>= 0.10'} + cross-keychain@1.1.0: resolution: {integrity: sha512-244DWNdGepLKD5vEn3reZqwzZFiE/LD4U+XV9IaXQbtIXKvQkf0VkRaOj/9vPYauPdR12PSGB3U0cE7jJi3WTQ==} engines: {node: '>=18'} hasBin: true + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + debug@4.4.3: resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} engines: {node: '>=6.0'} @@ -1435,6 +1530,10 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -1457,12 +1556,19 @@ packages: resolution: {integrity: sha512-UgGlf8IW75je7HZjNDpJdCv4cGJWIi6yumFdZ0R7A8/CIhQiWUjyGLCxdHpd8bmyD1gnkfUNK0oeOXqUS2cpfQ==} engines: {ecmascript: '>= es5', node: '>=4'} + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + emoji-regex@10.6.0: resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + encodeurl@2.0.3: + resolution: {integrity: sha512-mIteYONiEfc4xWf2F1WXovh1c8npzS00vNeiUPdwFF+QlVJni+gNvpQltLMQhob8rew/bWWc/bGTuUr0EUGt0w==} + engines: {node: '>= 0.8'} + entities@9.0.0: resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==} engines: {node: '>=20.19.0'} @@ -1487,13 +1593,44 @@ packages: engines: {node: '>=18'} hasBin: true + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + eventsource-parser@3.1.1: + resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==} + engines: {node: '>=18.0.0'} + + eventsource@3.0.7: + resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} + engines: {node: '>=18.0.0'} + expect-type@1.4.0: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} + express-rate-limit@8.7.4: + resolution: {integrity: sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==} + engines: {node: '>= 16'} + peerDependencies: + express: '>= 4.11' + + express@5.3.0: + resolution: {integrity: sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==} + engines: {node: '>= 18'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-uri@3.1.9: + resolution: {integrity: sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -1506,9 +1643,21 @@ packages: fflate@0.8.3: resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==} + finalhandler@2.1.1: + resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} + engines: {node: '>= 18.0.0'} + flatted@3.4.4: resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==} + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -1560,6 +1709,10 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} + hono@4.13.19: + resolution: {integrity: sha512-KmXvQAXwcAHV+muzbIwoJ23niEB5nMoDVr9WcRkU8mvjUECm/1+7v4Jgp7P7a+H6MLFrh+vXrGonGrGS+RQfkA==} + engines: {node: '>=16.9.0'} + hosted-git-info@4.1.0: resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} engines: {node: '>=10'} @@ -1567,6 +1720,10 @@ packages: html-void-elements@3.0.0: resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + http-proxy-agent@7.0.2: resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} @@ -1585,6 +1742,14 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + ip-address@10.7.6: + resolution: {integrity: sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==} + engines: {node: '>= 12'} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + is-ci@2.0.0: resolution: {integrity: sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==} hasBin: true @@ -1615,6 +1780,9 @@ packages: resolution: {integrity: sha512-AX2uU0HW+TxagTgQXOJY7+2fbFHemC7YFBwN1XqD8qQMKdtfbOC8OC3fUb4s5NU59a3662Dzwto8tWDdZYRXxg==} engines: {node: '>=12'} + is-promise@4.0.0: + resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} + is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} @@ -1630,10 +1798,22 @@ packages: isarray@1.0.0: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + istextorbinary@9.5.0: resolution: {integrity: sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==} engines: {node: '>=4'} + jose@6.2.17: + resolution: {integrity: sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json-schema-typed@8.0.2: + resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==} + jsonc-parser@3.3.1: resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} @@ -1771,10 +1951,18 @@ packages: mdast-util-to-hast@13.2.1: resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==} + media-typer@1.1.1: + resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==} + engines: {node: '>= 0.8'} + meow@14.1.0: resolution: {integrity: sha512-EDYo6VlmtnumlcBCbh1gLJ//9jvM/ndXHfVXIFrZVr6fGcwTUyCTFNTLCKuY3ffbK8L/+3Mzqnd58RojiZqHVw==} engines: {node: '>=20'} + merge-descriptors@2.0.0: + resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} + engines: {node: '>=18'} + micromark-util-character@2.1.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -1790,6 +1978,14 @@ packages: micromark-util-types@2.0.3: resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==} + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + + mime-types@3.0.2: + resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} + engines: {node: '>=18'} + mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} engines: {node: '>=4'} @@ -1822,6 +2018,14 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + negotiator@1.1.0: + resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} + engines: {node: '>=18'} + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -1834,6 +2038,13 @@ packages: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} engines: {node: '>=12.20.0'} + on-finished@2.4.2: + resolution: {integrity: sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + onetime@7.0.0: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} @@ -1863,6 +2074,17 @@ packages: parse5@8.1.0: resolution: {integrity: sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==} + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-to-regexp@8.4.2: + resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} + pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} @@ -1876,6 +2098,10 @@ packages: resolution: {integrity: sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==} engines: {node: '>=12'} + pkce-challenge@5.0.1: + resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==} + engines: {node: '>=16.20.0'} + playwright-core@1.65.0: resolution: {integrity: sha512-vNSKgH6YqtN7cdT/L334zo0a+YwkrpicyrHJlWWPIm/Q+Nn2SWInil01oT0mbu96U4GgoRtCYQD9CzJQgju+lA==} engines: {node: '>=20'} @@ -1907,10 +2133,22 @@ packages: property-information@7.2.0: resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==} + proxy-addr@2.0.8: + resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==} + engines: {node: '>= 0.10'} + qs@6.17.1: resolution: {integrity: sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==} engines: {node: '>=0.6'} + range-parser@1.3.0: + resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} + engines: {node: '>= 0.6'} + + raw-body@3.0.2: + resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==} + engines: {node: '>= 0.10'} + read@1.0.7: resolution: {integrity: sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==} engines: {node: '>=0.8'} @@ -1927,6 +2165,10 @@ packages: regex@6.1.0: resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==} + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + restore-cursor@5.1.0: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} @@ -1940,6 +2182,10 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + router@2.3.0: + resolution: {integrity: sha512-bpowRfGjEPe8t9R6fJIzhwmyCGAXwKvxBUsgJm+bJukwdcWmUXbMo7p22w7aYmQBPQTUMNqMV39YX0kMou3z8w==} + engines: {node: '>= 18'} + run-applescript@7.1.0: resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} engines: {node: '>=18'} @@ -1962,9 +2208,28 @@ packages: engines: {node: '>=10'} hasBin: true + send@1.2.1: + resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} + engines: {node: '>= 18'} + + serve-static@2.2.1: + resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} + engines: {node: '>= 18'} + setimmediate@1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + shiki@4.6.0: resolution: {integrity: sha512-imjLsVHgPuWhvpU3P+zOekvMYqnel7QmKsFC4Sn0fCuAvaaalBsxwKEsrU8Ko5BdFnZA6Go/8a0RzahS634UgA==} engines: {node: '>=20'} @@ -2007,6 +2272,10 @@ packages: space-separated-tokens@2.0.2: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + std-env@4.3.0: resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} @@ -2059,6 +2328,10 @@ packages: resolution: {integrity: sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==} engines: {node: '>=14.0.0'} + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + totalist@3.0.1: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} @@ -2073,6 +2346,10 @@ packages: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} + type-is@2.1.0: + resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} + engines: {node: '>= 18'} + typed-rest-client@1.8.11: resolution: {integrity: sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==} @@ -2102,12 +2379,20 @@ packages: unist-util-visit@5.2.0: resolution: {integrity: sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==} + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + url-join@4.0.1: resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==} util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + version-range@4.15.0: resolution: {integrity: sha512-Ck0EJbAGxHwprkzFO966t4/5QkRuzh+/I1RxhLgUKKwEn+Cd8NwM60mE3AqBZg5gYODoXW0EFsQvbZjRlvdqbg==} engines: {node: '>=4'} @@ -2202,6 +2487,11 @@ packages: jsdom: optional: true + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + why-is-node-running@3.2.1: resolution: {integrity: sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==} engines: {node: '>=20.11'} @@ -2211,6 +2501,9 @@ packages: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + ws@8.22.2: resolution: {integrity: sha512-/rEZ2ejown2N5gxVTHUu9bVVC7ttu0/Tgzf5hbTOixR3Fs7mbbXgn2DbdbcKgJOmpQMtrIUWivtYuVMnp/W/yA==} engines: {node: '>=10.0.0'} @@ -2253,6 +2546,14 @@ packages: resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} engines: {node: '>=18'} + zod-to-json-schema@3.25.2: + resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==} + peerDependencies: + zod: ^3.25.28 || ^4 + + zod@4.6.7: + resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -2425,6 +2726,10 @@ snapshots: '@esbuild/win32-x64@0.28.2': optional: true + '@hono/node-server@2.1.9(hono@4.13.19)': + dependencies: + hono: 4.13.19 + '@inquirer/ansi@1.0.2': {} '@inquirer/checkbox@4.3.2(@types/node@26.6.6)': @@ -2566,6 +2871,28 @@ snapshots: '@zip.js/zip.js': 2.24.0 h5p-standalone: 3.8.2 + '@modelcontextprotocol/sdk@1.32.2(zod@4.6.7)': + dependencies: + '@hono/node-server': 2.1.9(hono@4.13.19) + ajv: 8.20.0 + ajv-formats: 3.0.1(ajv@8.20.0) + content-type: 1.0.5 + cors: 2.8.6 + cross-spawn: 7.0.6 + eventsource: 3.0.7 + eventsource-parser: 3.1.1 + express: 5.3.0 + express-rate-limit: 8.7.4(express@5.3.0) + hono: 4.13.19 + jose: 6.2.17 + json-schema-typed: 8.0.2 + pkce-challenge: 5.0.1 + raw-body: 3.0.2 + zod: 4.6.7 + zod-to-json-schema: 3.25.2(zod@4.6.7) + transitivePeerDependencies: + - supports-color + '@napi-rs/keyring-darwin-arm64@1.3.0': optional: true @@ -3028,8 +3355,24 @@ snapshots: '@zip.js/zip.js@2.24.0': {} + accepts@2.0.0: + dependencies: + mime-types: 3.0.2 + negotiator: 1.1.0 + agent-base@7.1.4: {} + ajv-formats@3.0.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.9 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + ansi-regex@5.0.1: {} ansi-regex@6.4.0: {} @@ -3051,6 +3394,20 @@ snapshots: dependencies: editions: 6.22.0 + body-parser@2.4.0: + dependencies: + bytes: 3.1.2 + content-type: 2.1.0 + debug: 4.4.3 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + on-finished: 2.4.2 + qs: 6.17.1 + raw-body: 3.0.2 + type-is: 2.1.0 + transitivePeerDependencies: + - supports-color + boundary@2.0.0: {} brace-expansion@5.0.12: @@ -3065,6 +3422,8 @@ snapshots: dependencies: run-applescript: 7.1.0 + bytes@3.1.2: {} + call-bind-apply-helpers@1.0.2: dependencies: es-errors: 1.3.0 @@ -3111,10 +3470,25 @@ snapshots: commander@14.0.3: {} + content-disposition@2.0.1: {} + + content-type@1.0.5: {} + + content-type@2.1.0: {} + convert-source-map@2.0.0: {} + cookie-signature@1.2.2: {} + + cookie@0.7.2: {} + core-util-is@1.0.3: {} + cors@2.8.6: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + cross-keychain@1.1.0(@types/node@26.6.6): dependencies: '@inquirer/prompts': 7.10.1(@types/node@26.6.6) @@ -3124,6 +3498,12 @@ snapshots: transitivePeerDependencies: - '@types/node' + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + debug@4.4.3: dependencies: ms: 2.1.3 @@ -3149,6 +3529,8 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 + depd@2.0.0: {} + dequal@2.0.3: {} detect-libc@2.1.2: {} @@ -3171,10 +3553,14 @@ snapshots: dependencies: version-range: 4.15.0 + ee-first@1.1.1: {} + emoji-regex@10.6.0: {} emoji-regex@8.0.0: {} + encodeurl@2.0.3: {} + entities@9.0.0: {} es-define-property@1.0.1: {} @@ -3216,20 +3602,90 @@ snapshots: '@esbuild/win32-ia32': 0.28.2 '@esbuild/win32-x64': 0.28.2 + escape-html@1.0.3: {} + estree-walker@3.0.3: dependencies: '@types/estree': 1.0.10 + etag@1.8.1: {} + + eventsource-parser@3.1.1: {} + + eventsource@3.0.7: + dependencies: + eventsource-parser: 3.1.1 + expect-type@1.4.0: {} + express-rate-limit@8.7.4(express@5.3.0): + dependencies: + debug: 4.4.3 + express: 5.3.0 + ip-address: 10.7.6 + transitivePeerDependencies: + - supports-color + + express@5.3.0: + dependencies: + accepts: 2.0.0 + body-parser: 2.4.0 + content-disposition: 2.0.1 + content-type: 2.1.0 + cookie: 0.7.2 + cookie-signature: 1.2.2 + debug: 4.4.3 + depd: 2.0.0 + encodeurl: 2.0.3 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 2.1.1 + fresh: 2.0.0 + http-errors: 2.0.1 + merge-descriptors: 2.0.0 + mime-types: 3.0.2 + on-finished: 2.4.2 + once: 1.4.0 + parseurl: 1.3.3 + proxy-addr: 2.0.8 + qs: 6.17.1 + range-parser: 1.3.0 + router: 2.3.0 + send: 1.2.1 + serve-static: 2.2.1 + statuses: 2.0.2 + type-is: 2.1.0 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + fast-deep-equal@3.1.3: {} + + fast-uri@3.1.9: {} + fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 fflate@0.8.3: {} + finalhandler@2.1.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.3 + escape-html: 1.0.3 + on-finished: 2.4.2 + parseurl: 1.3.3 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + flatted@3.4.4: {} + forwarded@0.2.0: {} + + fresh@2.0.0: {} + fsevents@2.3.3: optional: true @@ -3294,12 +3750,22 @@ snapshots: dependencies: '@types/hast': 3.0.5 + hono@4.13.19: {} + hosted-git-info@4.1.0: dependencies: lru-cache: 6.0.0 html-void-elements@3.0.0: {} + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 + http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.4 @@ -3322,6 +3788,10 @@ snapshots: inherits@2.0.4: {} + ip-address@10.7.6: {} + + ipaddr.js@1.9.1: {} + is-ci@2.0.0: dependencies: ci-info: 2.0.0 @@ -3342,6 +3812,8 @@ snapshots: dependencies: globalthis: 1.0.4 + is-promise@4.0.0: {} + is-unicode-supported@1.3.0: {} is-unicode-supported@2.1.0: {} @@ -3352,12 +3824,20 @@ snapshots: isarray@1.0.0: {} + isexe@2.0.0: {} + istextorbinary@9.5.0: dependencies: binaryextensions: 6.11.0 editions: 6.22.0 textextensions: 6.11.0 + jose@6.2.17: {} + + json-schema-traverse@1.0.0: {} + + json-schema-typed@8.0.2: {} + jsonc-parser@3.3.1: {} jsonwebtoken@9.0.3: @@ -3487,8 +3967,12 @@ snapshots: unist-util-visit: 5.2.0 vfile: 6.0.3 + media-typer@1.1.1: {} + meow@14.1.0: {} + merge-descriptors@2.0.0: {} + micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -3506,6 +3990,12 @@ snapshots: micromark-util-types@2.0.3: {} + mime-db@1.54.0: {} + + mime-types@3.0.2: + dependencies: + mime-db: 1.54.0 + mime@1.6.0: {} mimic-function@5.0.1: {} @@ -3525,12 +4015,26 @@ snapshots: nanoid@3.3.20: {} + negotiator@1.1.0: + dependencies: + content-type: 2.1.0 + + object-assign@4.1.1: {} + object-inspect@1.13.4: {} object-keys@1.1.1: {} obug@3.0.0: {} + on-finished@2.4.2: + dependencies: + ee-first: 1.1.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + onetime@7.0.0: dependencies: mimic-function: 5.0.1 @@ -3583,6 +4087,12 @@ snapshots: dependencies: entities: 9.0.0 + parseurl@1.3.3: {} + + path-key@3.1.1: {} + + path-to-regexp@8.4.2: {} + pathe@2.0.3: {} pend@1.2.0: {} @@ -3591,6 +4101,8 @@ snapshots: picomatch@4.0.7: {} + pkce-challenge@5.0.1: {} + playwright-core@1.65.0: {} playwright@1.65.0: @@ -3617,11 +4129,25 @@ snapshots: property-information@7.2.0: {} + proxy-addr@2.0.8: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + qs@6.17.1: dependencies: es-define-property: 1.0.1 side-channel: 1.1.1 + range-parser@1.3.0: {} + + raw-body@3.0.2: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.7.3 + unpipe: 1.0.0 + read@1.0.7: dependencies: mute-stream: 0.0.8 @@ -3646,6 +4172,8 @@ snapshots: dependencies: regex-utilities: 2.3.0 + require-from-string@2.0.2: {} + restore-cursor@5.1.0: dependencies: onetime: 7.0.0 @@ -3674,6 +4202,16 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.16 '@rolldown/binding-win32-x64-msvc': 1.2.16 + router@2.3.0: + dependencies: + debug: 4.4.3 + depd: 2.0.0 + is-promise: 4.0.0 + parseurl: 1.3.3 + path-to-regexp: 8.4.2 + transitivePeerDependencies: + - supports-color + run-applescript@7.1.0: {} safe-buffer@5.1.2: {} @@ -3686,8 +4224,41 @@ snapshots: semver@7.8.5: {} + send@1.2.1: + dependencies: + debug: 4.4.3 + encodeurl: 2.0.3 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 2.0.0 + http-errors: 2.0.1 + mime-types: 3.0.2 + ms: 2.1.3 + on-finished: 2.4.2 + range-parser: 1.3.0 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + serve-static@2.2.1: + dependencies: + encodeurl: 2.0.3 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 1.2.1 + transitivePeerDependencies: + - supports-color + setimmediate@1.0.5: {} + setprototypeof@1.2.0: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + shiki@4.6.0: dependencies: '@shikijs/core': 4.6.0 @@ -3743,6 +4314,8 @@ snapshots: space-separated-tokens@2.0.2: {} + statuses@2.0.2: {} + std-env@4.3.0: {} stdin-discarder@0.2.2: {} @@ -3795,6 +4368,8 @@ snapshots: tinyrainbow@3.2.0: {} + toidentifier@1.0.1: {} + totalist@3.0.1: {} trim-lines@3.0.1: {} @@ -3803,6 +4378,12 @@ snapshots: tunnel@0.0.6: {} + type-is@2.1.0: + dependencies: + content-type: 2.1.0 + media-typer: 1.1.1 + mime-types: 3.0.2 + typed-rest-client@1.8.11: dependencies: qs: 6.17.1 @@ -3859,10 +4440,14 @@ snapshots: unist-util-is: 6.0.1 unist-util-visit-parents: 6.1.0 + unpipe@1.0.0: {} + url-join@4.0.1: {} util-deprecate@1.0.2: {} + vary@1.1.2: {} + version-range@4.15.0: {} vfile-message@4.0.4: @@ -3910,6 +4495,10 @@ snapshots: transitivePeerDependencies: - msw + which@2.0.2: + dependencies: + isexe: 2.0.0 + why-is-node-running@3.2.1: {} wrap-ansi@6.2.0: @@ -3918,6 +4507,8 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 + wrappy@1.0.2: {} + ws@8.22.2: {} wsl-utils@1.0.1: @@ -3950,4 +4541,10 @@ snapshots: yoctocolors-cjs@2.1.3: {} + zod-to-json-schema@3.25.2(zod@4.6.7): + dependencies: + zod: 4.6.7 + + zod@4.6.7: {} + zwitch@2.0.4: {} From bb62b5f784ce24e0ed329aceb925bd3524344f18 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 09:00:33 +0200 Subject: [PATCH 2/8] fix(mcp): names, links and folders cubic found in review (#226) - The source beside a package is part of choosing its name, is made new ('wx'), and a link at either name takes it, even one to nowhere. - A name is held while its build runs, so builds at once get their own. - A default folder that links to the home folder, or above it, is left out; one linking elsewhere, as to another drive, is kept. - File names: cut by characters, not UTF-16 halves; `-file` after a name Windows keeps for a device. - Tests: Documents covered, each server test builds what it needs, a link and two builds at once tested. - Docs: publicFetch is a guard against a mistake or a planted address, not a hostile network; the browser the check needs; audio and other files downloaded; 53 hub types; `await inside`; what `closed` settles with; SECURITY.md's scope covers author and the server. --- SECURITY.md | 18 ++++++++++++- design/mcp.md | 32 +++++++++++++---------- packages/author/README.md | 6 ++--- packages/mcp/README.md | 15 ++++++----- packages/mcp/lib/folders.mjs | 28 +++++++++++++------- packages/mcp/lib/server.mjs | 37 ++++++++++++++++++++------- packages/mcp/tests/folders.test.ts | 27 ++++++++++++++++---- packages/mcp/tests/server.test.ts | 41 +++++++++++++++++++++--------- packages/verify/README.md | 5 ++-- 9 files changed, 148 insertions(+), 61 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index ef4db3f1..fbaef05d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -70,6 +70,18 @@ The relevant security boundary depends on how the player is deployed: cannot make a package's own JavaScript safe when the package plays as it is; that is what `untrusted` withholds. +The author package and the MCP server build packages from a source that a +model may have written: + +- Given `within`, a build reads local files and writes its package only in + those folders, links followed. Given `publicFetch`, it refuses a web address + on a local network, redirects included; it resolves a name and then asks, so + it guards against a mistaken or planted address, not a hostile network. +- The MCP server always builds so, in the folders it was given, else the app's + roots, else Desktop, Documents and Downloads, never the home folder whole. It + never writes over a file, and its preview serves one package on `127.0.0.1` + until its tab is closed. + Reports are particularly helpful for issues such as: - archive path traversal, package-to-package data exposure, or virtual-route @@ -84,8 +96,12 @@ Reports are particularly helpful for issues such as: - cross-origin request, redirect, or navigation-policy bypasses; - denial of service that defeats documented streaming, size, storage, or lifecycle safeguards; +- a build confined by `within` that reads or writes outside its folders or + writes over a file, `publicFetch` reaching a local network by an address it + should refuse, or the MCP server reaching a file outside its folders; - vulnerabilities in the published player, runtime, library bundle, normalizer, - verifier, cmi5 package, embed site writer, demo, or installable app. + verifier, author package, MCP server, cmi5 package, embed site writer, demo, + or installable app. A malicious H5P archive executing its own bundled JavaScript when it plays as it is, is an expected property of H5P, not by itself a vulnerability. It diff --git a/design/mcp.md b/design/mcp.md index a2f91f41..c17ea2c5 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -22,19 +22,24 @@ web, is #210 and not this. them under 6,000 characters. - **The folders: `--allow`, else the app's roots, else Desktop, Documents and Downloads.** A folder the person named when adding the server is their choice and comes first; the app's roots come - next, asked on every call, since they change; never the home folder whole. A build reads local - files and writes its package only there (`within`) and fetches from the public internet only - (`publicFetch`); the preview opens only a package there (`inside`). + next, asked on every call, since they change; never the home folder whole, so a default folder + that is a link to the home folder, or to a folder holding it, is left out. A build reads local + files and writes its package only there (`within`), and refuses a web address on a local network + (`publicFetch`, a guard against a model's mistake or a planted address, not a hostile network); + the preview opens only a package there (`inside`). - **A build never writes over a file.** With no `output`, the package is named from its title - (`fileStem`: the title's letters and digits, in any script), with the next number where the name - is taken; a taken `output` gets the next number too, as the build itself refuses to write over a - file. The answer names the path written. Beside the package goes its source, `.source.json`, - which the build page opens to change and build again. + (`fileStem`: the title's letters and digits, in any script, cut at 60 characters, and `-file` + after a name Windows keeps for a device, as `con`). A name that is taken, the package's or its + source's, by a file or by a link even to nowhere, gets the next number, and so does a taken + `output`, as the build itself refuses to write over a file. A name is held while its build runs, + so builds at once take names of their own. The answer names the path written. Beside the package + goes its source, `.source.json`, which the build page opens to change and build again; it + is made new, never written over or through a link, and where it cannot be, the answer says so. - **A build answers with the content, the check and a picture.** The build's line, its notes, the outline (80 lines at most) and, with `verify`, the default, the verifier's summary of a check run - in a temporary folder, with its screenshot as an image. Where no Chromium-based browser is found, - the answer says "Not verified" and why. A source with problems is refused, every problem by its - path, and nothing is written. + in a temporary folder, with its screenshot as an image. Where neither Chrome, Edge nor + Playwright's Chromium is found, the answer says "Not verified" and why. A source with problems + is refused, every problem by its path, and nothing is written. - **The SDK is bundled.** `scripts/build.mjs` bundles the command with `@modelcontextprotocol/sdk` and zod into `dist/h5p-mcp.mjs` with esbuild, the author package and the verifier left as dependencies. `npx` then installs neither Express nor Hono nor the SDK's other HTTP dependencies, @@ -43,9 +48,10 @@ web, is #210 and not this. and loads the server only after `--help` and `--version` have had their turn. - **Tested as an app runs it.** `tests/server.test.ts` starts the bundle over standard input and output with the SDK's own client, given one folder, and calls each tool: the list, a type by a - loose name and one with no file, a build checked in Chromium, a taken name, a source with a - problem, an output outside the folder, a preview served and one refused. The test script first - copies the skill's type files into the author package, as the author's `prepack` does. + loose name and one with no file, a build checked in Chromium, a taken name and a link at one, + two builds at once, a source with a problem, an output outside the folder, a preview served and + one refused. Each test builds what it needs, so each runs alone. The test script first copies + the skill's type files into the author package, as the author's `prepack` does. Not built yet: reading a package back to a source (step 3 of #219), checking a video's bytes (#218), the MCP registry's `server.json` and Claude Desktop's one-click bundle. diff --git a/packages/author/README.md b/packages/author/README.md index 285f63c0..cf6e1ab7 100644 --- a/packages/author/README.md +++ b/packages/author/README.md @@ -194,9 +194,9 @@ plain lines for a review, made when it is first read: what the author wrote, the marked, slides, chapters and questions numbered, a scenario's links and a video's times written, interface texts and settings left out. `outlineOf(libraries, content, { limit })` makes one from what `loadLibraries` loaded for a content and the content, `{ type, params }`, as `checkContent` -takes them, cut at `limit` lines where one is given. `inside(path, folders)` is the confinement -`within` applies, for a tool beside the build that reads files of its own: whether a path, links -followed, is in one of the folders. +takes them, cut at `limit` lines where one is given. `await inside(path, folders)` is the +confinement `within` applies, for a tool beside the build that reads files of its own: whether a +path, links followed, is in one of the folders. ```js import { readFile } from 'node:fs/promises' diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 1d10beb0..636144a3 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -1,13 +1,13 @@ # H5P Author MCP by Missing Elements `@missing-elements/h5p-mcp` lets an AI app make H5P content on your computer: quizzes, fill in the -blanks, flash cards, presentations, interactive books, branching scenarios and the rest of the 55 +blanks, flash cards, presentations, interactive books, branching scenarios and the rest of the 53 content types the H5P hub serves. It writes a playable `.h5p` that carries its libraries, checks that it plays in a real H5P player, and opens it in your browser. No H5P site, server or account. It is a local [MCP](https://modelcontextprotocol.io) server: your app starts it on your computer, -and it sends nothing to a server of ours. It needs Node 22 or newer, and for the check Chrome, Edge -or another Chromium-based browser. +and it sends nothing to a server of ours. It needs Node 22 or newer, and for the check Chrome or +Edge; without either, run `npx playwright install chromium` once. ## Add it to your app @@ -49,10 +49,11 @@ number, and it says which. ## What leaves your computer -The build downloads a picture or video your content names by web address, from the public internet -only. The check and the preview play the package from your computer; content that embeds a YouTube -video or shows math loads those from the web, as H5P does anywhere. Your app sends your -conversation to its model, as it does without this server. +The build downloads each picture, video, audio or other file your content names by web address. It +refuses an address on your local network: a guard against a mistaken or planted address, not +against a hostile network. The check and the preview play the package from your computer; content +that embeds a YouTube video or shows math loads those from the web, as H5P does anywhere. Your app +sends your conversation to its model, as it does without this server. ## Licence diff --git a/packages/mcp/lib/folders.mjs b/packages/mcp/lib/folders.mjs index 173f2037..69632197 100644 --- a/packages/mcp/lib/folders.mjs +++ b/packages/mcp/lib/folders.mjs @@ -1,21 +1,26 @@ -import { stat } from 'node:fs/promises' +import { realpath, stat } from 'node:fs/promises' import { homedir } from 'node:os' -import { join } from 'node:path' +import { isAbsolute, join, relative, resolve, sep } from 'node:path' import { fileURLToPath } from 'node:url' /** * Where a build may read and write when neither the person nor the app named a folder: Desktop, * Documents and Downloads, those that exist. Never the home folder whole, which holds keys and - * settings no build has a reason to read. + * settings no build has a reason to read: one that is a link to the home folder, or to a folder + * that holds it, is left out. A link to a folder elsewhere, as on another drive, is kept. * @param {string} [home] * @returns {Promise} */ export async function defaultFolders(home = homedir()) { + const own = await realpath(home).catch(() => resolve(home)) /** @type {string[]} */ const found = [] for (const name of ['Desktop', 'Documents', 'Downloads']) { const path = join(home, name) - if ((await stat(path).catch(() => null))?.isDirectory()) found.push(path) + if (!(await stat(path).catch(() => null))?.isDirectory()) continue + const up = relative(await realpath(path), own) + if (up === '' || (!isAbsolute(up) && up !== '..' && !up.startsWith(`..${sep}`))) continue + found.push(path) } return found } @@ -30,19 +35,24 @@ export function rootFolders(roots) { return roots.filter((root) => root.uri.startsWith('file:')).map((root) => fileURLToPath(root.uri)) } +/** The names Windows keeps for its devices, an extension or not: no file can take one there. */ +const DEVICE = /^(?:con|prn|aux|nul|com[0-9¹²³]|lpt[0-9¹²³])$/ + /** * A file name for a package from its title: its letters and digits, in any script and as written, - * joined by `-`, at most 60 characters; `h5p-content` for a title with none of them. + * joined by `-`, at most 60 characters; `h5p-content` for a title with none of them, and `-file` + * after a name Windows keeps for a device, as `con`. * @param {unknown} title * @returns {string} */ export function fileStem(title) { - const stem = String(title ?? '') + const words = String(title ?? '') .normalize('NFC') .toLowerCase() .replace(/[^\p{L}\p{M}\p{N}]+/gu, '-') .replace(/^-+|-+$/g, '') - .slice(0, 60) - .replace(/-+$/, '') - return stem || 'h5p-content' + // Cut by characters, not by halves of one: a letter outside the basic range is two. + const stem = Array.from(words).slice(0, 60).join('').replace(/-+$/, '') + if (!stem) return 'h5p-content' + return DEVICE.test(stem) ? `${stem}-file` : stem } diff --git a/packages/mcp/lib/server.mjs b/packages/mcp/lib/server.mjs index d4b1dd07..6ec804fe 100644 --- a/packages/mcp/lib/server.mjs +++ b/packages/mcp/lib/server.mjs @@ -1,4 +1,4 @@ -import { access, mkdtemp, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises' +import { lstat, mkdtemp, readdir, readFile, rm, stat, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { basename, dirname, join, resolve } from 'node:path' import { fileURLToPath } from 'node:url' @@ -52,6 +52,9 @@ const whereFiles = (folders) => folders.length /** Lines of an outline past which an answer says how many more there are. */ const OUTLINE_LINES = 80 +/** @param {string} path a package's */ +const sourceBeside = (path) => path.replace(/\.h5p$/i, '.source.json') + /** * The server and its three tools. It holds no rules of its own: the build, its checks and the * confinement to folders are h5p-author's, the check and the preview h5p-verify's. @@ -100,16 +103,25 @@ export async function createServer(options = {}) { return new Set(names.filter((name) => name.endsWith('.md')).map((name) => name.slice(0, -3))) } + /** The packages being built, lower-cased, as macOS and Windows match a name in any case. */ + const building = new Set() + /** - * A package's path in the folder, with a number added to the name where it is taken: a build - * never writes over a file, so a package built again takes the next number. + * A package's path in the folder, with a number added to the name where it is taken, the + * package's or its source's: a build never writes over a file, so a package built again takes + * the next number. A link takes its name too, even one that leads nowhere. The path is held for + * the build until it is let go of, so that builds at once take names of their own. * @param {string} folder * @param {string} stem the file name without `.h5p` */ async function freeName(folder, stem) { for (let n = 1; ; n++) { const path = join(folder, `${stem}${n === 1 ? '' : `-${n}`}.h5p`) - if (!(await access(path).then(() => true, () => false))) return path + const taken = await Promise.all([path, sourceBeside(path)].map((each) => lstat(each).then(() => true, () => false))) + // Asked after the wait and held at once, with no wait between, so no other build takes it. + if (taken.includes(true) || building.has(path.toLowerCase())) continue + building.add(path.toLowerCase()) + return path } } @@ -147,26 +159,33 @@ export async function createServer(options = {}) { }, async ({ source, output, verify = true }) => { const allowed = await folders() if (!allowed.length) return refusal('This server has no folder to write in: start it with --allow , or give it a folder from the app.') - let target = output ? resolve(allowed[0], output) : await freeName(allowed[0], fileStem(source.title)) + let target = resolve(allowed[0], output || `${fileStem(source.title)}.h5p`) if (!/\.h5p$/i.test(target)) target += '.h5p' // Said here, with the folders, since a model cannot know them: the build's own refusal names none. if (!(await inside(target, allowed))) return refusal(`${target} is outside the folders this server may write in: ${allowed.join(', ')}. Give a file name alone, or leave output out.`) // A name that is taken gets a number, as a build never writes over a file. - if (output) target = await freeName(dirname(target), basename(target).replace(/\.h5p$/i, '')) + target = await freeName(dirname(target), basename(target).replace(/\.h5p$/i, '')) + const sourceFile = sourceBeside(target) let result + /** @type {Error | undefined} */ + let unwritten try { result = await buildPackage(source, target, { base: dirname(target), within: allowed, fetch: publicFetch, libraries: options.libraries }) + // Made new: a file or a link put at its name since the name was found free is not written through. + unwritten = await writeFile(sourceFile, `${JSON.stringify(source, null, 2)}\n`, { flag: 'wx' }).then(() => undefined, (error) => error) } catch (error) { if (error instanceof SourceError) return refusal(`${error.message}\nFix each at its path and build again.${/outside the folders/.test(error.message) ? ` ${whereFiles(allowed)}` : ''}`) return refusal(error instanceof Error ? error.message : String(error)) + } finally { + building.delete(target.toLowerCase()) } - const sourceFile = target.replace(/\.h5p$/i, '.source.json') - await writeFile(sourceFile, `${JSON.stringify(source, null, 2)}\n`) const install = result.install.length ? `, ${result.install.length} more for installing on an H5P site` : '' const media = result.media.length ? `, ${result.media.length} media file${result.media.length === 1 ? '' : 's'}` : '' const lines = [ `Built ${target} (${sized((await stat(target)).size)}): ${result.manifest.mainLibrary}, ${result.libraries.length} libraries${install}${media}.`, - `Its source is beside it, ${basename(sourceFile)}: https://missing-elements.github.io/h5p/build/ opens it under "Or open a file", to change and build again.` + unwritten + ? `Its source was not written beside it: ${unwritten.message}` + : `Its source is beside it, ${basename(sourceFile)}: https://missing-elements.github.io/h5p/build/ opens it under "Or open a file", to change and build again.` ] for (const { path, message } of result.notes) lines.push(`Note: ${path} ${message}`) const outline = result.outline.split('\n') diff --git a/packages/mcp/tests/folders.test.ts b/packages/mcp/tests/folders.test.ts index a5a7a0c3..abb10f6a 100644 --- a/packages/mcp/tests/folders.test.ts +++ b/packages/mcp/tests/folders.test.ts @@ -1,6 +1,6 @@ -import { mkdir, mkdtemp, rm } from 'node:fs/promises' +import { mkdir, mkdtemp, rm, symlink } from 'node:fs/promises' import { tmpdir } from 'node:os' -import { join } from 'node:path' +import { dirname, join } from 'node:path' import { pathToFileURL } from 'node:url' import { describe, expect, it } from 'vitest' import { defaultFolders, fileStem, rootFolders } from '../lib/folders.mjs' @@ -8,12 +8,21 @@ import { defaultFolders, fileStem, rootFolders } from '../lib/folders.mjs' describe('the folders a build may use', () => { it('are Desktop, Documents and Downloads where they exist, never the home folder whole', async () => { const home = await mkdtemp(join(tmpdir(), 'h5p-mcp-home-')) + const drive = await mkdtemp(join(tmpdir(), 'h5p-mcp-drive-')) try { - await mkdir(join(home, 'Desktop')) - await mkdir(join(home, 'Downloads')) - expect(await defaultFolders(home)).toEqual([join(home, 'Desktop'), join(home, 'Downloads')]) + await mkdir(join(home, 'Documents')) + expect(await defaultFolders(home)).toEqual([join(home, 'Documents')]) + // A link to a folder elsewhere, as on another drive, is that folder; a link to the home + // folder, or to one that holds it, would open the whole of it. + await symlink(drive, join(home, 'Downloads'), 'junction') + await symlink(home, join(home, 'Desktop'), 'junction') + expect(await defaultFolders(home)).toEqual([join(home, 'Documents'), join(home, 'Downloads')]) + await rm(join(home, 'Desktop')) + await symlink(dirname(home), join(home, 'Desktop'), 'junction') + expect(await defaultFolders(home)).toEqual([join(home, 'Documents'), join(home, 'Downloads')]) } finally { await rm(home, { recursive: true, force: true }) + await rm(drive, { recursive: true, force: true }) } }) @@ -32,7 +41,15 @@ describe('a package\'s file name', () => { it('is cut at 60 characters, and stands in for a title with none', () => { expect(fileStem('a'.repeat(40) + ' ' + 'b'.repeat(40))).toBe(`${'a'.repeat(40)}-${'b'.repeat(19)}`) + // Characters, not halves of one: a letter outside the basic range is two. + expect(fileStem(`a${'𠀀'.repeat(70)}`)).toBe(`a${'𠀀'.repeat(59)}`) expect(fileStem('?!')).toBe('h5p-content') expect(fileStem(undefined)).toBe('h5p-content') }) + + it('is never a name Windows keeps for a device', () => { + expect(fileStem('Con')).toBe('con-file') + expect(fileStem('LPT1')).toBe('lpt1-file') + expect(fileStem('Console')).toBe('console') + }) }) diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts index 52a2dd1b..55f8fe99 100644 --- a/packages/mcp/tests/server.test.ts +++ b/packages/mcp/tests/server.test.ts @@ -1,6 +1,6 @@ -import { mkdtemp, readFile, readdir, rm, writeFile } from 'node:fs/promises' +import { access, mkdtemp, readFile, readdir, rm, symlink, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' -import { join, resolve } from 'node:path' +import { basename, join, resolve } from 'node:path' import { Client } from '@modelcontextprotocol/sdk/client/index.js' import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' import { afterAll, beforeAll, describe, expect, it } from 'vitest' @@ -9,7 +9,7 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest' * The server as an app runs it: the bundle the package ships, started over standard input and * output, given one folder, asked through the SDK's own client. The build's rules are the author * package's and tested there; these hold the server to calling them, to its folders, and to its - * answers. + * answers. Each test builds what it needs, under a title of its own. */ const BUNDLE = resolve(import.meta.dirname, '../dist/h5p-mcp.mjs') @@ -26,13 +26,19 @@ type Content = { type: string, text?: string, data?: string, mimeType?: string } type Answer = { content: Content[], isError?: boolean } let folder: string +/** A folder the server may not use. */ +let elsewhere: string let client: Client const call = async (name: string, args: Record = {}) => (await client.callTool({ name, arguments: args })) as Answer const textOf = (answer: Answer) => answer.content.filter((part) => part.type === 'text').map((part) => part.text).join('\n') +/** The path a build's answer names, if it built. */ +const builtOf = (answer: Answer) => /^Built (.+?\.h5p) \(/m.exec(textOf(answer))?.[1] +const build = async (title: string, args: Record = {}) => builtOf(await call('h5p_build', { source: { ...SOURCE, title }, verify: false, ...args })) beforeAll(async () => { folder = await mkdtemp(join(tmpdir(), 'h5p-mcp-')) + elsewhere = await mkdtemp(join(tmpdir(), 'h5p-mcp-elsewhere-')) client = new Client({ name: 'h5p-mcp-test', version: '0' }) await client.connect(new StdioClientTransport({ command: process.execPath, args: [BUNDLE, '--allow', folder, '--no-open'], stderr: 'pipe' })) }) @@ -40,6 +46,7 @@ beforeAll(async () => { afterAll(async () => { await client?.close() await rm(folder, { recursive: true, force: true }) + await rm(elsewhere, { recursive: true, force: true }) }) describe('the server', () => { @@ -95,13 +102,22 @@ describe('h5p_build', () => { expect(JSON.parse(await readFile(join(folder, 'boiling-point.source.json'), 'utf8'))).toEqual(SOURCE) }) - it('takes the next number rather than write over a file', async () => { + it('takes the next number rather than write over a file, or through a link', async () => { + expect(await build('Again')).toBe(join(folder, 'again.h5p')) + expect(await build('Again')).toBe(join(folder, 'again-2.h5p')) await writeFile(join(folder, 'mine.h5p'), 'the person\'s own file') - const again = textOf(await call('h5p_build', { source: SOURCE, verify: false })) - expect(again).toContain(`Built ${join(folder, 'boiling-point-2.h5p')}`) - const named = textOf(await call('h5p_build', { source: SOURCE, output: 'mine.h5p', verify: false })) - expect(named).toContain(`Built ${join(folder, 'mine-2.h5p')}`) + // A link holds its name, even one that leads nowhere: written through, it would make a file + // outside the folder. + const outside = join(elsewhere, 'source.json') + await symlink(outside, join(folder, 'mine-2.source.json')) + expect(await build('Boiling point', { output: 'mine.h5p' })).toBe(join(folder, 'mine-3.h5p')) expect(await readFile(join(folder, 'mine.h5p'), 'utf8')).toBe('the person\'s own file') + await expect(access(outside)).rejects.toThrow() + }) + + it('gives builds made at once names of their own', async () => { + const both = await Promise.all([build('Twice'), build('Twice')]) + expect(both.sort()).toEqual([join(folder, 'twice-2.h5p'), join(folder, 'twice.h5p')]) }) it('refuses a source with problems, each by its path, and writes nothing', async () => { @@ -113,8 +129,7 @@ describe('h5p_build', () => { }) it('writes nowhere but its folders', async () => { - const elsewhere = join(tmpdir(), 'h5p-mcp-elsewhere.h5p') - const answer = await call('h5p_build', { source: SOURCE, output: elsewhere, verify: false }) + const answer = await call('h5p_build', { source: SOURCE, output: join(elsewhere, 'boiling-point.h5p'), verify: false }) expect(answer.isError).toBe(true) // A model cannot know the folders, so the refusal names them and the way out. expect(textOf(answer)).toContain(`outside the folders this server may write in: ${folder}. Give a file name alone, or leave output out.`) @@ -123,7 +138,9 @@ describe('h5p_build', () => { describe('h5p_preview', () => { it('serves a package in its folders, and answers with the address', async () => { - const answer = await call('h5p_preview', { package: 'boiling-point.h5p' }) + const file = await build('Preview') + expect(file).toBeTruthy() + const answer = await call('h5p_preview', { package: basename(file!) }) expect(answer.isError).toBeFalsy() const address = /http:\/\/127\.0\.0\.1:\d+\//.exec(textOf(answer))?.[0] expect(address).toBeTruthy() @@ -131,7 +148,7 @@ describe('h5p_preview', () => { }) it('refuses a file outside its folders', async () => { - const answer = await call('h5p_preview', { package: resolve(tmpdir(), 'elsewhere.h5p') }) + const answer = await call('h5p_preview', { package: join(elsewhere, 'boiling-point.h5p') }) expect(answer.isError).toBe(true) expect(textOf(answer)).toContain('not in a folder this server may use') }) diff --git a/packages/verify/README.md b/packages/verify/README.md index 2d343831..8742880d 100644 --- a/packages/verify/README.md +++ b/packages/verify/README.md @@ -117,8 +117,9 @@ if (report.verdict !== 'pass') process.exit(1) TypeScript declarations ship with the package: `VerifyReport` is `report.json`'s shape. `previewPackage({ file, libraries, untrusted })` serves the preview as `--preview` does and gives -its `url`, a `closed` promise that settles once its last tab has gone, and `close()`; -`openBrowser(url)` opens an address in the default browser, false where no opener started. +its `url`, `close()`, and a `closed` promise that settles with `closed` once its last tab has gone, +`unopened` when no tab came within ten minutes, or `stopped` after `close()`. `openBrowser(url)` +opens an address in the default browser, false where no opener started. An [agent skill](https://agentskills.io) for it ships in the repository: `npx skills add missing-elements/h5p-offline-player --skill h5p-verify`. From 3886df817b7c7ecaa651c7d886ce5a928a8b720c Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 09:08:51 +0200 Subject: [PATCH 3/8] fix(mcp): the defaults are what is never the home folder; hosted video stays an address (#226) - SECURITY.md, the README and design/mcp.md: --allow and the app's roots are taken as given; only the default folders are never the home folder whole. - The README: a video on YouTube, Vimeo, Panopto or Echo360 stays an address; the rest is downloaded. - The link test is its own, skipped on Windows, where a link to a file takes privileges. --- SECURITY.md | 8 ++++---- design/mcp.md | 10 +++++----- packages/mcp/README.md | 15 ++++++++------- packages/mcp/tests/server.test.ts | 13 +++++++++---- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index fbaef05d..c4536e52 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -77,10 +77,10 @@ model may have written: those folders, links followed. Given `publicFetch`, it refuses a web address on a local network, redirects included; it resolves a name and then asks, so it guards against a mistaken or planted address, not a hostile network. -- The MCP server always builds so, in the folders it was given, else the app's - roots, else Desktop, Documents and Downloads, never the home folder whole. It - never writes over a file, and its preview serves one package on `127.0.0.1` - until its tab is closed. +- The MCP server always builds so, in the folders the person gave it, else the + app's roots, as they are given. Given none, it uses Desktop, Documents and + Downloads, and never the home folder whole. It never writes over a file, and + its preview serves one package on `127.0.0.1` until its tab is closed. Reports are particularly helpful for issues such as: diff --git a/design/mcp.md b/design/mcp.md index c17ea2c5..b84f2be6 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -22,11 +22,11 @@ web, is #210 and not this. them under 6,000 characters. - **The folders: `--allow`, else the app's roots, else Desktop, Documents and Downloads.** A folder the person named when adding the server is their choice and comes first; the app's roots come - next, asked on every call, since they change; never the home folder whole, so a default folder - that is a link to the home folder, or to a folder holding it, is left out. A build reads local - files and writes its package only there (`within`), and refuses a web address on a local network - (`publicFetch`, a guard against a model's mistake or a planted address, not a hostile network); - the preview opens only a package there (`inside`). + next, asked on every call, since they change; both are taken as given. The defaults are never + the home folder whole: one that is a link to the home folder, or to a folder holding it, is left + out. A build reads local files and writes its package only there (`within`), and refuses a web + address on a local network (`publicFetch`, a guard against a model's mistake or a planted + address, not a hostile network); the preview opens only a package there (`inside`). - **A build never writes over a file.** With no `output`, the package is named from its title (`fileStem`: the title's letters and digits, in any script, cut at 60 characters, and `-file` after a name Windows keeps for a device, as `con`). A name that is taken, the package's or its diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 636144a3..342e48d9 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -36,8 +36,8 @@ Then ask, for example: "Make a five-question quiz about the water cycle as an H5 It reads the files your content names, and writes packages, only in its folders: those you give with `--allow`, as in `"args": ["-y", "@missing-elements/h5p-mcp", "--allow", "/Users/me/Lessons"]` (repeat it for more); else the folders your app gives it; else your Desktop, Documents and -Downloads. Never your home folder whole. It never writes over a file: a name that is taken gets a -number, and it says which. +Downloads, and then never your home folder whole. It never writes over a file: a name that is taken +gets a number, and it says which. ## Tools @@ -49,11 +49,12 @@ number, and it says which. ## What leaves your computer -The build downloads each picture, video, audio or other file your content names by web address. It -refuses an address on your local network: a guard against a mistaken or planted address, not -against a hostile network. The check and the preview play the package from your computer; content -that embeds a YouTube video or shows math loads those from the web, as H5P does anywhere. Your app -sends your conversation to its model, as it does without this server. +The build downloads each picture, video, recording or other file your content names by web +address, but for a video on YouTube, Vimeo, Panopto or Echo360, which stays an address and plays +from there. It refuses an address on your local network: a guard against a mistaken or planted +address, not against a hostile network. The check and the preview play the package from your +computer; such a video, and math, load from the web, as H5P does anywhere. Your app sends your +conversation to its model, as it does without this server. ## Licence diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts index 55f8fe99..1e70faf6 100644 --- a/packages/mcp/tests/server.test.ts +++ b/packages/mcp/tests/server.test.ts @@ -102,16 +102,21 @@ describe('h5p_build', () => { expect(JSON.parse(await readFile(join(folder, 'boiling-point.source.json'), 'utf8'))).toEqual(SOURCE) }) - it('takes the next number rather than write over a file, or through a link', async () => { + it('takes the next number rather than write over a file', async () => { expect(await build('Again')).toBe(join(folder, 'again.h5p')) expect(await build('Again')).toBe(join(folder, 'again-2.h5p')) await writeFile(join(folder, 'mine.h5p'), 'the person\'s own file') + expect(await build('Boiling point', { output: 'mine.h5p' })).toBe(join(folder, 'mine-2.h5p')) + expect(await readFile(join(folder, 'mine.h5p'), 'utf8')).toBe('the person\'s own file') + }) + + // A link to a file takes privileges Windows does not give by default. + it.skipIf(process.platform === 'win32')('takes the next number rather than write through a link', async () => { // A link holds its name, even one that leads nowhere: written through, it would make a file // outside the folder. const outside = join(elsewhere, 'source.json') - await symlink(outside, join(folder, 'mine-2.source.json')) - expect(await build('Boiling point', { output: 'mine.h5p' })).toBe(join(folder, 'mine-3.h5p')) - expect(await readFile(join(folder, 'mine.h5p'), 'utf8')).toBe('the person\'s own file') + await symlink(outside, join(folder, 'linked.source.json')) + expect(await build('Linked')).toBe(join(folder, 'linked-2.h5p')) await expect(access(outside)).rejects.toThrow() }) From 2651264170ba248b2d72c2d876b1c9873e91eff4 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 09:13:41 +0200 Subject: [PATCH 4/8] docs(mcp): the local-network refusal is the download's; a hosted video's address is kept (#226) publicFetch guards what a build downloads. A video on YouTube, Vimeo, Panopto or Echo360 is never downloaded: its address is kept and the player loads it wherever it points, Panopto often being an institution's own server on its own network. The README, SECURITY.md and design/mcp.md now say so. --- SECURITY.md | 8 +++++--- design/mcp.md | 8 +++++--- packages/mcp/README.md | 10 +++++----- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index c4536e52..21f549ec 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -74,9 +74,11 @@ The author package and the MCP server build packages from a source that a model may have written: - Given `within`, a build reads local files and writes its package only in - those folders, links followed. Given `publicFetch`, it refuses a web address - on a local network, redirects included; it resolves a name and then asks, so - it guards against a mistaken or planted address, not a hostile network. + those folders, links followed. Given `publicFetch`, it refuses to download + from a web address on a local network, redirects included; it resolves a + name and then asks, so it guards against a mistaken or planted address, not + a hostile network. A video on YouTube, Vimeo, Panopto or Echo360 is not + downloaded: its address is kept, and the player loads it wherever it points. - The MCP server always builds so, in the folders the person gave it, else the app's roots, as they are given. Given none, it uses Desktop, Documents and Downloads, and never the home folder whole. It never writes over a file, and diff --git a/design/mcp.md b/design/mcp.md index b84f2be6..cadebe82 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -24,9 +24,11 @@ web, is #210 and not this. the person named when adding the server is their choice and comes first; the app's roots come next, asked on every call, since they change; both are taken as given. The defaults are never the home folder whole: one that is a link to the home folder, or to a folder holding it, is left - out. A build reads local files and writes its package only there (`within`), and refuses a web - address on a local network (`publicFetch`, a guard against a model's mistake or a planted - address, not a hostile network); the preview opens only a package there (`inside`). + out. A build reads local files and writes its package only there (`within`), and refuses to + download from an address on a local network (`publicFetch`, a guard against a model's mistake or + a planted address, not a hostile network); the preview opens only a package there (`inside`). A + hosted video's address is no download: it is kept, and the player loads it wherever it points, + since Panopto is often an institution's own server on its own network. - **A build never writes over a file.** With no `output`, the package is named from its title (`fileStem`: the title's letters and digits, in any script, cut at 60 characters, and `-file` after a name Windows keeps for a device, as `con`). A name that is taken, the package's or its diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 342e48d9..834ba964 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -50,11 +50,11 @@ gets a number, and it says which. ## What leaves your computer The build downloads each picture, video, recording or other file your content names by web -address, but for a video on YouTube, Vimeo, Panopto or Echo360, which stays an address and plays -from there. It refuses an address on your local network: a guard against a mistaken or planted -address, not against a hostile network. The check and the preview play the package from your -computer; such a video, and math, load from the web, as H5P does anywhere. Your app sends your -conversation to its model, as it does without this server. +address, and refuses to download from an address on your local network: a guard against a mistaken +or planted address, not against a hostile network. A video on YouTube, Vimeo, Panopto or Echo360 is +not downloaded: it stays an address, which the player loads wherever it points, as H5P does +anywhere, and so is math. The check and the preview play the package from your computer. Your app +sends your conversation to its model, as it does without this server. ## Licence From 5031a8c7cefc20c967eaa6710839f5972b3414cd Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 10:17:54 +0200 Subject: [PATCH 5/8] refactor(mcp): MCP SDK v2, which needs no bundle (#226) @modelcontextprotocol/server 2.4.0 replaces @modelcontextprotocol/sdk 1.32.2, the maintenance line, before the first release. v2's server package brings only its core and zod, none of the HTTP frameworks v1 installed, so the reason for the esbuild bundle is gone: the package ships bin/ and lib/ as written, scripts/build.mjs and dist/NOTICE.txt go, and the lockfile loses 57 packages. The tools' schemas are zod objects, as v2 asks; an app sees v1's schemas but for $schema, now JSON Schema 2020-12. It still serves the 2025 protocol every app speaks, where the app's roots work as before. --- design/layout.md | 4 +- design/mcp.md | 18 +- packages/mcp/README.md | 1 - packages/mcp/bin/h5p-mcp.mjs | 2 +- packages/mcp/lib/server.mjs | 10 +- packages/mcp/package.json | 20 +- packages/mcp/scripts/build.mjs | 50 --- packages/mcp/tests/server.test.ts | 10 +- packages/mcp/tsconfig.json | 2 +- packages/mcp/vitest.config.ts | 2 +- pnpm-lock.yaml | 545 ++---------------------------- 11 files changed, 65 insertions(+), 599 deletions(-) delete mode 100644 packages/mcp/scripts/build.mjs diff --git a/design/layout.md b/design/layout.md index 3e6aa301..537f34cb 100644 --- a/design/layout.md +++ b/design/layout.md @@ -30,8 +30,8 @@ packages/verify/ a package played headless (lib/verify.mjs) and in a brows packages/author/ a playable .h5p from a short source: lib/build.mjs both builds, node.mjs Node's, generator.mjs content from semantics, check.mjs, outline.mjs, types.mjs the editor widgets' rules; scripts/ the skill's sync and copy -packages/mcp/ the local MCP server: lib/server.mjs its three tools, lib/folders.mjs the - folders it may use; scripts/build.mjs bundles the MCP SDK into dist/ +packages/mcp/ the local MCP server: bin/h5p-mcp.mjs the command, lib/server.mjs its three + tools, lib/folders.mjs the folders it may use packages/cmi5/ the element as a cmi5 AU: src/index.ts startCmi5, src/client.ts the protocol packages/embed/ site/ the embed page and the SCORM page; lib/build.mjs the site, lib/scorm*.mjs the SCORM zip in Node and in a page; scorm/ its launch page diff --git a/design/mcp.md b/design/mcp.md index cadebe82..96a4f0e7 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -42,18 +42,18 @@ web, is #210 and not this. in a temporary folder, with its screenshot as an image. Where neither Chrome, Edge nor Playwright's Chromium is found, the answer says "Not verified" and why. A source with problems is refused, every problem by its path, and nothing is written. -- **The SDK is bundled.** `scripts/build.mjs` bundles the command with `@modelcontextprotocol/sdk` - and zod into `dist/h5p-mcp.mjs` with esbuild, the author package and the verifier left as - dependencies. `npx` then installs neither Express nor Hono nor the SDK's other HTTP dependencies, - which a server over standard input never loads. `dist/NOTICE.txt` lists what is bundled, with the - licences. Standard output is the protocol's, so the command sends `console.log` to standard error, - and loads the server only after `--help` and `--version` have had their turn. -- **Tested as an app runs it.** `tests/server.test.ts` starts the bundle over standard input and +- **The SDK is v2, and the package ships its source.** `@modelcontextprotocol/server` brings only + its core and zod, none of the HTTP frameworks v1 installed, so `bin/` and `lib/` are published as + written, with no bundle. `McpServer` on `StdioServerTransport` serves the 2025 protocol, which + every app speaks; protocol 2026-07-28 deprecates roots, so serving it would leave the folders to + `--allow` and the defaults. Standard output is the protocol's, so the command sends `console.log` + to standard error, and loads the server only after `--help` and `--version` have had their turn. +- **Tested as an app runs it.** `tests/server.test.ts` starts the command over standard input and output with the SDK's own client, given one folder, and calls each tool: the list, a type by a loose name and one with no file, a build checked in Chromium, a taken name and a link at one, two builds at once, a source with a problem, an output outside the folder, a preview served and one refused. Each test builds what it needs, so each runs alone. The test script first copies the skill's type files into the author package, as the author's `prepack` does. -Not built yet: reading a package back to a source (step 3 of #219), checking a video's bytes -(#218), the MCP registry's `server.json` and Claude Desktop's one-click bundle. +Not built yet: reading a package back to a source (step 3 of #219), the MCP registry's +`server.json` and Claude Desktop's one-click bundle. diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 834ba964..6afefb3b 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -59,7 +59,6 @@ sends your conversation to its model, as it does without this server. ## Licence MIT. The H5P libraries a package carries are under their own licences, listed in it. -`dist/NOTICE.txt` lists the packages bundled into the server. H5P is a trademark of H5P Group. This server is made by Missing Elements and is not affiliated with or endorsed by H5P Group. diff --git a/packages/mcp/bin/h5p-mcp.mjs b/packages/mcp/bin/h5p-mcp.mjs index d66d37b9..cfa19262 100644 --- a/packages/mcp/bin/h5p-mcp.mjs +++ b/packages/mcp/bin/h5p-mcp.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node import { readFile } from 'node:fs/promises' import { parseArgs } from 'node:util' -import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' +import { StdioServerTransport } from '@modelcontextprotocol/server/stdio' // Standard output is the protocol's: anything a library prints there would break a message. console.log = console.error diff --git a/packages/mcp/lib/server.mjs b/packages/mcp/lib/server.mjs index 6ec804fe..82854d3d 100644 --- a/packages/mcp/lib/server.mjs +++ b/packages/mcp/lib/server.mjs @@ -2,7 +2,7 @@ import { lstat, mkdtemp, readdir, readFile, rm, stat, writeFile } from 'node:fs/ import { tmpdir } from 'node:os' import { basename, dirname, join, resolve } from 'node:path' import { fileURLToPath } from 'node:url' -import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' +import { McpServer } from '@modelcontextprotocol/server' import { z } from 'zod' import { SourceError, buildPackage, contentTypes, inside, openPack, publicFetch, schemaOf, sourceType } from '@missing-elements/h5p-author' import { VerifyError, openBrowser, previewPackage, summarize, verifyPackage } from '@missing-elements/h5p-verify' @@ -128,7 +128,7 @@ export async function createServer(options = {}) { server.registerTool('h5p_types', { title: 'H5P content types', description: TYPES, - inputSchema: { type: z.string().optional().describe('A content type, as H5P.MultiChoice or "multiple choice"') }, + inputSchema: z.object({ type: z.string().optional().describe('A content type, as H5P.MultiChoice or "multiple choice"') }), annotations: { readOnlyHint: true, openWorldHint: false } }, async ({ type }) => { const list = await types() @@ -150,11 +150,11 @@ export async function createServer(options = {}) { server.registerTool('h5p_build', { title: 'Build an H5P package', description: BUILD, - inputSchema: { + inputSchema: z.object({ source: z.record(z.string(), z.unknown()).describe('The source, as h5p_types describes it for its type'), output: z.string().optional().describe('Leave it out unless the person named a place: a file name, or a path in a folder this server may use'), verify: z.boolean().optional().describe('Play it and report whether it works; default true') - }, + }), annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: true } }, async ({ source, output, verify = true }) => { const allowed = await folders() @@ -213,7 +213,7 @@ export async function createServer(options = {}) { server.registerTool('h5p_preview', { title: 'Preview an H5P package', description: PREVIEW, - inputSchema: { package: z.string().describe('The .h5p to open, in a folder this server may use') }, + inputSchema: z.object({ package: z.string().describe('The .h5p to open, in a folder this server may use') }), annotations: { readOnlyHint: true, openWorldHint: false } }, async ({ package: file }) => { const allowed = await folders() diff --git a/packages/mcp/package.json b/packages/mcp/package.json index 2bda4cc0..d7a48478 100644 --- a/packages/mcp/package.json +++ b/packages/mcp/package.json @@ -17,13 +17,14 @@ }, "type": "module", "bin": { - "h5p-mcp": "./dist/h5p-mcp.mjs" + "h5p-mcp": "./bin/h5p-mcp.mjs" }, "exports": { "./package.json": "./package.json" }, "files": [ - "dist" + "bin", + "lib" ], "keywords": [ "h5p", @@ -35,23 +36,22 @@ "ai" ], "scripts": { - "build": "node scripts/build.mjs", - "test": "pnpm --filter @missing-elements/h5p-offline-player build && pnpm --filter @missing-elements/h5p-author exec node scripts/copy-skill.mjs && pnpm build && vitest run", + "test": "pnpm --filter @missing-elements/h5p-offline-player build && pnpm --filter @missing-elements/h5p-author exec node scripts/copy-skill.mjs && vitest run", "typecheck": "tsc -p tsconfig.json", - "prepack": "node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\" && pnpm build", + "prepack": "node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\"", "prepublishOnly": "node -e \"if (!/^pnpm\\//.test(process.env.npm_config_user_agent || '')) { console.error('Publish with pnpm publish: npm would ship the workspace:^ dependency ranges as they are, and the package would not install.'); process.exit(1) }\" && pnpm typecheck && pnpm test" }, "dependencies": { "@missing-elements/h5p-author": "workspace:^", - "@missing-elements/h5p-verify": "workspace:^" + "@missing-elements/h5p-verify": "workspace:^", + "@modelcontextprotocol/server": "^2.4.0", + "zod": "^4.6.7" }, "devDependencies": { - "@modelcontextprotocol/sdk": "^1.32.2", + "@modelcontextprotocol/client": "^2.4.0", "@types/node": "^26.6.6", - "esbuild": "^0.28.2", "typescript": "^7.0.2", - "vitest": "^5.1.0", - "zod": "^4.6.7" + "vitest": "^5.1.0" }, "engines": { "node": ">=22" diff --git a/packages/mcp/scripts/build.mjs b/packages/mcp/scripts/build.mjs deleted file mode 100644 index a3084440..00000000 --- a/packages/mcp/scripts/build.mjs +++ /dev/null @@ -1,50 +0,0 @@ -// dist/h5p-mcp.mjs: the command with the MCP SDK and zod bundled into it, so that `npx` installs -// the author package and the verifier and not the SDK's HTTP servers (Express, Hono and the rest), -// which a server over standard input never loads. dist/NOTICE.txt holds the licences of what is -// bundled. -import { build } from 'esbuild' -import { mkdir, readFile, rm, writeFile } from 'node:fs/promises' -import { dirname, join, resolve } from 'node:path' -import { existsSync } from 'node:fs' - -const root = resolve(import.meta.dirname, '..') -const dist = join(root, 'dist') -await rm(dist, { recursive: true, force: true }) -await mkdir(dist, { recursive: true }) - -const { metafile } = await build({ - entryPoints: [join(root, 'bin', 'h5p-mcp.mjs')], - outfile: join(dist, 'h5p-mcp.mjs'), - bundle: true, - platform: 'node', - format: 'esm', - target: 'node22', - // The author package and the verifier are dependencies, installed beside it. - external: ['@missing-elements/*'], - // A CommonJS module bundled into an ES module calls `require`, which an ES module lacks. - banner: { js: "import { createRequire as __h5pMcpRequire } from 'node:module';\nconst require = __h5pMcpRequire(import.meta.url);" }, - legalComments: 'none', - metafile: true, - logLevel: 'warning' -}) - -/** @type {Map} */ -const bundled = new Map() -for (const input of Object.keys(metafile.inputs)) { - if (!input.includes('node_modules')) continue - let folder = dirname(resolve(root, input)) - while (!existsSync(join(folder, 'package.json')) || !JSON.parse(await readFile(join(folder, 'package.json'), 'utf8')).name) folder = dirname(folder) - if (bundled.has(folder)) continue - const { name, version, license } = JSON.parse(await readFile(join(folder, 'package.json'), 'utf8')) - const licenceFile = ['LICENSE', 'LICENSE.md', 'LICENSE.txt', 'license'].map((file) => join(folder, file)).find((path) => existsSync(path)) - bundled.set(folder, { name, version, license, text: licenceFile ? (await readFile(licenceFile, 'utf8')).trim() : '' }) -} -const packages = [...bundled.values()].sort((a, b) => a.name.localeCompare(b.name)) -await writeFile(join(dist, 'NOTICE.txt'), [ - 'dist/h5p-mcp.mjs carries these packages, bundled, each under its own licence:', - '', - ...packages.map(({ name, version, license }) => ` ${name} ${version}: ${license}`), - '', - ...packages.flatMap(({ name, version, text }) => [`--- ${name} ${version}`, '', text || '(no licence file in the package)', '']) -].join('\n')) -console.log(`dist/h5p-mcp.mjs, with ${packages.map(({ name }) => name).join(', ')} bundled`) diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts index 1e70faf6..9cb70c14 100644 --- a/packages/mcp/tests/server.test.ts +++ b/packages/mcp/tests/server.test.ts @@ -1,18 +1,18 @@ import { access, mkdtemp, readFile, readdir, rm, symlink, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import { basename, join, resolve } from 'node:path' -import { Client } from '@modelcontextprotocol/sdk/client/index.js' -import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js' +import { Client } from '@modelcontextprotocol/client' +import { StdioClientTransport } from '@modelcontextprotocol/client/stdio' import { afterAll, beforeAll, describe, expect, it } from 'vitest' /** - * The server as an app runs it: the bundle the package ships, started over standard input and + * The server as an app runs it: the command the package ships, started over standard input and * output, given one folder, asked through the SDK's own client. The build's rules are the author * package's and tested there; these hold the server to calling them, to its folders, and to its * answers. Each test builds what it needs, under a title of its own. */ -const BUNDLE = resolve(import.meta.dirname, '../dist/h5p-mcp.mjs') +const COMMAND = resolve(import.meta.dirname, '../bin/h5p-mcp.mjs') const SOURCE = { type: 'H5P.TrueFalse', title: 'Boiling point', @@ -40,7 +40,7 @@ beforeAll(async () => { folder = await mkdtemp(join(tmpdir(), 'h5p-mcp-')) elsewhere = await mkdtemp(join(tmpdir(), 'h5p-mcp-elsewhere-')) client = new Client({ name: 'h5p-mcp-test', version: '0' }) - await client.connect(new StdioClientTransport({ command: process.execPath, args: [BUNDLE, '--allow', folder, '--no-open'], stderr: 'pipe' })) + await client.connect(new StdioClientTransport({ command: process.execPath, args: [COMMAND, '--allow', folder, '--no-open'], stderr: 'pipe' })) }) afterAll(async () => { diff --git a/packages/mcp/tsconfig.json b/packages/mcp/tsconfig.json index 788405fd..c3102011 100644 --- a/packages/mcp/tsconfig.json +++ b/packages/mcp/tsconfig.json @@ -13,5 +13,5 @@ "skipLibCheck": true, "checkJs": true }, - "include": ["bin/**/*.mjs", "lib/**/*.mjs", "scripts/**/*.mjs", "tests/**/*.ts"] + "include": ["bin/**/*.mjs", "lib/**/*.mjs", "tests/**/*.ts"] } diff --git a/packages/mcp/vitest.config.ts b/packages/mcp/vitest.config.ts index d6b253c8..14391e58 100644 --- a/packages/mcp/vitest.config.ts +++ b/packages/mcp/vitest.config.ts @@ -1,6 +1,6 @@ import { defineConfig } from 'vitest/config' -// The server runs as its user's app runs it: the bundle, started over standard input and output. +// The server runs as its user's app runs it: the command, started over standard input and output. // A build with its check plays the package in Chromium, which takes seconds. export default defineConfig({ test: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e020076..1d4936d0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -192,25 +192,25 @@ importers: '@missing-elements/h5p-verify': specifier: workspace:^ version: link:../verify + '@modelcontextprotocol/server': + specifier: ^2.4.0 + version: 2.4.0 + zod: + specifier: ^4.6.7 + version: 4.6.7 devDependencies: - '@modelcontextprotocol/sdk': - specifier: ^1.32.2 - version: 1.32.2(zod@4.6.7) + '@modelcontextprotocol/client': + specifier: ^2.4.0 + version: 2.4.0 '@types/node': specifier: ^26.6.6 version: 26.6.6 - esbuild: - specifier: ^0.28.2 - version: 0.28.2 typescript: specifier: ^7.0.2 version: 7.0.2 vitest: specifier: ^5.1.0 version: 5.1.0(@types/node@26.6.6)(@vitest/browser-playwright@5.1.0)(@vitest/ui@5.1.0)(vite@8.3.6(@types/node@26.6.6)(esbuild@0.28.2)) - zod: - specifier: ^4.6.7 - version: 4.6.7 packages/normalize: dependencies: @@ -556,12 +556,6 @@ packages: cpu: [x64] os: [win32] - '@hono/node-server@2.1.9': - resolution: {integrity: sha512-Sk4NQd3GFY0WZWCzndwFMPwJhtD0y9qjsQ+pjID0/03nK9pxyBCUoUHCho8QYBLBVhi0ssL8UkNPHqbgSOFPIQ==} - engines: {node: '>=20'} - peerDependencies: - hono: ^4 || ^5.0.0-0 - '@inquirer/ansi@1.0.2': resolution: {integrity: sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ==} engines: {node: '>=18'} @@ -713,15 +707,17 @@ packages: resolution: {integrity: sha512-8/12nvkR9dlOZIrTKJhqFs0NLTZkJlQrA9hNP68mUmJwuVKJ1DicTDhW3S50OqefpYGFts/GhFpURbwllmEhvw==} engines: {node: '>=20'} - '@modelcontextprotocol/sdk@1.32.2': - resolution: {integrity: sha512-SWsVtH/0vULSQStoZ6xxH2K09Li8fXYTMC64ZeogCdpZ3XSi1eCPOByV1OpuJxuI3OcmHhosDWYyii07tpPsLw==} - engines: {node: '>=18'} - peerDependencies: - '@cfworker/json-schema': ^4.1.1 - zod: ^3.25 || ^4.0 - peerDependenciesMeta: - '@cfworker/json-schema': - optional: true + '@modelcontextprotocol/client@2.4.0': + resolution: {integrity: sha512-LgrD2OphHuG12vfKFKz6SOnq7bKHQmhGJIAYdD+MZBn2npHEyry6uD8zvktodtl5CQM85MO0anUyD9JwmUmxww==} + engines: {node: '>=20'} + + '@modelcontextprotocol/core@2.4.0': + resolution: {integrity: sha512-z8QBKqdfXLPzkLQuG4xp8hrVEMm1PZ1IgxMN2sMbJiFiAKOWXnAzogXn2W4aqIBlP1ea6U5yiqVquvUNM1Cj6Q==} + engines: {node: '>=20'} + + '@modelcontextprotocol/server@2.4.0': + resolution: {integrity: sha512-rgR9yxSaAJ+bcsi/XroT/S2AfPiIWloXAnrdfYSCms9ivVju0ishu/wW0J21Ho6+ZOR1r7RyeRbjiRuF87ix5Q==} + engines: {node: '>=20'} '@napi-rs/keyring-darwin-arm64@1.3.0': resolution: {integrity: sha512-pl76hJvdYUBn6I24bXiOBMA9nbDapo3I5B+f3OorjDU4dUMSypXeKbOVehJe8fhgTiH24flMyTS3aAIy43xegQ==} @@ -752,35 +748,30 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@napi-rs/keyring-linux-arm64-musl@1.3.0': resolution: {integrity: sha512-iIK6JWHXAJqDrEyLY3TmswwloVyt2vj+04TZnew+uSJ9gnDO8EwRbp3/iw3LpWaXiDO7VomGO6y8I0Id8uBZSw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@napi-rs/keyring-linux-riscv64-gnu@1.3.0': resolution: {integrity: sha512-/PGqrwn6EwgtK6vccASSXJRfOSP4vN1F4ASsIQ+7MdrK6hNvAJ1FZPrIuD5gGGdxezo3F++To2Wq7DbuGIeuNQ==} engines: {node: '>= 10'} cpu: [riscv64] os: [linux] - libc: [glibc] '@napi-rs/keyring-linux-x64-gnu@1.3.0': resolution: {integrity: sha512-2PDK1WKWTu9lBGq9VvNEkSlQD3O7YwVpmnyN2M3cy4v7NJ/8gDMd9GXv3G+FVXN13uhp4gnnPBS+ScefmEeD2A==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@napi-rs/keyring-linux-x64-musl@1.3.0': resolution: {integrity: sha512-oJ2HkX8YUo46QBkn0pG+HuIKQNqr523q6vBobCn+P95s4C4K6/kLBqHY/1bg5J4ap31DzsznhnFKcfBNBsjCnw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@napi-rs/keyring-win32-arm64-msvc@1.3.0': resolution: {integrity: sha512-tOd3c/uAaeoE4ycVlmAdSvygz0Zt3zdca6Y7gokBeIbaRDWpjDIUOpU3MvML59XAaqyuKGsVVu0F/DZb1lHPmw==} @@ -845,28 +836,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@node-rs/crc32-linux-arm64-musl@1.10.8': resolution: {integrity: sha512-eS8YXANJLBqdOzf5jCNVEXiDI4wjXVqQybaJextJJINvHhnhhOXPar8402GMagewOxGxYsy4C69G8rBIzqL4cg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@node-rs/crc32-linux-x64-gnu@1.10.8': resolution: {integrity: sha512-DFd0eV47MAykz4PQDcBSlEvY3CtXqPt2gkBpvPngCpOUoIJgEk9tKtPjEgUwLatMkvsy4fEvAg7gckGickOyEw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@node-rs/crc32-linux-x64-musl@1.10.8': resolution: {integrity: sha512-U7fP8FjDQuOb61YoT8EoWDIJ9x40ZrCzM6OcAH1wqYiu9Z94U14S+i8KwTC7YorotGtICdYZ/APn1eI8vNne5w==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@node-rs/crc32-win32-arm64-msvc@1.10.8': resolution: {integrity: sha512-VJezyT9OWnMPnArDR5ok0ARLemiL83LLNYh4MC++oHoLegqzyBllqNlO8fVp2PmczGkn+rfKkZbtG4w3MQ6BbQ==} @@ -937,42 +924,36 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-arm64-musl@1.2.16': resolution: {integrity: sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [musl] '@rolldown/binding-linux-ppc64-gnu@1.2.16': resolution: {integrity: sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [ppc64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-s390x-gnu@1.2.16': resolution: {integrity: sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - libc: [glibc] '@rolldown/binding-linux-x64-gnu@1.2.16': resolution: {integrity: sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [glibc] '@rolldown/binding-linux-x64-musl@1.2.16': resolution: {integrity: sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [musl] '@rolldown/binding-openharmony-arm64@1.2.16': resolution: {integrity: sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==} @@ -1326,25 +1307,10 @@ packages: resolution: {integrity: sha512-WlaVKzdqBK+RF3bdiXZWbdCnvGB6PdO4IHC1mn/2Yfl3bASgqUNegnU3+PNg61iecwoPfUi5BgLUPqBukXpyWw==} engines: {bun: '>=0.7.0', deno: '>=1.0.0', node: '>=18.0.0'} - accepts@2.0.0: - resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} - engines: {node: '>= 0.6'} - agent-base@7.1.4: resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} engines: {node: '>= 14'} - ajv-formats@3.0.1: - resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} - peerDependencies: - ajv: ^8.0.0 - peerDependenciesMeta: - ajv: - optional: true - - ajv@8.20.0: - resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} - ansi-regex@5.0.1: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} @@ -1372,10 +1338,6 @@ packages: resolution: {integrity: sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==} engines: {node: '>=4'} - body-parser@2.4.0: - resolution: {integrity: sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ==} - engines: {node: '>=18'} - boundary@2.0.0: resolution: {integrity: sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==} @@ -1393,10 +1355,6 @@ packages: resolution: {integrity: sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==} engines: {node: '>=18'} - bytes@3.1.2: - resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} - engines: {node: '>= 0.8'} - call-bind-apply-helpers@1.0.2: resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} engines: {node: '>= 0.4'} @@ -1462,36 +1420,12 @@ packages: resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} engines: {node: '>=20'} - content-disposition@2.0.1: - resolution: {integrity: sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==} - engines: {node: '>=18'} - - content-type@1.0.5: - resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} - engines: {node: '>= 0.6'} - - content-type@2.1.0: - resolution: {integrity: sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag==} - engines: {node: '>=18'} - convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} - cookie-signature@1.2.2: - resolution: {integrity: sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==} - engines: {node: '>=6.6.0'} - - cookie@0.7.2: - resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} - engines: {node: '>= 0.6'} - core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - cors@2.8.6: - resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==} - engines: {node: '>= 0.10'} - cross-keychain@1.1.0: resolution: {integrity: sha512-244DWNdGepLKD5vEn3reZqwzZFiE/LD4U+XV9IaXQbtIXKvQkf0VkRaOj/9vPYauPdR12PSGB3U0cE7jJi3WTQ==} engines: {node: '>=18'} @@ -1530,10 +1464,6 @@ packages: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} - depd@2.0.0: - resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} - engines: {node: '>= 0.8'} - dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} @@ -1556,19 +1486,12 @@ packages: resolution: {integrity: sha512-UgGlf8IW75je7HZjNDpJdCv4cGJWIi6yumFdZ0R7A8/CIhQiWUjyGLCxdHpd8bmyD1gnkfUNK0oeOXqUS2cpfQ==} engines: {ecmascript: '>= es5', node: '>=4'} - ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - emoji-regex@10.6.0: resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} - encodeurl@2.0.3: - resolution: {integrity: sha512-mIteYONiEfc4xWf2F1WXovh1c8npzS00vNeiUPdwFF+QlVJni+gNvpQltLMQhob8rew/bWWc/bGTuUr0EUGt0w==} - engines: {node: '>= 0.8'} - entities@9.0.0: resolution: {integrity: sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==} engines: {node: '>=20.19.0'} @@ -1593,16 +1516,9 @@ packages: engines: {node: '>=18'} hasBin: true - escape-html@1.0.3: - resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} - estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} - etag@1.8.1: - resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} - engines: {node: '>= 0.6'} - eventsource-parser@3.1.1: resolution: {integrity: sha512-EKN1vKAMcZ8MlYMpaNuxN6R9yakzH6uajHcHVTqWJzvu5pWw9DyhbP35HH8MVBQ+dZjAfDxk+A8NiR9KWaXiyQ==} engines: {node: '>=18.0.0'} @@ -1615,22 +1531,6 @@ packages: resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} engines: {node: '>=12.0.0'} - express-rate-limit@8.7.4: - resolution: {integrity: sha512-LKBXzX700wz3zAGNNmVnjRI5mEbYkLv7UbMI4+9Xa+JPcg2UZh6AgY/2CZh9RrJjFM5ttC/N1lD+KzyFoZITCw==} - engines: {node: '>= 16'} - peerDependencies: - express: '>= 4.11' - - express@5.3.0: - resolution: {integrity: sha512-qCqy1xSoaugxOD4IVHb1ZWdkvCF2W3aE2okKouWj8VwJ+ztskSiXoBnCSJqfKT+cVPJhuJqe9YLbY425+Zh00g==} - engines: {node: '>= 18'} - - fast-deep-equal@3.1.3: - resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - - fast-uri@3.1.9: - resolution: {integrity: sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ==} - fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -1643,21 +1543,9 @@ packages: fflate@0.8.3: resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==} - finalhandler@2.1.1: - resolution: {integrity: sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==} - engines: {node: '>= 18.0.0'} - flatted@3.4.4: resolution: {integrity: sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==} - forwarded@0.2.0: - resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} - engines: {node: '>= 0.6'} - - fresh@2.0.0: - resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} - engines: {node: '>= 0.8'} - fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -1709,10 +1597,6 @@ packages: hast-util-whitespace@3.0.0: resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==} - hono@4.13.19: - resolution: {integrity: sha512-KmXvQAXwcAHV+muzbIwoJ23niEB5nMoDVr9WcRkU8mvjUECm/1+7v4Jgp7P7a+H6MLFrh+vXrGonGrGS+RQfkA==} - engines: {node: '>=16.9.0'} - hosted-git-info@4.1.0: resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} engines: {node: '>=10'} @@ -1720,10 +1604,6 @@ packages: html-void-elements@3.0.0: resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==} - http-errors@2.0.1: - resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} - engines: {node: '>= 0.8'} - http-proxy-agent@7.0.2: resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} engines: {node: '>= 14'} @@ -1742,14 +1622,6 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} - ip-address@10.7.6: - resolution: {integrity: sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==} - engines: {node: '>= 12'} - - ipaddr.js@1.9.1: - resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} - engines: {node: '>= 0.10'} - is-ci@2.0.0: resolution: {integrity: sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==} hasBin: true @@ -1780,9 +1652,6 @@ packages: resolution: {integrity: sha512-AX2uU0HW+TxagTgQXOJY7+2fbFHemC7YFBwN1XqD8qQMKdtfbOC8OC3fUb4s5NU59a3662Dzwto8tWDdZYRXxg==} engines: {node: '>=12'} - is-promise@4.0.0: - resolution: {integrity: sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==} - is-unicode-supported@1.3.0: resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} engines: {node: '>=12'} @@ -1808,12 +1677,6 @@ packages: jose@6.2.17: resolution: {integrity: sha512-wOuK9V1yujQFH5S0ZWmLcDZN7+IKh9bUCC2ZPCf2HDlol3WWHy+PPyNjEI75FXRLMp3vDKQcupP59xhVU95hcg==} - json-schema-traverse@1.0.0: - resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} - - json-schema-typed@8.0.2: - resolution: {integrity: sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==} - jsonc-parser@3.3.1: resolution: {integrity: sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==} @@ -1868,28 +1731,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.33.0: resolution: {integrity: sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.33.0: resolution: {integrity: sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.33.0: resolution: {integrity: sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.33.0: resolution: {integrity: sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==} @@ -1951,18 +1810,10 @@ packages: mdast-util-to-hast@13.2.1: resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==} - media-typer@1.1.1: - resolution: {integrity: sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ==} - engines: {node: '>= 0.8'} - meow@14.1.0: resolution: {integrity: sha512-EDYo6VlmtnumlcBCbh1gLJ//9jvM/ndXHfVXIFrZVr6fGcwTUyCTFNTLCKuY3ffbK8L/+3Mzqnd58RojiZqHVw==} engines: {node: '>=20'} - merge-descriptors@2.0.0: - resolution: {integrity: sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==} - engines: {node: '>=18'} - micromark-util-character@2.1.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -1978,14 +1829,6 @@ packages: micromark-util-types@2.0.3: resolution: {integrity: sha512-oxB2Ik03hI0gv+VNn9tnh1t1YEe9MDPptViAEgfdf3YQHsn0pzGTgCdlSCJXcwhqm8phaEuM7zeEu3QQzVBrPg==} - mime-db@1.54.0: - resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} - engines: {node: '>= 0.6'} - - mime-types@3.0.2: - resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} - engines: {node: '>=18'} - mime@1.6.0: resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} engines: {node: '>=4'} @@ -2018,14 +1861,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - negotiator@1.1.0: - resolution: {integrity: sha512-NMPBRMJgiQHjbd8phG3Vebdx4kZ1H121rbl5IkMqeOsahptB9BKo/d7oJ3zTXqTgagn2bWlNSXkh0QUGM31RYg==} - engines: {node: '>=18'} - - object-assign@4.1.1: - resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} - engines: {node: '>=0.10.0'} - object-inspect@1.13.4: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} @@ -2038,13 +1873,6 @@ packages: resolution: {integrity: sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==} engines: {node: '>=12.20.0'} - on-finished@2.4.2: - resolution: {integrity: sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==} - engines: {node: '>= 0.8'} - - once@1.4.0: - resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} - onetime@7.0.0: resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==} engines: {node: '>=18'} @@ -2074,17 +1902,10 @@ packages: parse5@8.1.0: resolution: {integrity: sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==} - parseurl@1.3.3: - resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} - engines: {node: '>= 0.8'} - path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} - path-to-regexp@8.4.2: - resolution: {integrity: sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA==} - pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} @@ -2133,22 +1954,10 @@ packages: property-information@7.2.0: resolution: {integrity: sha512-IAtzIB6sUiWaJYrX9smp3V46pBGbBeLFRGdh25kg1334VcBlD8HzhPeNIWQH9zhGmo2itIe25EHt9dQP7G5hmg==} - proxy-addr@2.0.8: - resolution: {integrity: sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==} - engines: {node: '>= 0.10'} - qs@6.17.1: resolution: {integrity: sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==} engines: {node: '>=0.6'} - range-parser@1.3.0: - resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} - engines: {node: '>= 0.6'} - - raw-body@3.0.2: - resolution: {integrity: sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==} - engines: {node: '>= 0.10'} - read@1.0.7: resolution: {integrity: sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==} engines: {node: '>=0.8'} @@ -2165,10 +1974,6 @@ packages: regex@6.1.0: resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==} - require-from-string@2.0.2: - resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} - engines: {node: '>=0.10.0'} - restore-cursor@5.1.0: resolution: {integrity: sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==} engines: {node: '>=18'} @@ -2182,10 +1987,6 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true - router@2.3.0: - resolution: {integrity: sha512-bpowRfGjEPe8t9R6fJIzhwmyCGAXwKvxBUsgJm+bJukwdcWmUXbMo7p22w7aYmQBPQTUMNqMV39YX0kMou3z8w==} - engines: {node: '>= 18'} - run-applescript@7.1.0: resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} engines: {node: '>=18'} @@ -2208,20 +2009,9 @@ packages: engines: {node: '>=10'} hasBin: true - send@1.2.1: - resolution: {integrity: sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==} - engines: {node: '>= 18'} - - serve-static@2.2.1: - resolution: {integrity: sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==} - engines: {node: '>= 18'} - setimmediate@1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} - setprototypeof@1.2.0: - resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} - shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} engines: {node: '>=8'} @@ -2272,10 +2062,6 @@ packages: space-separated-tokens@2.0.2: resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==} - statuses@2.0.2: - resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} - engines: {node: '>= 0.8'} - std-env@4.3.0: resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==} @@ -2328,10 +2114,6 @@ packages: resolution: {integrity: sha512-LgO3D9yZJjApUiuUfl9iFAwrtaX4+lok3wJIqttGoKCHlWUqHqbQpnxCf82L8FjgKsh4iGo78hqJwgL8F6To2A==} engines: {node: '>=14.0.0'} - toidentifier@1.0.1: - resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} - engines: {node: '>=0.6'} - totalist@3.0.1: resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} engines: {node: '>=6'} @@ -2346,10 +2128,6 @@ packages: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - type-is@2.1.0: - resolution: {integrity: sha512-faYHw0anBbc/kWF3zFTEnxSFOAGUX9GFbOBthvDdLsIlEoWOFOtS0zgCiQYwIskL9iGXZL3kAXD8OoZ4GmMATA==} - engines: {node: '>= 18'} - typed-rest-client@1.8.11: resolution: {integrity: sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==} @@ -2379,20 +2157,12 @@ packages: unist-util-visit@5.2.0: resolution: {integrity: sha512-fpsYs/VVoZxfGY9/j3FQpZmN8wdLJaV1Pt38AaJNZu9uKIHcFU3halCdBveEq1HGKO1OEfJY65w1zvoFV1b3qQ==} - unpipe@1.0.0: - resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} - engines: {node: '>= 0.8'} - url-join@4.0.1: resolution: {integrity: sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==} util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - vary@1.1.2: - resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} - engines: {node: '>= 0.8'} - version-range@4.15.0: resolution: {integrity: sha512-Ck0EJbAGxHwprkzFO966t4/5QkRuzh+/I1RxhLgUKKwEn+Cd8NwM60mE3AqBZg5gYODoXW0EFsQvbZjRlvdqbg==} engines: {node: '>=4'} @@ -2501,9 +2271,6 @@ packages: resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==} engines: {node: '>=8'} - wrappy@1.0.2: - resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} - ws@8.22.2: resolution: {integrity: sha512-/rEZ2ejown2N5gxVTHUu9bVVC7ttu0/Tgzf5hbTOixR3Fs7mbbXgn2DbdbcKgJOmpQMtrIUWivtYuVMnp/W/yA==} engines: {node: '>=10.0.0'} @@ -2546,11 +2313,6 @@ packages: resolution: {integrity: sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw==} engines: {node: '>=18'} - zod-to-json-schema@3.25.2: - resolution: {integrity: sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==} - peerDependencies: - zod: ^3.25.28 || ^4 - zod@4.6.7: resolution: {integrity: sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==} @@ -2726,10 +2488,6 @@ snapshots: '@esbuild/win32-x64@0.28.2': optional: true - '@hono/node-server@2.1.9(hono@4.13.19)': - dependencies: - hono: 4.13.19 - '@inquirer/ansi@1.0.2': {} '@inquirer/checkbox@4.3.2(@types/node@26.6.6)': @@ -2871,27 +2629,24 @@ snapshots: '@zip.js/zip.js': 2.24.0 h5p-standalone: 3.8.2 - '@modelcontextprotocol/sdk@1.32.2(zod@4.6.7)': + '@modelcontextprotocol/client@2.4.0': dependencies: - '@hono/node-server': 2.1.9(hono@4.13.19) - ajv: 8.20.0 - ajv-formats: 3.0.1(ajv@8.20.0) - content-type: 1.0.5 - cors: 2.8.6 + '@modelcontextprotocol/core': 2.4.0 cross-spawn: 7.0.6 eventsource: 3.0.7 eventsource-parser: 3.1.1 - express: 5.3.0 - express-rate-limit: 8.7.4(express@5.3.0) - hono: 4.13.19 jose: 6.2.17 - json-schema-typed: 8.0.2 pkce-challenge: 5.0.1 - raw-body: 3.0.2 zod: 4.6.7 - zod-to-json-schema: 3.25.2(zod@4.6.7) - transitivePeerDependencies: - - supports-color + + '@modelcontextprotocol/core@2.4.0': + dependencies: + zod: 4.6.7 + + '@modelcontextprotocol/server@2.4.0': + dependencies: + '@modelcontextprotocol/core': 2.4.0 + zod: 4.6.7 '@napi-rs/keyring-darwin-arm64@1.3.0': optional: true @@ -3355,24 +3110,8 @@ snapshots: '@zip.js/zip.js@2.24.0': {} - accepts@2.0.0: - dependencies: - mime-types: 3.0.2 - negotiator: 1.1.0 - agent-base@7.1.4: {} - ajv-formats@3.0.1(ajv@8.20.0): - optionalDependencies: - ajv: 8.20.0 - - ajv@8.20.0: - dependencies: - fast-deep-equal: 3.1.3 - fast-uri: 3.1.9 - json-schema-traverse: 1.0.0 - require-from-string: 2.0.2 - ansi-regex@5.0.1: {} ansi-regex@6.4.0: {} @@ -3394,20 +3133,6 @@ snapshots: dependencies: editions: 6.22.0 - body-parser@2.4.0: - dependencies: - bytes: 3.1.2 - content-type: 2.1.0 - debug: 4.4.3 - http-errors: 2.0.1 - iconv-lite: 0.7.3 - on-finished: 2.4.2 - qs: 6.17.1 - raw-body: 3.0.2 - type-is: 2.1.0 - transitivePeerDependencies: - - supports-color - boundary@2.0.0: {} brace-expansion@5.0.12: @@ -3422,8 +3147,6 @@ snapshots: dependencies: run-applescript: 7.1.0 - bytes@3.1.2: {} - call-bind-apply-helpers@1.0.2: dependencies: es-errors: 1.3.0 @@ -3470,25 +3193,10 @@ snapshots: commander@14.0.3: {} - content-disposition@2.0.1: {} - - content-type@1.0.5: {} - - content-type@2.1.0: {} - convert-source-map@2.0.0: {} - cookie-signature@1.2.2: {} - - cookie@0.7.2: {} - core-util-is@1.0.3: {} - cors@2.8.6: - dependencies: - object-assign: 4.1.1 - vary: 1.1.2 - cross-keychain@1.1.0(@types/node@26.6.6): dependencies: '@inquirer/prompts': 7.10.1(@types/node@26.6.6) @@ -3529,8 +3237,6 @@ snapshots: has-property-descriptors: 1.0.2 object-keys: 1.1.1 - depd@2.0.0: {} - dequal@2.0.3: {} detect-libc@2.1.2: {} @@ -3553,14 +3259,10 @@ snapshots: dependencies: version-range: 4.15.0 - ee-first@1.1.1: {} - emoji-regex@10.6.0: {} emoji-regex@8.0.0: {} - encodeurl@2.0.3: {} - entities@9.0.0: {} es-define-property@1.0.1: {} @@ -3602,14 +3304,10 @@ snapshots: '@esbuild/win32-ia32': 0.28.2 '@esbuild/win32-x64': 0.28.2 - escape-html@1.0.3: {} - estree-walker@3.0.3: dependencies: '@types/estree': 1.0.10 - etag@1.8.1: {} - eventsource-parser@3.1.1: {} eventsource@3.0.7: @@ -3618,74 +3316,14 @@ snapshots: expect-type@1.4.0: {} - express-rate-limit@8.7.4(express@5.3.0): - dependencies: - debug: 4.4.3 - express: 5.3.0 - ip-address: 10.7.6 - transitivePeerDependencies: - - supports-color - - express@5.3.0: - dependencies: - accepts: 2.0.0 - body-parser: 2.4.0 - content-disposition: 2.0.1 - content-type: 2.1.0 - cookie: 0.7.2 - cookie-signature: 1.2.2 - debug: 4.4.3 - depd: 2.0.0 - encodeurl: 2.0.3 - escape-html: 1.0.3 - etag: 1.8.1 - finalhandler: 2.1.1 - fresh: 2.0.0 - http-errors: 2.0.1 - merge-descriptors: 2.0.0 - mime-types: 3.0.2 - on-finished: 2.4.2 - once: 1.4.0 - parseurl: 1.3.3 - proxy-addr: 2.0.8 - qs: 6.17.1 - range-parser: 1.3.0 - router: 2.3.0 - send: 1.2.1 - serve-static: 2.2.1 - statuses: 2.0.2 - type-is: 2.1.0 - vary: 1.1.2 - transitivePeerDependencies: - - supports-color - - fast-deep-equal@3.1.3: {} - - fast-uri@3.1.9: {} - fdir@6.5.0(picomatch@4.0.7): optionalDependencies: picomatch: 4.0.7 fflate@0.8.3: {} - finalhandler@2.1.1: - dependencies: - debug: 4.4.3 - encodeurl: 2.0.3 - escape-html: 1.0.3 - on-finished: 2.4.2 - parseurl: 1.3.3 - statuses: 2.0.2 - transitivePeerDependencies: - - supports-color - flatted@3.4.4: {} - forwarded@0.2.0: {} - - fresh@2.0.0: {} - fsevents@2.3.3: optional: true @@ -3750,22 +3388,12 @@ snapshots: dependencies: '@types/hast': 3.0.5 - hono@4.13.19: {} - hosted-git-info@4.1.0: dependencies: lru-cache: 6.0.0 html-void-elements@3.0.0: {} - http-errors@2.0.1: - dependencies: - depd: 2.0.0 - inherits: 2.0.4 - setprototypeof: 1.2.0 - statuses: 2.0.2 - toidentifier: 1.0.1 - http-proxy-agent@7.0.2: dependencies: agent-base: 7.1.4 @@ -3788,10 +3416,6 @@ snapshots: inherits@2.0.4: {} - ip-address@10.7.6: {} - - ipaddr.js@1.9.1: {} - is-ci@2.0.0: dependencies: ci-info: 2.0.0 @@ -3812,8 +3436,6 @@ snapshots: dependencies: globalthis: 1.0.4 - is-promise@4.0.0: {} - is-unicode-supported@1.3.0: {} is-unicode-supported@2.1.0: {} @@ -3834,10 +3456,6 @@ snapshots: jose@6.2.17: {} - json-schema-traverse@1.0.0: {} - - json-schema-typed@8.0.2: {} - jsonc-parser@3.3.1: {} jsonwebtoken@9.0.3: @@ -3967,12 +3585,8 @@ snapshots: unist-util-visit: 5.2.0 vfile: 6.0.3 - media-typer@1.1.1: {} - meow@14.1.0: {} - merge-descriptors@2.0.0: {} - micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -3990,12 +3604,6 @@ snapshots: micromark-util-types@2.0.3: {} - mime-db@1.54.0: {} - - mime-types@3.0.2: - dependencies: - mime-db: 1.54.0 - mime@1.6.0: {} mimic-function@5.0.1: {} @@ -4015,26 +3623,12 @@ snapshots: nanoid@3.3.20: {} - negotiator@1.1.0: - dependencies: - content-type: 2.1.0 - - object-assign@4.1.1: {} - object-inspect@1.13.4: {} object-keys@1.1.1: {} obug@3.0.0: {} - on-finished@2.4.2: - dependencies: - ee-first: 1.1.1 - - once@1.4.0: - dependencies: - wrappy: 1.0.2 - onetime@7.0.0: dependencies: mimic-function: 5.0.1 @@ -4087,12 +3681,8 @@ snapshots: dependencies: entities: 9.0.0 - parseurl@1.3.3: {} - path-key@3.1.1: {} - path-to-regexp@8.4.2: {} - pathe@2.0.3: {} pend@1.2.0: {} @@ -4129,25 +3719,11 @@ snapshots: property-information@7.2.0: {} - proxy-addr@2.0.8: - dependencies: - forwarded: 0.2.0 - ipaddr.js: 1.9.1 - qs@6.17.1: dependencies: es-define-property: 1.0.1 side-channel: 1.1.1 - range-parser@1.3.0: {} - - raw-body@3.0.2: - dependencies: - bytes: 3.1.2 - http-errors: 2.0.1 - iconv-lite: 0.7.3 - unpipe: 1.0.0 - read@1.0.7: dependencies: mute-stream: 0.0.8 @@ -4172,8 +3748,6 @@ snapshots: dependencies: regex-utilities: 2.3.0 - require-from-string@2.0.2: {} - restore-cursor@5.1.0: dependencies: onetime: 7.0.0 @@ -4202,16 +3776,6 @@ snapshots: '@rolldown/binding-win32-arm64-msvc': 1.2.16 '@rolldown/binding-win32-x64-msvc': 1.2.16 - router@2.3.0: - dependencies: - debug: 4.4.3 - depd: 2.0.0 - is-promise: 4.0.0 - parseurl: 1.3.3 - path-to-regexp: 8.4.2 - transitivePeerDependencies: - - supports-color - run-applescript@7.1.0: {} safe-buffer@5.1.2: {} @@ -4224,35 +3788,8 @@ snapshots: semver@7.8.5: {} - send@1.2.1: - dependencies: - debug: 4.4.3 - encodeurl: 2.0.3 - escape-html: 1.0.3 - etag: 1.8.1 - fresh: 2.0.0 - http-errors: 2.0.1 - mime-types: 3.0.2 - ms: 2.1.3 - on-finished: 2.4.2 - range-parser: 1.3.0 - statuses: 2.0.2 - transitivePeerDependencies: - - supports-color - - serve-static@2.2.1: - dependencies: - encodeurl: 2.0.3 - escape-html: 1.0.3 - parseurl: 1.3.3 - send: 1.2.1 - transitivePeerDependencies: - - supports-color - setimmediate@1.0.5: {} - setprototypeof@1.2.0: {} - shebang-command@2.0.0: dependencies: shebang-regex: 3.0.0 @@ -4314,8 +3851,6 @@ snapshots: space-separated-tokens@2.0.2: {} - statuses@2.0.2: {} - std-env@4.3.0: {} stdin-discarder@0.2.2: {} @@ -4368,8 +3903,6 @@ snapshots: tinyrainbow@3.2.0: {} - toidentifier@1.0.1: {} - totalist@3.0.1: {} trim-lines@3.0.1: {} @@ -4378,12 +3911,6 @@ snapshots: tunnel@0.0.6: {} - type-is@2.1.0: - dependencies: - content-type: 2.1.0 - media-typer: 1.1.1 - mime-types: 3.0.2 - typed-rest-client@1.8.11: dependencies: qs: 6.17.1 @@ -4440,14 +3967,10 @@ snapshots: unist-util-is: 6.0.1 unist-util-visit-parents: 6.1.0 - unpipe@1.0.0: {} - url-join@4.0.1: {} util-deprecate@1.0.2: {} - vary@1.1.2: {} - version-range@4.15.0: {} vfile-message@4.0.4: @@ -4507,8 +4030,6 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 - wrappy@1.0.2: {} - ws@8.22.2: {} wsl-utils@1.0.1: @@ -4541,10 +4062,6 @@ snapshots: yoctocolors-cjs@2.1.3: {} - zod-to-json-schema@3.25.2(zod@4.6.7): - dependencies: - zod: 4.6.7 - zod@4.6.7: {} zwitch@2.0.4: {} From b227e7bc1a55eb53135704b87f2acc845adfd8b9 Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 10:40:34 +0200 Subject: [PATCH 6/8] feat(mcp): h5p_build shows a source's own fields, which the build checks (#230) h5p_build's source carries the author package's sourceSchema as JSON Schema, so a model writes the authors and the licence right before its first build. Without it, Haiku wrote "authors": ["Unknown"] in 2 of 3 runs that built; with it, in none of 6. The field still takes any object: the build reads a source written another way as it is meant and says every problem at once (#174), where the SDK would refuse it unread. The tool's description no longer lists the fields, which the shape now shows. --- design/author.md | 12 ++++++------ design/mcp.md | 6 ++++++ packages/mcp/lib/server.mjs | 15 ++++++++++++--- packages/mcp/tests/server.test.ts | 9 +++++++++ 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/design/author.md b/design/author.md index a1ef6362..948fbc2c 100644 --- a/design/author.md +++ b/design/author.md @@ -308,12 +308,12 @@ text to the content check's rules, and `apps/skills` plays every example untrust - **A source's own fields are declared once, as `sourceSchema`** (#230). `sourceOf` takes the list of fields from it, holds each field to it and says its message where the field was written; it is the `Source` type, it takes no other field, as a build does not, and it is exported so that a - model can be shown the shape before writing a source. What one field cannot say alone stays in - `sourceOf`: the content type named loosely, a licence written with its version, a version for a - licence that takes none, and fields in the wrong place. Every problem of an author is said at - once, and an author written as a name alone is said with the object to write. It is zod/mini, - 23 kB minified, since a build runs in a page too, where zod's chained API takes 93 kB; JSON - Schema is made where it is shown. + model can be shown the shape before writing a source, as the MCP server shows it for + `h5p_build`'s source. What one field cannot say alone stays in `sourceOf`: the content type + named loosely, a licence written with its version, a version for a licence that takes none, and + fields in the wrong place. Every problem of an author is said at once, and an author written as + a name alone is said with the object to write. It is zod/mini, 23 kB minified, since a build + runs in a page too, where zod's chained API takes 93 kB; JSON Schema is made where it is shown. - **The skill is installed, and its page lists what step 3 fetches.** Claude and ChatGPT install the skill as a zip, and Grok reads the zip attached to a message; reading it by its link was dropped (missing-elements.github.io#42). Since the 0.10.0 pin the organisation's site serves the diff --git a/design/mcp.md b/design/mcp.md index 96a4f0e7..fe397e88 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -20,6 +20,12 @@ web, is #210 and not this. Not `SKILL.md`, whose build routes do not apply here. An app sends the descriptions and the instructions with every message, so they stay under about 1,500 tokens; `server.test.ts` holds them under 6,000 characters. +- **`h5p_build` shows a source's own fields; the build checks them.** Its `source` carries the + author package's `sourceSchema` as JSON Schema (#230), so a model writes the authors and the + licence right before its first build: without it, Haiku wrote `"authors": ["Unknown"]` in 2 of + 3 runs that built, and with it in none of 6. The field takes any object, since the build reads a + source written another way as it is meant and says every problem at once (#174), where the SDK + would refuse it unread. - **The folders: `--allow`, else the app's roots, else Desktop, Documents and Downloads.** A folder the person named when adding the server is their choice and comes first; the app's roots come next, asked on every call, since they change; both are taken as given. The defaults are never diff --git a/packages/mcp/lib/server.mjs b/packages/mcp/lib/server.mjs index 82854d3d..6bef5bcc 100644 --- a/packages/mcp/lib/server.mjs +++ b/packages/mcp/lib/server.mjs @@ -4,7 +4,7 @@ import { basename, dirname, join, resolve } from 'node:path' import { fileURLToPath } from 'node:url' import { McpServer } from '@modelcontextprotocol/server' import { z } from 'zod' -import { SourceError, buildPackage, contentTypes, inside, openPack, publicFetch, schemaOf, sourceType } from '@missing-elements/h5p-author' +import { SourceError, buildPackage, contentTypes, inside, openPack, publicFetch, schemaOf, sourceSchema, sourceType } from '@missing-elements/h5p-author' import { VerifyError, openBrowser, previewPackage, summarize, verifyPackage } from '@missing-elements/h5p-verify' import { defaultFolders, fileStem, rootFolders } from './folders.mjs' @@ -27,12 +27,21 @@ The author and the licence are what the person gave; otherwise the name you know const TYPES = `The H5P content types and how to write a source for one. With no type: the list, and how to write good content. With a type: its notes, a tested example and its fields. Read the type's answer before writing its source.` -const BUILD = `Builds a .h5p package from a source, { type, title, language, license, authors, params }, params holding only what differs from the type's defaults. A file is { "path": ... }, in a folder this server may use or at a web address. Writes the package and its source (.source.json) to output, or under a new name in the first folder it may use. A source with problems is refused, each problem named by its path. With verify (the default), plays the package in a headless browser and reports whether it works.` +const BUILD = `Builds a .h5p package from a source, its params holding only what differs from the type's defaults. A file is { "path": ... }, in a folder this server may use or at a web address. Writes the package and its source (.source.json) to output, or under a new name in the first folder it may use. A source with problems is refused, each problem named by its path. With verify (the default), plays the package in a headless browser and reports whether it works.` const PREVIEW = `Opens a .h5p package in the person's browser in the real player, served from this computer until its tab is closed. Answers with the address.` const LIST_HEAD = `The content types the library pack has, by the name a source's "type" takes. Those marked * have notes and a tested example; for the rest h5p_types gives their fields.` +/** + * A source's own fields as the author package declares them (#230), shown to the app as the shape + * of `source`. The field itself takes any object: the build is the check, which says every problem + * at once and reads a source written another way as it is meant (#174), where the SDK would refuse + * it before the build looked. + */ +const SOURCE = z.toJSONSchema(sourceSchema, { io: 'input' }) +delete SOURCE.$schema + /** @param {string} text */ const answer = (text) => ({ content: [{ type: /** @type {const} */ ('text'), text }] }) /** @param {string} text */ @@ -151,7 +160,7 @@ export async function createServer(options = {}) { title: 'Build an H5P package', description: BUILD, inputSchema: z.object({ - source: z.record(z.string(), z.unknown()).describe('The source, as h5p_types describes it for its type'), + source: z.record(z.string(), z.unknown()).meta({ ...SOURCE, description: 'The source, as h5p_types describes it for its type' }), output: z.string().optional().describe('Leave it out unless the person named a place: a file name, or a path in a folder this server may use'), verify: z.boolean().optional().describe('Play it and report whether it works; default true') }), diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts index 9cb70c14..89a9718c 100644 --- a/packages/mcp/tests/server.test.ts +++ b/packages/mcp/tests/server.test.ts @@ -54,6 +54,11 @@ describe('the server', () => { const { tools } = await client.listTools() expect(tools.map((tool) => tool.name).sort()).toEqual(['h5p_build', 'h5p_preview', 'h5p_types']) expect(client.getInstructions()).toMatch(/h5p_types[\s\S]*h5p_build[\s\S]*h5p_preview/) + // A source's own fields as the author package declares them, before one is written (#230). + expect(tools.find((tool) => tool.name === 'h5p_build')?.inputSchema.properties?.source).toMatchObject({ + required: ['type', 'title', 'language', 'license', 'authors'], + properties: { authors: { items: { required: ['name', 'role'] } } } + }) // What an app sends the model with every message: under about 1,500 tokens at four characters each. expect(JSON.stringify(tools).length + (client.getInstructions()?.length ?? 0)).toBeLessThan(6_000) }) @@ -130,6 +135,10 @@ describe('h5p_build', () => { const answer = await call('h5p_build', { source: { ...SOURCE, title: 'Broken', params: { ...SOURCE.params, correct: 'maybe' } }, verify: false }) expect(answer.isError).toBe(true) expect(textOf(answer)).toMatch(/params\.correct/) + // A source unlike the shape the app is shown reaches the build, which says all it finds at once (#230). + const loose = textOf(await call('h5p_build', { source: { ...SOURCE, title: 'Loose', authors: ['Unknown'], params: { ...SOURCE.params, correct: 'maybe' } }, verify: false })) + expect(loose).toContain('authors[0]: expected an author: write { "name": "Unknown", "role": "Author" }') + expect(loose).toMatch(/params\.correct/) expect(await readdir(folder)).toEqual(before) }) From 77443678dae48290d998d37576f127507265394a Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 11:44:11 +0200 Subject: [PATCH 7/8] docs(mcp): math is drawn by the package's own MathJax, which loads nothing from elsewhere (#226) What cubic found: the README put math beside a hosted video, as loaded wherever it points. The package carries H5P.MathDisplay with MathJax in its folder, and MathJax loads from there. --- packages/mcp/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mcp/README.md b/packages/mcp/README.md index 6afefb3b..34c0675e 100644 --- a/packages/mcp/README.md +++ b/packages/mcp/README.md @@ -53,7 +53,8 @@ The build downloads each picture, video, recording or other file your content na address, and refuses to download from an address on your local network: a guard against a mistaken or planted address, not against a hostile network. A video on YouTube, Vimeo, Panopto or Echo360 is not downloaded: it stays an address, which the player loads wherever it points, as H5P does -anywhere, and so is math. The check and the preview play the package from your computer. Your app +anywhere. Math is drawn by the package's own copy of MathJax, which loads nothing from elsewhere. +The check and the preview play the package from your computer. Your app sends your conversation to its model, as it does without this server. ## Licence From 9a6b1844eca5aeae58bacb9350916e6c167cff3b Mon Sep 17 00:00:00 2001 From: Aleksandr Shevchuk Date: Wed, 18 Nov 2026 11:51:27 +0200 Subject: [PATCH 8/8] fix(mcp): show a source's fields with nothing required or forbidden (#230) What cubic found: the shape put on h5p_build's source carried the schema's required fields and additionalProperties false, so an app that holds a call to the schema could refuse a source the build reads as it is meant (#174), and the build would never say what to write. It now carries the fields' properties only, on a field that takes any object. Haiku built at the first build in 3 of 3 runs on it, authors written right. --- design/mcp.md | 11 ++++++----- packages/mcp/lib/server.mjs | 14 +++++++------- packages/mcp/tests/server.test.ts | 11 ++++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/design/mcp.md b/design/mcp.md index fe397e88..98c4d0cd 100644 --- a/design/mcp.md +++ b/design/mcp.md @@ -21,11 +21,12 @@ web, is #210 and not this. instructions with every message, so they stay under about 1,500 tokens; `server.test.ts` holds them under 6,000 characters. - **`h5p_build` shows a source's own fields; the build checks them.** Its `source` carries the - author package's `sourceSchema` as JSON Schema (#230), so a model writes the authors and the - licence right before its first build: without it, Haiku wrote `"authors": ["Unknown"]` in 2 of - 3 runs that built, and with it in none of 6. The field takes any object, since the build reads a - source written another way as it is meant and says every problem at once (#174), where the SDK - would refuse it unread. + fields of the author package's `sourceSchema` as JSON Schema properties (#230), so a model writes + the authors and the licence right before its first build: without them, Haiku wrote + `"authors": ["Unknown"]` in 2 of 3 runs that built, and with them in none of 9. Nothing is said + to be required or forbidden, and the field takes any object, since the build reads a source + written another way as it is meant and says every problem at once (#174), where the SDK, or an + app that holds a call to the schema, would refuse it unread. - **The folders: `--allow`, else the app's roots, else Desktop, Documents and Downloads.** A folder the person named when adding the server is their choice and comes first; the app's roots come next, asked on every call, since they change; both are taken as given. The defaults are never diff --git a/packages/mcp/lib/server.mjs b/packages/mcp/lib/server.mjs index 6bef5bcc..7bdab705 100644 --- a/packages/mcp/lib/server.mjs +++ b/packages/mcp/lib/server.mjs @@ -34,13 +34,13 @@ const PREVIEW = `Opens a .h5p package in the person's browser in the real player const LIST_HEAD = `The content types the library pack has, by the name a source's "type" takes. Those marked * have notes and a tested example; for the rest h5p_types gives their fields.` /** - * A source's own fields as the author package declares them (#230), shown to the app as the shape - * of `source`. The field itself takes any object: the build is the check, which says every problem - * at once and reads a source written another way as it is meant (#174), where the SDK would refuse - * it before the build looked. + * A source's own fields as the author package declares them (#230), shown to the app as the + * properties of `source`, and nothing more: no field is said to be required and none forbidden. + * The build is the check, which reads a source written another way as it is meant (#174) and says + * every problem at once, where the SDK, or an app holding a call to the schema, would refuse it + * before the build looked. */ -const SOURCE = z.toJSONSchema(sourceSchema, { io: 'input' }) -delete SOURCE.$schema +const SOURCE_PROPERTIES = z.toJSONSchema(sourceSchema, { io: 'input' }).properties /** @param {string} text */ const answer = (text) => ({ content: [{ type: /** @type {const} */ ('text'), text }] }) @@ -160,7 +160,7 @@ export async function createServer(options = {}) { title: 'Build an H5P package', description: BUILD, inputSchema: z.object({ - source: z.record(z.string(), z.unknown()).meta({ ...SOURCE, description: 'The source, as h5p_types describes it for its type' }), + source: z.record(z.string(), z.unknown()).meta({ properties: SOURCE_PROPERTIES, description: 'The source, as h5p_types describes it for its type' }), output: z.string().optional().describe('Leave it out unless the person named a place: a file name, or a path in a folder this server may use'), verify: z.boolean().optional().describe('Play it and report whether it works; default true') }), diff --git a/packages/mcp/tests/server.test.ts b/packages/mcp/tests/server.test.ts index 89a9718c..aac5fd2a 100644 --- a/packages/mcp/tests/server.test.ts +++ b/packages/mcp/tests/server.test.ts @@ -54,11 +54,12 @@ describe('the server', () => { const { tools } = await client.listTools() expect(tools.map((tool) => tool.name).sort()).toEqual(['h5p_build', 'h5p_preview', 'h5p_types']) expect(client.getInstructions()).toMatch(/h5p_types[\s\S]*h5p_build[\s\S]*h5p_preview/) - // A source's own fields as the author package declares them, before one is written (#230). - expect(tools.find((tool) => tool.name === 'h5p_build')?.inputSchema.properties?.source).toMatchObject({ - required: ['type', 'title', 'language', 'license', 'authors'], - properties: { authors: { items: { required: ['name', 'role'] } } } - }) + // A source's own fields as the author package declares them, before one is written (#230), + // with nothing required or forbidden, so no app refuses a source the build would read (#174). + const source = tools.find((tool) => tool.name === 'h5p_build')?.inputSchema.properties?.source as Record + expect(source.properties).toMatchObject({ license: { enum: expect.arrayContaining(['U', 'CC BY']) }, authors: { items: { required: ['name', 'role'] } } }) + expect(source).not.toHaveProperty('required') + expect(source.additionalProperties).not.toBe(false) // What an app sends the model with every message: under about 1,500 tokens at four characters each. expect(JSON.stringify(tools).length + (client.getInstructions()?.length ?? 0)).toBeLessThan(6_000) })