Improve consistency and organization of examples for AI learning

- Add `.gitignore` files to all 19 examples (`node_modules/`, `dist/`)
- Replace custom `log` objects with standard `console` methods
- Add `ontoolcancelled` handler to all `basic-server-*` examples
- Add host styling integration (`applyDocumentTheme`, `applyHostFonts`,
  `applyHostStyleVariables`) to non-React `basic-server-*` examples
- Add section headers for better code organization in feature examples
- Update READMEs with Build System section explaining single-file
  bundling

These changes make examples more consistent and easier to adapt.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jonathan Hefner 2026-01-12 17:06:44 -06:00
commit 4140565b77

View file

@ -62,8 +62,11 @@ function createServer(): McpServer {
version: "1.0.0",
});
// Register video resource template
// This fetches video from CDN and returns as base64 blob
// ===========================================================================
// Binary Blob Resource - Binary content is fetched and returned as a
// base64-encoded blob.
// ===========================================================================
server.registerResource(
"video",
new ResourceTemplate("videos://{id}", { list: undefined }),
@ -109,7 +112,10 @@ function createServer(): McpServer {
},
);
// Register the video player tool
// ===========================================================================
// Tool Registration
// ===========================================================================
registerAppTool(
server,
"play_video",
@ -147,7 +153,10 @@ ${Object.entries(VIDEO_LIBRARY)
},
);
// Register the MCP App resource (the UI)
// ===========================================================================
// UI Resource Registration
// ===========================================================================
registerAppResource(
server,
RESOURCE_URI,