gitmyhub

webmcp-nexus

TypeScript ★ 27 updated 8d ago

面向 WebMCP 标准的非侵入式前端集成套件:写一个普通 TS 函数加一段 JSDoc,即可被任意 MCP 客户端调用 —— 含 SDK、Vite/Webpack 插件与 AI 编码 Skill。

An Alibaba toolkit that lets you turn plain TypeScript functions in a web app into AI-callable tools, so agents like Claude Desktop or Cursor can directly call actions in a running browser app.

TypeScriptReactViteWebpackWebMCPsetup: moderatecomplexity 3/5

WebMCP Nexus is a toolkit from Alibaba that makes it easier to expose web application features as tools that AI agents can call. It is built around WebMCP, a proposed browser standard being developed by Google and Microsoft that lets a web page register callable functions through a browser API so that AI clients running on the same machine can discover and invoke them.

The toolkit has three main parts. A runtime SDK provides two functions: one for registering tools globally when the application starts, and one for registering tools tied to the lifecycle of a specific React component or page. When a component unmounts, its registered tools are automatically removed, preventing agents from calling actions that are no longer available. Build-time plugins for Vite and Webpack read your TypeScript function signatures and JSDoc comments at compile time and generate the JSON Schema describing each tool's parameters, so you do not need to write or maintain that schema by hand.

The result is that a plain TypeScript function with a JSDoc comment becomes callable by AI clients without any additional wrapping. The README is written primarily in Chinese.

An optional integration with a separate relay package lets local AI clients such as Claude Desktop or Cursor connect directly to a running web application in the browser and call its registered tools. The project includes a full demo application showing global query tools, component-level tools, and page-level tools in practice. A built-in debug panel lets you inspect which tools are currently registered and test calls against them. Browser compatibility is handled by a polyfill that loads automatically in browsers that do not yet support the native WebMCP API.

Where it fits