A simple Rust function integrated with an MCP client.
npm run build:wasm:release // release rust code
npm install // create javascript file and install all npm dependenciesCreate a configuration file at:
{
"mcpServers": {
"mcp-server": {
"command": "node",
"args": [
"[your local path]/mcpserver/build/index.js"
]
}
}
}locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json(source: https://modelcontextprotocol.info/docs/quickstart/user/#2-add-the-filesystem-mcp-server)
Start Claude Desktop
please note the additional mcp server icon in the frontend
Agree to use the mcp server function:
Observe the mcp server function:
Watch the video tutorial here: YouTube video
npm run test:rustor
cd src/lib/rust-functions-lib
cargo test && cargo fmt --all -- --checknpm run cleannpm
npm run build:wasm
Alternative approach using wasm tool
cd src/lib/rust-functions-lib
wasm-pack build --target bundlernpm buildmanual copy to the correct location - included in npm run build:wasm:release
mkdir -p build/lib/rust-functions-lib/pkg && cp src/lib/rust-functions-lib/pkg/rust_funcations_lib.js build/lib/rust-functions-lib/pkg/rust_funcations_lib.jsissue:
solution:
run npm run build:wasm:release to release the wasm-binding the factorial import depends on


