Command Palette

Search for a command to run...

UnylyUnyly
Browse all

Template Rust

FreeNot checked

Template for building MCP servers in Rust

GitHubEmbed

About

Template for building MCP servers in Rust

README

A template for building MCP servers in Rust.

Single binary, zero runtime dependencies, stdio + HTTP transports out of the box.

What's Included

  • rmcp — official Rust MCP SDK with #[tool] macro for tool definitions
  • Dual transport — stdio for local clients, streamable HTTP for hosted deployments
  • Distribution — uvx (via maturin), rvx, cargo install, Nix flake, Docker
  • CI/CD — clippy, fmt, cross-compilation (Linux/macOS/Windows), Nix check, cargo-deny, gitleaks
  • Release — tag-triggered GitHub releases with binaries, crates.io, and PyPI publishing

Quick Start

  1. Click "Use this template" on GitHub (or clone the repo)

  2. Run the setup script:

./setup.sh my-mcp-server your-github-username "My awesome MCP server"
  1. Build and run:
cargo build
cargo run
  1. Delete the setup script:
rm setup.sh

Project Structure

src/
├── main.rs      # Entry point, transport setup
├── lib.rs       # Module declarations
├── server.rs    # MCP server, tool definitions
├── config.rs    # CLI args (clap)
└── errors.rs    # Error types

Adding Tools

Edit src/server.rs:

#[derive(Deserialize, JsonSchema)]
pub struct MyParams {
    /// Description shown to the AI model
    pub query: String,
}

#[tool_router]
impl McpServer {
    #[tool(
        name = "my_tool",
        description = "What this tool does"
    )]
    async fn my_tool(
        &self,
        Parameters(params): Parameters<MyParams>,
    ) -> Result<CallToolResult, McpError> {
        // your logic here
        to_json_result(&serde_json::json!({ "result": params.query }))
    }
}

Usage

Claude Desktop / Claude Code

With uvx:

{
  "mcpServers": {
    "REPLACE_ME": {
      "command": "uvx",
      "args": ["REPLACE_ME"]
    }
  }
}

With rvx:

{
  "mcpServers": {
    "REPLACE_ME": {
      "command": "rvx",
      "args": ["REPLACE_ME"]
    }
  }
}
Other installation methods

With Nix:

nix run github:REPLACE_ME_GITHUB_OWNER/REPLACE_ME

With cargo:

cargo install REPLACE_ME

From releases:

Download a prebuilt binary from GitHub Releases.

With Docker:

docker run -p 3000:3000 REPLACE_ME

HTTP Transport

REPLACE_ME --transport streamable-http --port 3000

The server listens on http://127.0.0.1:3000/mcp.

Debugging

RUST_LOG=debug REPLACE_ME

Development

nix develop  # or install Rust toolchain manually

just check   # clippy + test + fmt + taplo + typos
just fmt     # auto-format
just deny    # dependency audit

License

MIT

from github.com/vaporif/template-rust-mcp-server

Install Template Rust in Claude Desktop, Claude Code & Cursor

Recommended · one command, every IDE
unyly install template-rust

Installs into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.

First time? Get the CLI: curl -fsSL https://unyly.org/install | sh

Or configure manually

Run in your terminal:

claude mcp add template-rust -- uvx REPLACE_ME

Step-by-step: how to install Template Rust

FAQ

Is Template Rust MCP free?

Yes, Template Rust MCP is free — one-click install via Unyly at no cost.

Does Template Rust need an API key?

No, Template Rust runs without API keys or environment variables.

Is Template Rust hosted or self-hosted?

Self-hosted: the server runs locally on your machine via the install command above.

How do I install Template Rust in Claude Desktop, Claude Code or Cursor?

Open Template Rust on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.

Related MCPs

Compare Template Rust with

Not sure what to pick?

Find your stack in 60 seconds

Author?

Embed badge for your README

Browse similar

All ai MCPs