A proposed WebAssembly System Interface API for the Model Context Protocol, providing typed operations for MCP 2025-06-18 with WASI 0.3 async support.
Note
Part of the PulseEngine toolchain. Extends WASI standardization for Model Context Protocol interoperability.
Phase 0 — Pre-Proposal (targeting Phase 1)
Protocol-Faithful Design: This proposal provides typed WIT interfaces that map directly to MCP protocol operations, similar to how wasi-http maps HTTP semantics. Each MCP method has a corresponding typed function with proper async patterns.
- Introduction
- Goals
- Non-goals
- API Overview
- Examples
- Design Discussion
- Implementation Status
- References
The Model Context Protocol (MCP) is an open standard that enables AI applications to connect to external data sources, tools, and workflows. This WASI proposal enables WebAssembly components to implement MCP servers and clients with full protocol support.
Why WASI for MCP?
- Portability: Run MCP servers across any WASM runtime
- Security: Leverage WebAssembly's capability-based security model
- Performance: Native async operations with WASI 0.3
- Composability: Component Model enables MCP server aggregation
- Type Safety: Strongly-typed WIT interfaces prevent protocol errors
Protocol Coverage: This proposal implements the complete MCP 2025-06-18 specification including protocol initialization, resources with templates and subscriptions, tools with annotations, prompts with arguments, pagination, progress tokens, notifications, logging, and streaming support.
| Version | Status | Use Case | Location |
|---|---|---|---|
| WASI 0.3 | Aspirational | Final standardization with async | wit/*.wit |
| WASI 0.2 | Available now | Immediate prototyping (blocking ops) | wit/preview2/*.wit |
- Complete MCP Protocol Support in WIT
- Protocol-Faithful Design with direct mapping of MCP methods
- WASI 0.3 async with
future<result<T, error>> - Follow WASI Patterns from successful Phase 3 proposals
- Clear Path to Phase 1
- Transport Implementation (handled by hosts)
- JSON-RPC Layer (implementation detail)
- AI Model Integration (out of scope)
- Backward Compatibility (only targeting latest MCP spec)
Bidirectional Interface Pattern — Components import runtime capabilities and export handlers:
// Component IMPORTS runtime to register and serve
interface runtime {
register-server: func(info: server-info) -> future<result<_, error>>;
register-tools: func(tools: list<tool-definition>) -> future<result<_, error>>;
serve: func() -> future<result<_, error>>;
}
// Component EXPORTS handlers to execute operations
interface handlers {
call-tool: func(name: string, arguments: list<u8>) -> future<result<tool-result, error>>;
read-resource: func(uri: string) -> future<result<resource-contents, error>>;
}Interface Structure:
wit/
├── types.wit # Core MCP types
├── capabilities.wit # Server/Client capabilities
├── content.wit # Content blocks
├── runtime.wit # Runtime API (component imports)
├── handlers.wit # Handler interface (component exports)
├── client.wit # Client operations
├── world.wit # Component worlds
└── preview2/ # WASI 0.2 for immediate prototyping
See the full Examples section for MCP backend, client, and streaming usage patterns in Rust.
- Core types with all MCP protocol types
- Complete capabilities system
- Content type system with variants
- Typed server and client operations
- Notification system and streaming interface
- World definitions with deps.toml
- WASI 0.2 interfaces for immediate prototyping
- Create reference implementations (Rust, Go, C++)
- Gather stakeholder feedback (Anthropic, WASI Subgroup)
- Submit Phase 1 proposal
- MCP 2025-06-18 Specification
- wasi-http — Protocol-faithful HTTP mapping
- Component Model
- WASI 0.3
Apache-2.0
Part of PulseEngine — formally verified WebAssembly toolchain for safety-critical systems