Webmcp Sdkのロゴ

Webmcp Sdk

組織
opentiny

OpenTiny NEXT-SDKs is a front-end AI and browser automation toolkit. It implements WebMCP + WebSkills to build AI-native apps, and leverages webmcp-cli to enable LLM agents to remote-control any webpage without source code modifications. OpenTiny NEXT-SDKs 是一套前端 AI 与浏览器自动化工具包。它通过 WebMCP + WebSkills 协议构建 AI 原生应用,并利用 webmcp-cli 实现了无需修改源码即可让大模型代理自动控制任

公開者opentiny
リポジトリwebmcp-sdk
言語TypeScript
フォーク
22
スター
120
利用可能なツール
0
通信方式stdio
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Webmcp Sdkは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには120件のスターと22件のフォークがあります。

OpenTiny NEXT-SDKs: Built-in WebMCP & Polyfill + WebSkills + WebAgent

English | 简体中文

Ask DeepWiki

Next-Gen AI Protocol: OpenTiny NEXT-SDKs is built on the WebMCP (Model Context Protocol for Web). It is fully compatible with the native document.modelContext API (currently in experimental stage in browsers like Chrome), allowing your web apps to be controlled by AI via a standardized protocol.

[!TIP] ✨ Command-line Automation & AI Skills: We now offer webmcp-cli (browser control & polyfill auto-injection CLI) and webmcp-skill (standard instructions and sub-skills like Excalidraw drawing for AI agents). Together, they enable AI agents to perform complex, fine-grained tasks and "remote-drive" any webpage out of the box.


OpenTiny NEXT-SDKs is a front-end intelligent application development and browser automation toolkit. Beyond enabling the "WebMCP + WebSkills" model to expose page operations as standardized tools in just a few lines of code, it features webmcp-cli (browser perception and control) and webmcp-skill (agent skills library). Combined with our Polyfill, not only can you build future-proof AI-Native apps in today's browsers, but you can also let AI agents automatically perceive and control any webpage with zero source code modifications.

📑 Table of Contents

✨ Main Features

  • 🔌 Standard WebMCP Implementation: Fully implements the browser version of the MCP protocol, making front-ends "AI-Callable" via a unified standard.
  • 📡 Remote AI Control: Connect seamlessly to WebAgent services, allowing AI to easily and stably call your front-end tools remotely.
  • 🛠️ Built-in Polyfill Support: Provides document.modelContext / document.modelContext patches for current browsers, ensuring today's code works seamlessly and transitions to native support in the future.
  • 🎯 Zero-Refactor Intelligence: Expose business logic and UI operations as tools without changing your app's core architecture.
  • 🧩 WebSkills Abstraction: Organizes tools into "Business Skills" for progressive disclosure.
  • 🤖 AI Chat Components: Provides out-of-the-box @opentiny/next-remoter for an instant AI remote controller.

🌐 WebMCP & Polyfill

What is WebMCP?

WebMCP is an extension of the Model Context Protocol specifically for web browsers. It defines how a web page provides "Tools" and "Resources" to AI agents. In the near future, browsers will provide a native document.modelContext object to manage these capabilities.

Why Polyfill?

Since native APIs are still experimental, OpenTiny NEXT-SDKs provides a powerful Polyfill. By calling initializeBuiltinWebMCP(), the SDK will:

  1. Injects document.modelContext: Provides a standard-compliant API for tool registration. By default it forces the JS polyfill (forcePolyfill: true) over Chromium's experimental native implementation, which can crash the renderer on getTools(). Pass { forcePolyfill: false } only when native WebMCP is confirmed stable.
  2. Automated Routing & Bridging: Automatically handles message synchronization and tool invocation across different page paths and iframes.

Call this at the page entry (or via registerPageAgentTool()) before registering tools or handing document.modelContext to an Agent.

📡 Cross-Page & Remote Control

