wasmcp Rust SDK
SDK for building MCP (Model Context Protocol) handler components in Rust.
Installation
Add to your Cargo.toml
:
[]
= "0.0.1"
Usage
This SDK provides types and a macro to help you implement MCP handlers. Here's how to create a component:
1. Create a new component project
2. Add the MCP WIT files
Copy the WIT files from the wasmcp repository to your project's wit
directory, or reference them in your Cargo.toml
:
[]
= { = "../path/to/wasmcp/wit" }
3. Implement your handler
use ;
create_handler!;
4. Build your component
Features
The SDK provides:
Tool
,Resource
, andPrompt
types- Builder functions:
create_tool()
,create_resource()
,create_prompt()
- The
create_handler!
macro to generate component bindings - Convenience macros:
tool!
,resource!
,prompt!
Example
See the examples directory for complete working examples.