Feature: WebMCP support#7
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds WebMCP support to the vector search web demo, enabling AI agents to discover and invoke a semantic search tool through two transport mechanisms: the WebMCP browser API (navigator.modelContext) and an iframe-based MCP transport for embedding in other applications. The PR also migrates CDN imports from esm.sh to jsdelivr.net and upgrades ESLint/Prettier tooling.
Changes:
- Added WebMCP tool registration (
webmcp.js) and iframe MCP transport server (iframe-server.js) sharing a centralized tool definition (tool-defs.js) that wraps the existingsearchPostsfunction - Migrated all CDN module imports from esm.sh to jsdelivr.net, added import map overrides for React version deduplication, and added WebGPU acceleration support for the embedding model
- Upgraded ESLint to v10, added
@eslint/jsas an explicit dependency, upgraded Prettier to v3.8.1, and addedmaxChunksparameter support tosearchPosts
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
public/index.html |
Migrated import map from esm.sh to jsdelivr, added @mcp-b/transports import and React version overrides, added WebMCP and iframe server initialization scripts |
public/app/data/webmcp.js |
New file: registers the search tool with the WebMCP browser API after checking for Chrome 146+ support |
public/app/data/tool-defs.js |
New file: centralized MCP tool schema and executeSearch wrapper shared between WebMCP and iframe transport |
public/app/data/iframe-server.js |
New file: MCP iframe transport server using JSON-RPC 2.0 for embedding in iframes |
public/app/data/search.js |
Added WebGPU acceleration for embeddings, maxChunks parameter, memory cleanup via dispose(), and navigator global declaration |
public/app/components/forms.js |
Exported POST_TYPE_OPTIONS and commented out service post type |
package.json |
Added @eslint/js, upgraded eslint to v10, upgraded prettier to v3.8.1 |
package-lock.json |
Lock file updates for dependency upgrades |
docs/webmcp.md |
New documentation for WebMCP integration including tool schema, demo instructions, and example queries |
.playwright-mcp/vector-search-demo.png |
Screenshot for documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
webmcp.js) and iframe MCP transport server (iframe-server.js) sharing a centralized tool definition (tool-defs.js) that wraps the existingsearchPostsfunctionmaxChunksparameter support tosearchPosts