One of the core highlights of OpenTiny NEXT-SDKs is its support for "cross-environment controllability" of pages. With the help of the built-in WebMCP Polyfill and @opentiny/next-remoter, you can achieve:

  • Automated Bridging: The underlying layer automatically handles message synchronization and tool invocations across different page paths and iframes.
  • Persistent Session ID: Establish long-term connections with cloud AI orchestrators.
  • Cross-time Collaboration: Even if the user isn't actively interacting, AI can remotely trigger page tools based on instructions sent by the business system.
  • High-level Business Automation: Converts front-end DOM operations and business component APIs into execution units in automated flows, achieving app-level "remote driving".

Connection Example

Through WebMcpClient, we can remotely call and control the built-in WebMCP tools of the browser via a cloud-based web-agent:

typescript
import { WebMcpClient } from '@opentiny/next-sdk'

const client = new WebMcpClient()

// Connect to the WebAgent service
const { sessionId } = await client.connect({
  agent: true,
  builtin: true, // Enable built-in WebMCP proxy
  url: 'https://agent.opentiny.design/api/v1/webmcp-trial/mcp'
})

console.log('Connected! Session ID:', sessionId)
// Now your app can be controlled remotely via this sessionId

[!TIP] The URL above is a public test server provided by OpenTiny for testing purposes. For production use, you should deploy your own WebAgent instance. Source code: https://github.com/opentiny/web-agent

🚀 Quick Start

Turn your front-end application into an AI-capable one in just a few lines of code.

Step 1: Install Dependencies

bash
npm install @opentiny/next-sdk

Step 2: Initialize WebMCP Polyfill (Recommended)

Add this to your application's entry point (e.g., main.ts or app.js):

typescript
import { initializeBuiltinWebMCP } from '@opentiny/next-sdk'

// Initialize Polyfill and Bridging Mechanism
initializeBuiltinWebMCP()

Now, you can use the standard document.modelContext anywhere in your app to register tools:

typescript
// Register a tool that can be called by AI
const abortController = new AbortController()

document.modelContext.registerTool({
  name: 'get_user_info',
  description: 'Get current user information',
  inputSchema: {
    type: 'object',
    properties: {
      userId: { type: 'string' }
    }
  },
  execute: async (args) => {
    // Write your business logic here
    return { content: [{ type: 'text', text: `Info for user ${args.userId}...` }] }
  }
}, { signal: abortController.signal })

// To unregister the tool when it's no longer needed, simply call abort()
// abortController.abort()

✅ Done! Your app is now an MCP Server. You can connect it to any MCP-compatible client or use our TinyRemoter to chat with the app directly.

📦 Core Packages

@opentiny/next-sdk (Current Package)

The core SDK package, providing:

  • Built-in WebMCP Polyfill: Injects document.modelContext and sets up the bridging mechanism for seamless AI-to-page communication.
  • WebMcpServer: Managed MCP server for full control over lifecycle and transport layers.
  • WebMcpClient: MCP client for connecting to WebAgent or other remote services.
  • WebAgent: High-level intelligent agent orchestration logic.
  • Transport Layer: Support for MessageChannel, SSE, HTTP, and Chrome Extension messaging.

@opentiny/next-remoter

Vue3 AI chat component based on TinyRobot, providing:

  • Integrated AI assistant UI.
  • MCP Plugin marketplace.
  • Dynamic WebSkills discovery and execution.

@opentiny/webmcp-cli

A CLI tool based on puppeteer-core used to control Chrome browsers and expose WebMCP interfaces:

  • Browser Takeover: Automatically starts or connects to a local Chrome with debugging ports via Chrome DevTools Protocol (CDP).
  • Auto-Injection: When browser tabs open, it detects and automatically injects the WebMCP polyfill and page manipulation tools (page-agent-tool).
  • Unified Tool Protocol: Maps page operations to standard MCP interfaces, allowing AI agents to call them directly.

webmcp-skill

