Build an MCP Server in Rust with the Official SDK

This is the Rust companion to Build an MCP Server in Go with the Official SDK and Build an MCP Server in TypeScript with the Official SDK. It builds the same kind of server — two tools and a resource — with the official Rust SDK (rmcp), served over the stdio transport so a local client launches it as a subprocess. The result is a single compiled binary with no runtime beyond itself. ...

18 min

Build a Rust Hello World Application

A minimal Rust project that prints a greeting, accepts a name from the command line, includes a test suite, and uses a Makefile to drive common tasks. This tutorial covers project setup with Cargo, module organization, argument parsing with std::env, unit tests, and build automation. Prerequisites Rust 1.70 or later (install via rustup) A Unix-like terminal (macOS, Linux, or WSL on Windows) make installed (pre-installed on macOS and most Linux distributions) No third-party crates required Step 1: Create the project with Cargo Create the file cargo new hello-world Detailed breakdown cargo new hello-world scaffolds a new Rust project with a Cargo.toml manifest and a src/main.rs entry point. When run outside an existing Git repository, Cargo also initializes a new Git repo and generates a .gitignore. When run inside an existing repo (as in this tutorial), it skips Git initialization. The project name hello-world becomes both the directory name and the package name in Cargo.toml. Step 2: Update the gitignore The default Cargo .gitignore only excludes target/. Add common temporary artifacts. ...

6 min