Summary
Integrate the WebMCP specification into the Torrust Index GUI so that AI agents (browser-based or external via MCP clients) can discover and interact with the application's functionality through structured, JavaScript-defined tools.
Note: An alternative (or complementary) approach would be to write a standalone MCP server for the Torrust Index backend API directly. That would let agents interact with the Index without requiring a browser at all. WebMCP is specifically useful when we do want to publish a website and let agents interact with the site alongside the user — for example, an AI assistant helping a user search, upload, or manage torrents within the browser UI. Both approaches are not mutually exclusive and could coexist.
What is WebMCP?
WebMCP is a Draft W3C Community Group specification that defines a JavaScript API (navigator.modelContext) allowing web applications to expose their functionality as tools that can be invoked by AI agents, browser agents, and assistive technologies. A web page implementing WebMCP acts as an MCP server with tools implemented in client-side script.
There is also an open-source polyfill library — webmcp.dev (source) — that works with MCP clients like Claude Desktop today, before browsers ship native support.
Why add this?
- AI-assisted torrent discovery — agents can search for torrents by keyword, category, or tags on behalf of the user.
- AI-assisted uploads — agents can populate and submit the upload form with appropriate metadata.
- Accessibility — assistive technologies leveraging WebMCP can interact with the application programmatically.
- Automation — MCP-compatible clients can interact with a running Torrust Index instance through a standardized protocol.
Proposed Tools
Tools to register via navigator.modelContext.registerTool() (or the polyfill), organized by domain:
Torrent Browsing & Search (read-only)
search_torrents — Search and browse torrents with optional filters (query, category, tags, sort, pagination).
get_torrent_details — Get full details of a torrent by info hash.
list_categories — List all available torrent categories.
list_tags — List all available torrent tags.
Torrent Actions
download_torrent — Download a .torrent file by info hash (read-only; requires auth on private trackers).
get_magnet_link — Get the magnet link for a torrent (read-only).
upload_torrent — Upload a new torrent with metadata (requires auth + terms acceptance).
edit_torrent — Edit a torrent's metadata (requires auth; must be uploader or admin).
delete_torrent — Delete a torrent (requires auth; must be uploader or admin).
Authentication & User
get_current_user — Get current authentication status and user info (read-only).
sign_in — Sign in with username and password.
sign_up — Register a new user account.
change_password — Change the current user's password.
Admin (register only when user is admin)
admin_add_category / admin_delete_category — Manage torrent categories.
admin_add_tag / admin_delete_tag — Manage torrent tags.
admin_get_settings — Get backend settings (read-only).
Implementation Notes
- Create a Nuxt client-side plugin (
plugins/webmcp.client.ts) that registers tools on app load, calling the existing Rest API client.
- Dynamically register/unregister tools based on authentication and admin state.
- Use
requestUserInteraction() for destructive or sensitive operations (delete, upload review, sign-in confirmation).
- Feature-detect
navigator.modelContext for native browser support, falling back to the polyfill.
- The feature should be toggleable via configuration.
References
Summary
Integrate the WebMCP specification into the Torrust Index GUI so that AI agents (browser-based or external via MCP clients) can discover and interact with the application's functionality through structured, JavaScript-defined tools.
What is WebMCP?
WebMCP is a Draft W3C Community Group specification that defines a JavaScript API (
navigator.modelContext) allowing web applications to expose their functionality as tools that can be invoked by AI agents, browser agents, and assistive technologies. A web page implementing WebMCP acts as an MCP server with tools implemented in client-side script.There is also an open-source polyfill library — webmcp.dev (source) — that works with MCP clients like Claude Desktop today, before browsers ship native support.
Why add this?
Proposed Tools
Tools to register via
navigator.modelContext.registerTool()(or the polyfill), organized by domain:Torrent Browsing & Search (read-only)
search_torrents— Search and browse torrents with optional filters (query, category, tags, sort, pagination).get_torrent_details— Get full details of a torrent by info hash.list_categories— List all available torrent categories.list_tags— List all available torrent tags.Torrent Actions
download_torrent— Download a.torrentfile by info hash (read-only; requires auth on private trackers).get_magnet_link— Get the magnet link for a torrent (read-only).upload_torrent— Upload a new torrent with metadata (requires auth + terms acceptance).edit_torrent— Edit a torrent's metadata (requires auth; must be uploader or admin).delete_torrent— Delete a torrent (requires auth; must be uploader or admin).Authentication & User
get_current_user— Get current authentication status and user info (read-only).sign_in— Sign in with username and password.sign_up— Register a new user account.change_password— Change the current user's password.Admin (register only when user is admin)
admin_add_category/admin_delete_category— Manage torrent categories.admin_add_tag/admin_delete_tag— Manage torrent tags.admin_get_settings— Get backend settings (read-only).Implementation Notes
plugins/webmcp.client.ts) that registers tools on app load, calling the existingRestAPI client.requestUserInteraction()for destructive or sensitive operations (delete, upload review, sign-in confirmation).navigator.modelContextfor native browser support, falling back to the polyfill.References