Guidelines and domain-specific skills for third-party AI agents interacting with web pages:

  • Prompt Optimization: Built-in comprehensive system prompts and usage specifications to assist external LLM agents in accurately using the CLI to control pages.
  • Domain-Specific Skills: Provides sub-skills like Excalidraw canvas commands (excalidraw_execute_command) for high-difficulty granular web operations.

💻 WebMCP CLI & Agent Skills

With the WebMCP CLI, you can treat the browser as an MCP server, directly exposing page manipulation interfaces to AI Agents. Running Puppeteer in the background to drive a real Chrome browser, it maps traditional page interactions (click, input, scroll, etc.) into standard MCP Tool calls.

🚀 Getting Started

1. Installation

You can install it globally via NPM:

bash
npm install -g @opentiny/webmcp-cli

Or for local debugging within the current Monorepo:

bash
cd packages/webmcp-cli
pnpm build
npm install -g .

2. Open a Webpage

Navigate to a specific URL in Chrome and prepare the environment:

bash
webmcp-cli tabs open https://excalidraw.com

3. Get Browser State

View the current page state, including URL, title, open tabs, and the list of automatically injected and native MCP tools. It also returns an indexed DOM tree:

bash
webmcp-cli state

The output will include elements like [18]<button>Search</button> with their index and the corresponding MCP interface names.

4. Execute an MCP Tool

Use JSON-formatted arguments to directly execute registered MCP tools on the page:

bash
# Click a button with DOM index 18
webmcp-cli run page-agent-tool '{"action": "click", "index": 18}'

# Fill text into an input field with DOM index 13
webmcp-cli run page-agent-tool '{"action": "fill", "index": 13, "text": "Model Context Protocol"}'

🧠 Agent Skill Guidelines

In the packages/webmcp-skill directory, we have defined a set of standard Agent Skills. When LLMs (like Claude or Gemini) connect to a webpage as an agent, they read SKILL.md to learn how to properly issue CLI commands.

For complex pages, we also pair them with domain-specific sub-skills:

  • Excalidraw Canvas Tools (domains/excalidraw.md): Instructs the Agent to use excalidraw_execute_command to draw shapes and diagrams when the URL contains excalidraw.com.
  • Baidu Search Tool: Guides the Agent to automatically issue searches and pull page results.

This gives NEXT-SDKs a complete ecosystem enabling external AI to autonomously "remote drive" any webpage.


💡 Core Concepts

WebMCP Bridge Architecture

Unlike traditional backend MCP, WebMCP focuses on the Browser Context.

text
┌─────────────────────────────────────────────────────────────┐
│                       Web Browser                           │
│  ┌──────────────────┐              ┌───────────────────┐    │
│  │   Front-end App  │◄── Bridging ──►│   AI Assistant    │    │
│  │  (WebMCP Server) │   Mechanism    │   (MCP Client)    │    │
│  └──────────────────┘              └───────────────────┘    │
│           ▲                                  │              │
└───────────┼──────────────────────────────────┼──────────────┘
            │        (Standard Protocol)       │
            └──────────────────────────────────┘
  1. Register Tools: Use document.modelContext.registerTool to declare your app's capabilities, with support for automatic unregistration via AbortSignal.
  2. Bridge Synchronization: Our bridging mechanism automatically routes AI requests to the correct page or iframe, even if the user has switched pages.
  3. Direct Execution: Tools run directly in the page environment, allowing access to the DOM, component state, and local APIs.

Underlying Transport and Engine Layer

Although you can simply use document.modelContext.registerTool for daily development, NEXT-SDKs retains the full core MCP protocol implementation internally for advanced scheduling:

  • WebMcpServer / WebMcpClient: Responsible for handling underlying JSON-RPC messages, Schema validation, and channel handshakes. It is recommended to only understand these when expanding infrastructure; business apps should avoid calling them directly.

