feat(web): add WebMCP support to c0mpute.com#14
Merged
Conversation
Register JavaScript tools on document.modelContext so AI agents visiting the site can query the network and plugin catalogue directly, per the WebMCP draft spec (https://webmachinelearning.github.io/webmcp/). Tools: c0mpute_list_plugins, c0mpute_network_status, c0mpute_latest_release, c0mpute_install_command — each backed by an existing public endpoint. Adds a /api/plugins JSON route since the plugin catalogue was build-time only. Feature-detected and degrades to a no-op in agents/browsers that don't implement WebMCP. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds WebMCP support to c0mpute.com. WebMCP lets a web page expose JavaScript "tools" that an in-browser AI agent can discover and invoke via
document.modelContext.registerTool(...), instead of scraping the rendered page.A client-side provider mounted in the root layout registers four tools, each backed by an existing public endpoint:
c0mpute_list_plugins— plugin/module catalogue (transcode, coinpay, infernet, …) with install commandsc0mpute_network_status— live workers online / jobs in flight / 24h throughput / latencyc0mpute_latest_release— CLI release manifest (version, channel, per-platform artifacts)c0mpute_install_command— install command for the CLI or a specific plugin idChanges
apps/web/src/components/webmcp-provider.tsx— client component; feature-detectsdocument.modelContext/navigator.modelContext, supports both theregisterTooland olderprovideContext({tools})shapes, returns MCP text-content results, unregisters on unmountapps/web/src/app/api/plugins/route.ts— new/api/pluginsJSON endpoint (the plugin catalogue was build-time only; the client tool needs something fetchable)apps/web/src/types/webmcp.d.ts— ambient types for the draft API (not inlib.domyet)apps/web/src/app/layout.tsx— mounts<WebMcpProvider />Behavior
WebMCP is an emerging, unshipped spec, so everything is behind a feature-detect and degrades to a no-op in agents/browsers that don't implement it — zero visible change for regular visitors.
Verification
tsc --noEmitpasses clean/api/pluginsreturns 21 plugins,/api/statusserves live data the tool wraps, homepage renders 200 with the WebMCP bundle loaded🤖 Generated with Claude Code