This means any Python function exposed as an MCP tool can now run directly in the browser, Node.js, or edge workers, fully sandboxed, without a Python server.
Compile your tools, serve the bundle, and AI agents can call them instantly in WASM environments. Existing MCP features like input validation, error handling, and tool orchestration work seamlessly.
example:
from polymcp.polymcp_toolkit import expose_tools_wasm
def add(a: int, b: int) -> int: """Add two numbers""" return a + b
compiler = expose_tools_wasm([add]) bundle = compiler.compile(output_dir="./dist")
Open dist/demo.html in your browser — the add tool runs entirely in WASM.
Why it matters • No Python server required: runs client-side or on edge • Secure: sandboxed execution • Plug-and-play: multiple tools in one WASM bundle • Ideal for interactive demos, edge AI apps, or browser-based automation