WASM MCP Server
WASM MCP サーバー
ウェブブラウザ内でWebAssembly (WASM) で実行されるModel Context Protocol (MCP) サーバーの概念実証実装です。このプロジェクトは、ブラウザ環境におけるMCPツールとリソースの統合を実証します。
特徴
計算ツール
基本的な算術演算(加算、減算、乗算、除算)を実行します
入力検証とエラー処理
リアルタイム計算結果
ストレージシステム
キーバリューストレージ機能
文字列キーを使用して値を設定および取得する
ブラウザセッション内の永続的なストレージ
テンプレートベースのリソース処理
Related MCP server: MCP Communication Server
技術的実装
サーバーコンポーネント
server.ts: ツールとリソースの定義を含むコア MCP サーバーの実装main.ts: クライアント側の統合とUIインタラクションの処理browser-transport.ts: ブラウザ通信用のカスタムトランスポート層
建築
サーバーの実装にはモデルコンテキストプロトコルSDKを使用します
カスタムブラウザトランスポート層を実装する
ツールはコールバック関数に登録されます
リソースはパラメータ置換によるテンプレートパスを使用します
重要な概念
ツール
server.tool()を使用して登録されましたコールバック関数経由で実行
Zodを使用したスキーマ検証
リソース
テンプレートベースのパス(例:
storage://{key})readCallback経由でアクセスパラメータ化されたリソース処理
使用法
電卓
演算を選択します(加算、減算、乗算、除算)
2つの数字を入力してください
「計算」をクリックして結果を確認してください
無効な入力とゼロ除算のエラー処理
ストレージ
それぞれのフィールドにキーと値を入力します
「保存設定」をクリックして値を保存します
キーを入力し、「ストレージを取得」をクリックして値を取得します
成功した操作とエラーに関するフィードバックが提供されます
依存関係
@モデルコンテキストプロトコル/sdk
Zod(スキーマ検証用)
タイプスクリプト
Vite(開発と建築用)
プロジェクト構造
mcp-wasm-poc/
├── src/
│ └── web/
│ ├── server.ts # MCP server implementation
│ ├── main.ts # Client-side logic
│ └── browser-transport.ts # Browser transport layer
├── index.html # Web interface
└── package.json # Project dependenciesエラー処理
サーバー初期化エラー
ツール実行エラー
リソースアクセスエラー
入力検証
トランスポート層エラー
将来の機能強化
追加の計算機操作
セッションをまたがる永続的なストレージ
強化されたUI/UX
追加のMCPツールとリソース
WASMの最適化
発達
これは、WebAssemblyを用いてウェブブラウザ上でMCPサーバーを実行することの実現可能性を示す概念実証実装です。この実装は、シンプルさと明瞭さを維持しながら、MCPの中核概念を示すことに重点を置いています。
This server cannot be deployed
Maintenance
Related MCP Connectors
Model Context Protocol server for Studex tools, notifications, and profile integrations
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseCqualityDmaintenanceA server that provides tools for performing basic arithmetic operations (addition, subtraction, multiplication, division) via the Model Context Protocol.4-
- AlicenseCqualityDmaintenanceA Model Context Protocol server implementation that enables real-time data communication between web pages and client applications through WebSocket connections.22,430 npmMIT
- FlicenseNot gradedqualityDmaintenanceA demonstration implementation of a Model Context Protocol server that provides simple mathematical tools (add, subtract) and personalized greeting resources.-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides basic tools for arithmetic operations (addition) and dynamic greeting resources, demonstrating MCP integration patterns for other projects and clients.8 npmISC