WASM MCP Server

WASM MCP Server

This server enables running a Model Context Protocol in a web browser with functionalities including arithmetic operations and session-based key-value storage.

beekmarks

OS Automation
File Systems
Local
TypeScript
Visit Server

README

WASM MCP Server

A proof-of-concept implementation of a Model Context Protocol (MCP) server that runs in WebAssembly (WASM) within a web browser. This project demonstrates the integration of MCP tools and resources in a browser environment.

Features

Calculator Tool

  • Performs basic arithmetic operations (addition, subtraction, multiplication, division)
  • Input validation and error handling
  • Real-time calculation results

Storage System

  • Key-value storage functionality
  • Set and retrieve values using string keys
  • Persistent storage within the browser session
  • Template-based resource handling

Technical Implementation

Server Components

  • server.ts: Core MCP server implementation with tool and resource definitions
  • main.ts: Client-side integration and UI interaction handling
  • browser-transport.ts: Custom transport layer for browser communication

Architecture

  • Uses the Model Context Protocol SDK for server implementation
  • Implements a custom browser transport layer
  • Tools are registered with callback functions
  • Resources use template paths with parameter substitution

Key Concepts

  1. Tools

    • Registered using server.tool()
    • Execute via callback functions
    • Schema validation using Zod
  2. Resources

    • Template-based paths (e.g., storage://{key})
    • Accessed via readCallback
    • Parameterized resource handling

Usage

Calculator

  1. Select an operation (add, subtract, multiply, divide)
  2. Enter two numbers
  3. Click "Calculate" to see the result
  4. Error handling for invalid inputs and division by zero

Storage

  1. Enter a key and value in the respective fields
  2. Click "Set Storage" to store the value
  3. Enter a key and click "Get Storage" to retrieve a value
  4. Feedback provided for successful operations and errors

Dependencies

  • @modelcontextprotocol/sdk
  • Zod (for schema validation)
  • TypeScript
  • Vite (for development and building)

Project Structure

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

Error Handling

  • Server initialization errors
  • Tool execution errors
  • Resource access errors
  • Input validation
  • Transport layer errors

Future Enhancements

  • Additional calculator operations
  • Persistent storage across sessions
  • Enhanced UI/UX
  • Additional MCP tools and resources
  • WASM optimization

Development

This is a proof-of-concept implementation demonstrating the feasibility of running an MCP server in a web browser using WebAssembly. The implementation focuses on demonstrating core MCP concepts while maintaining simplicity and clarity.

Recommended Servers

Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Excel MCP Server

Excel MCP Server

A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.

Featured
Local
Go
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
contentful-mcp

contentful-mcp

Update, create, delete content, content-models and assets in your Contentful Space

Featured
TypeScript
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

This Serper MCP Server supports search and webpage scraping, and all the most recent parameters introduced by the Serper API, like location.

Featured
TypeScript
The Verge News MCP Server

The Verge News MCP Server

Provides tools to fetch and search news from The Verge's RSS feed, allowing users to get today's news, retrieve random articles from the past week, and search for specific keywords in recent Verge content.

Featured
TypeScript