@missing-elements/h5p-mcp 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # H5P Author MCP by Missing Elements
2
2
 
3
3
  `@missing-elements/h5p-mcp` lets an AI app make H5P content on your computer: quizzes, fill in the
4
- blanks, flash cards, presentations, interactive books, branching scenarios and the rest of the 53
4
+ blanks, flash cards, presentations, interactive books, branching scenarios and the rest of the
5
5
  content types the H5P hub serves. It writes a playable `.h5p` that carries its libraries, checks
6
6
  that it plays in a real H5P player, and opens it in your browser. It reads a `.h5p` you have back
7
7
  into its source too, to change it and build it again. No H5P site, server or account.
@@ -44,7 +44,8 @@ gets a number, and it says which.
44
44
 
45
45
  - `h5p_types`: the content types, and how to write a source for one.
46
46
  - `h5p_build`: a package from a source, its source beside it as `.source.json`. A source with
47
- problems is refused, each problem named. It checks the package and says what it holds.
47
+ problems is refused, each problem named. It checks the package, says what it holds, and which
48
+ H5P core a site needs to take it.
48
49
  - `h5p_preview`: opens a package in your browser, in the real player, served from your computer
49
50
  until its tab is closed.
50
51
  - `h5p_read`: a package back into its source, with its pictures and other files, in a new folder
@@ -57,7 +58,8 @@ The build downloads each picture, video, recording or other file your content na
57
58
  address, and refuses to download from an address on your local network: a guard against a mistaken
58
59
  or planted address, not against a hostile network. A video on YouTube, Vimeo, Panopto or Echo360 is
59
60
  not downloaded: it stays an address, which the player loads wherever it points, as H5P does
60
- anywhere. Math is drawn by the package's own copy of MathJax, which loads nothing from elsewhere.
61
+ anywhere. A YouTube or Vimeo address is sent to that site's oEmbed, to ask whether it has the
62
+ video. Math is drawn by the package's own copy of MathJax, which loads nothing from elsewhere.
61
63
  The check and the preview play the package from your computer. Your app
62
64
  sends your conversation to its model, as it does without this server.
63
65
 
package/lib/server.mjs CHANGED
@@ -4,7 +4,7 @@ import { basename, dirname, join, resolve } from 'node:path'
4
4
  import { fileURLToPath } from 'node:url'
5
5
  import { McpServer } from '@modelcontextprotocol/server'
6
6
  import { z } from 'zod'
7
- import { SourceError, buildPackage, contentTypes, inside, openPack, publicFetch, readPackage, schemaOf, sourceSchema, sourceType } from '@missing-elements/h5p-author'
7
+ import { SourceError, buildPackage, contentTypes, coreApiLine, inside, openPack, publicFetch, readPackage, schemaOf, sourceSchema, sourceType } from '@missing-elements/h5p-author'
8
8
  import { VerifyError, openBrowser, previewPackage, summarize, verifyPackage } from '@missing-elements/h5p-verify'
9
9
  import { defaultFolders, fileStem, rootFolders } from './folders.mjs'
10
10
 
@@ -217,7 +217,9 @@ export async function createServer(options = {}) {
217
217
  try {
218
218
  result = await buildPackage(source, target, { base: dirname(target), within: allowed, fetch: publicFetch, libraries: options.libraries })
219
219
  // Made new: a file or a link put at its name since the name was found free is not written through.
220
- unwritten = await writeFile(sourceFile, `${JSON.stringify(source, null, 2)}\n`, { flag: 'wx' }).then(() => undefined, (error) => error)
220
+ // As the build took it, naming the content type's version it was built with (author's #219):
221
+ // for a quiz in the quiz format, the source it was built as, which has the field for it.
222
+ unwritten = await writeFile(sourceFile, `${JSON.stringify(result.source, null, 2)}\n`, { flag: 'wx' }).then(() => undefined, (error) => error)
221
223
  } catch (error) {
222
224
  if (error instanceof SourceError) return refusal(`${error.message}\nFix each at its path and build again.${/outside the folders/.test(error.message) ? ` ${whereFiles(allowed)}` : ''}`)
223
225
  return refusal(error instanceof Error ? error.message : String(error))
@@ -228,6 +230,7 @@ export async function createServer(options = {}) {
228
230
  const media = result.media.length ? `, ${result.media.length} media file${result.media.length === 1 ? '' : 's'}` : ''
229
231
  const lines = [
230
232
  `Built ${target} (${sized((await stat(target)).size)}): ${result.manifest.mainLibrary}, ${result.libraries.length} libraries${install}${media}.`,
233
+ coreApiLine(result.coreApi),
231
234
  unwritten
232
235
  ? `Its source was not written beside it: ${unwritten.message}`
233
236
  : `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.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@missing-elements/h5p-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "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.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@modelcontextprotocol/server": "^2.4.0",
40
40
  "zod": "^4.6.7",
41
- "@missing-elements/h5p-author": "^0.13.0",
42
- "@missing-elements/h5p-verify": "^1.6.0"
41
+ "@missing-elements/h5p-author": "^0.15.0",
42
+ "@missing-elements/h5p-verify": "^1.6.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@modelcontextprotocol/client": "^2.4.0",
@@ -52,6 +52,6 @@
52
52
  },
53
53
  "scripts": {
54
54
  "test": "pnpm --filter @missing-elements/h5p-offline-player build && pnpm --filter @missing-elements/h5p-author exec node scripts/copy-skill.mjs && vitest run",
55
- "typecheck": "tsc -p tsconfig.json"
55
+ "typecheck": "pnpm --filter @missing-elements/h5p-verify --filter @missing-elements/h5p-author run types && tsc -p tsconfig.json"
56
56
  }
57
57
  }