feat(mcp): both servers serve the h5p-author skill over MCP, and the skill builds with their tools (#280)

Merged
AL
8h ago
+185-26

Closes #280.

The h5p-author skill, shared everywhere: both MCP servers now serve it, and wherever the skill sits beside their tools it builds with them.

What changes

  • Both servers serve the skill over MCP. h5p-mcp, h5p-mcp-app and so the Worker declare io.modelcontextprotocol/skills (SEP-2640, Final), answer skills/list and skills/get, and serve skill://h5p-author/: SKILL.md, LICENSE and the .md files under references/, as the author package ships them, and nothing else of the package. It's the SDK's SkillsExtension over files read once at start (skillCatalog in answers.mjs). A chat without the extension sees no change: the instructions and h5p_types stay.
  • Route 0 in the skill (references/build/tools.md). Where the chat has h5p_build or h5p_play, those tools build. The tool's answer is the hand-over: no command, no npm check, no step 4. Step 1 reads an unlisted type's fields with h5p_types where it's there. Step 3's early npm check now says "unless route 0's tools build".
  • The Worker carries the skill. stage.mjs copies SKILL.md and LICENSE beside references/, and wrangler.jsonc adds them to the Text rules. LICENSE has no extension, so it's named exactly.
  • Docs: design/mcp.md and design/author.md (the rules, with the numbers below), plus a paragraph in the mcp README.

The hybrid pattern

This gives the hybrid pattern in full:

  • the logic stays in the MCP servers;
  • the skill reaches an agent in two ways: installed by npx skills add missing-elements/h5p-toolkit --skill h5p-author (.agents/skills/ for Codex, Gemini CLI, Cursor, Copilot and others, .claude/skills/ for Claude Code), or served by the server it's connected to;
  • route 0 keeps either copy from bypassing the tools.

How it was tested

  • SDK client:

    • server.test.ts: skills/list gives skill://h5p-author/SKILL.md, and references/build/tools.md reads.
    • app.test.ts: the capability is declared. skills/list is fetched raw. The resource list equals LICENSE, SKILL.md and every reference .md. SKILL.md reads equal to the package's, and package.json is refused. A host's references must have SKILL.md beside it or it's rejected.
    • mcp: 44/44 tests, and the typecheck passes.
  • Worker: skills/list and every skill resource read equal the local server's (7/7).

  • Skills project: 82/82, front matter included.

  • Haiku in Claude Code, with the skill as files beside a server's tools (the local server's h5p_build or the app server's h5p_play), asked for a True/False question:

    CaseSkill before route 0With route 0
    Not told to use the skillused the tools without opening the skill, 3 of 3same, 5 of 5
    Told to use the skillran npx, tools unused, 3 of 3, $0.007built with the tools, 9 of 9, $0.004

    Two of the first five route-0 runs also ran the npm check first. After the "unless route 0's tools build" wording, none of the next four did.

  • Not seen in a chat yet. Claude Code 2.1.331 has an MCP skills client, but it never called skills/list, on the 2025 protocol or 2026-07-28, on Haiku, Sonnet or Opus. It's behind an internal switch. This is checked again when a chat turns it on.

After merging

  • Redeploy the Worker.
  • Releases, when asked:
    • h5p-author, so the package ships route 0;
    • h5p-mcp, which serves what the installed author package holds.
  • npx skills update -g for global copies.

Summary by cubic

Both MCP servers now serve the h5p-author skill over MCP, and the skill builds with the servers' tools instead of running npm when those tools are present.

  • The local server, the app server, and the Worker serve the skill as the author package ships it — SKILL.md, LICENSE, and references/ — via the Skills extension (SEP-2640); chats without the extension see no change.
  • The skill gains route 0: where the chat has h5p_build or h5p_play, those tools build and their answer is the hand-over, with no command, npm check, or step 4.
  • The skill's files are read once at start, without following links; a missing package means no skill is served, while a host's missing SKILL.md is said at start.
  • Haiku in Claude Code, told to use the skill, now built with the tools in 9/9 runs instead of running npx (3/3 before, at double the cost).