Add WebMCP support#62
Merged
Merged
Conversation
Registers three tools via navigator.modelContext (WebMCP API): - list_snippets: returns all snippet metadata without code - get_snippet: returns full code for a snippet by ID - search_snippets: filters by category and/or keyword The snippets registry is loaded as a dynamic import so it is only fetched when the browser supports WebMCP, with no cost for unsupported browsers.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adds a PostToolUse hook that lints JS/JSX files after Claude edits them. The custom rule warns when a file has static non-framework imports alongside a navigator feature guard, suggesting a dynamic import should be used instead.
…in.js on every page visit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
navigator.modelContextWebMCP API so AI agents can discover and use the snippets in a structured waylist_snippets— returns all snippet metadata (id, category, title, description, url) without codeget_snippet— returns the full JavaScript code for a snippet by IDsearch_snippets— filters snippets by category and/or keywordThe snippets registry is loaded as a dynamic import, so it is only fetched when the browser supports WebMCP (
navigator.modelContextexists). Browsers without support incur zero cost.While validating the correct loading of the WebMCP registry chunk,
cld-video-player.min.js(Cloudinary's video player library) was detected loading on every homepage visit. This has been addressed by lazy-loadingCldVideoPlayer— the script only loads when the user explicitly clicks play.Test plan
navigator.modelContextis availablelist_snippetsand confirm all 31 snippets are returnedget_snippetwith a valid ID (e.g."LCP") and confirm code is returnedsearch_snippetswith{ category: "CoreWebVitals" }and confirm filtered resultscld-video-player.min.jsdoes NOT appear in the Network tabcld-video-player.min.jsloads and the video plays