📖 Scenarios

  • 🤝 Smart Customer Service: Quickly build an AI customer service system that supports tool calls.
  • 📚 Doc Assistant: Add intelligent Q&A functionality to documentation websites.
  • 🛠️ Dev Tools: Build developer auxiliary tools that support code generation and analysis.
  • 🌐 Browser Extensions: Develop browser plugins with AI capabilities.
  • 🏢 Enterprise Apps: Add intelligent capabilities to enterprise applications.
  • 📊 Data Analysis: Build intelligent data analysis and visualization applications.
  • ✍️ Content Creation: Develop AI-assisted content creation tools.

🛠️ Contributing

We welcome all forms of contribution! Whether it's reporting bugs, suggesting new features, improving documentation, or submitting code, we appreciate it.

Prerequisites

Before you start developing, please make sure your environment meets the following requirements:

  • Node.js >= 18.0.0
  • pnpm >= 8.0.0
  • Git Latest version

Get the Code

bash
# Clone the repository
git clone https://github.com/opentiny/next-sdk.git
cd next-sdk

# Install dependencies
pnpm install

Project Structure

text
next-sdk/
├── packages/
│   ├── next-sdk/              # Core SDK package
│   │   ├── agent/             # WebAgent implementation
│   │   ├── client/            # WebMCP client
│   │   ├── server/            # WebMCP server
│   │   ├── transport/         # Transport layer implementation
│   │   ├── McpSdk.ts          # MCP SDK encapsulation
│   │   ├── index.ts           # Main entry
│   │   ├── package.json
│   │   └── README.md
│   ├── next-remoter/          # Vue3 AI Chat Component
│   │   ├── src/
│   │   │   ├── components/    # Component implementation
│   │   │   └── composable/    # Composables
│   │   ├── package.json
│   │   └── README.md
│   ├── webmcp-cli/            # CLI tool for browser control via WebMCP
│   │   ├── src/               # CLI main implementation
│   │   ├── webmcp-tools/      # Injected page tools (e.g. Excalidraw, Baidu)
│   │   ├── package.json
│   │   └── README.md
│   ├── webmcp-skill/          # Guidelines and domain-specific skills for AI agents
│   │   ├── SKILL.md           # Master instruction file for agents
│   │   └── domains/           # Domain-specific instructions (e.g., Excalidraw)
│   └── doc-ai/                # Doc AI example app
├── docs/                      # Project docs
├── pnpm-workspace.yaml        # pnpm workspace config
├── package.json
└── README.md

📚 Related Resources

Official Docs

Related Projects

WebMCP + WebSkills Best Practice Projects

It is recommended to refer directly to the following example projects, clone or implement them according to your tech stack:

Tech StackExample ProjectDescription
Vuedoc-aiVue3 + Vite, best practices for local WebMCP / Polyfill mode
Angulardoc-ai-angularAngular main app + iframe Remoter, connected to WebMCP via MessageChannel
Reactdoc-ai-reactReact main app + iframe Remoter, similar WebMCP architecture to Vue version

Accompanying Documentation:


📄 License

MIT

Copyright (c) 2024-present OpenTiny Team

🙏 Acknowledgments

Thanks to all contributors to the OpenTiny NEXT-SDKs project!

contributors

Webmcp SdkのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Webmcp Sdkに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Webmcp Sdkをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Webmcp SdkのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "webmcp-sdk": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてWebmcp SdkのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Webmcp SdkのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Webmcp Sdkを使ってこのタスクを手伝ってもらえますか?
Webmcp Sdk
はい、読みました。
Webmcp Sdkで調べた結果をお伝えします。

よくある質問

Webmcp Sdk MCPサーバーは何に使いますか?

Webmcp Sdkは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでWebmcp Sdk MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでWebmcp Sdkを利用できます。

TypingMindでWebmcp Sdk MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Webmcp Sdkを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Webmcp Sdk MCPをTypingMindに接続するにはどうすればよいですか?

Webmcp SdkはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでWebmcp Sdk MCPのどのようなツールを利用できますか?

Webmcp SdkはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Webmcp Sdk MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Webmcp Sdkで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