From a11366187f414788a92c9ebe92b85383befc3c16 Mon Sep 17 00:00:00 2001 From: Dennis Kawurek Date: Thu, 1 May 2025 16:32:46 +0200 Subject: [PATCH] fix: build errors for WASI target * The `cargo build` command failed for the WASI target with the following error: ``` warning: /home/dennis/code/mcp/rust-sdk/crates/rmcp/Cargo.toml: unused manifest key: dependencies.rmcp-macros.version warning: /home/dennis/code/mcp/rust-sdk/examples/simple-chat-client/Cargo.toml: unused manifest key: dependencies.rmcp.no-default-features error: There are multiple `wasi` packages in your project, and the specification `wasi` is ambiguous. Please re-run this command with one of the following specifications: wasi@0.1.5 wasi@0.14.2+wasi-0.2.4 ``` It seems that the command got confused about the package name when trying to build on a fresh machine. The solution for this is the renaming of the package. * The commands in the documentation are changed accordingly. * Enhance also the documentation a little bit. --- examples/wasi/Cargo.toml | 4 +--- examples/wasi/README.md | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/wasi/Cargo.toml b/examples/wasi/Cargo.toml index 509bfde46..eeaa75a4c 100644 --- a/examples/wasi/Cargo.toml +++ b/examples/wasi/Cargo.toml @@ -1,7 +1,5 @@ - - [package] -name = "wasi" +name = "wasi-mcp-example" edition = { workspace = true } version = { workspace = true } authors = { workspace = true } diff --git a/examples/wasi/README.md b/examples/wasi/README.md index ca5e661dc..45acc946c 100644 --- a/examples/wasi/README.md +++ b/examples/wasi/README.md @@ -1,4 +1,17 @@ +# Example for WASI-p2 + +Build: + ```sh -cargo build -p wasi --target wasm32-wasip2 -npx @modelcontextprotocol/inspector wasmtime target/wasm32-wasip2/debug/wasi.wasm +cargo build -p wasi-mcp-example --target wasm32-wasip2 ``` + +Run: + +``` +npx @modelcontextprotocol/inspector wasmtime target/wasm32-wasip2/debug/wasi_mcp_example.wasm +``` + +*Note:* Change `wasmtime` to a different installed run time, if needed. + +The printed URL of the MCP inspector can be opened and a connection to the module established via `STDIO`. \ No newline at end of file