今日已更新 344 条资讯 | 累计 37249 条内容
关于我们

Build an MCP server in Rust with rmcp: a walk-through 🦀

xbill 2026年08月16日 20:32 8 次阅读 来源:Dev.to

This tutorial walks through building an MCP server in Rust with rmcp , the official Model Context Protocol Rust SDK. The example is a real one: a devops agent that manages AWS EC2 G5g instances — Graviton2 boxes with NVIDIA T4G GPUs — serving Gemma 4 under vLLM. It launches instances, drives them over SSM, and health-checks the model. There's an existing Python version, so at the end we can put the two side by side. Follow along and you'll have a working, registerable MCP server. 🦀 Why Rust for this? Worth answering properly, because the weak version of the argument is easy to make and easy to demolish — and the real one is better anyway. Start with what it isn't: these tools are I/O bound. Every one is an AWS API call — describe_instances , send_command , polling SSM — so 100–500 ms of network per call. The caller's language contributes nothing measurable there. Anyone selling you a Rust rewrite on raw speed for this workload is selling something. Three claims that don't hold, so nobody has to make them in the comments: Claim Why it fails "462 ms startup is slow" stdio servers spawn once per session , not per call "Rust is faster" the work is network round-trips to AWS "smaller supply chain" 241 crates vs 34 Python packages — it's worse What actually justifies it, for this codebase: 1. It's a fleet, not a server. This monorepo has 16 rigs , each with its own MCP server. That changes the units: All loaded together 🐍 Python 🦀 Rust Resident memory 16 × 83 MB ≈ 1.33 GB 16 × 12 MB ≈ 192 MB Session startup 16 × 462 ms ≈ 7.4 s 16 × 2.5 ms ≈ 40 ms A gigabyte of resident Python to expose sixteen tool lists is a real cost. 2. No shared interpreter. These rigs install system-wide — no virtualenvs, by policy — so all sixteen share one Python. Sixteen servers with independently drifting boto3 and mcp pins in one interpreter is a standing conflict risk. A static binary has no such coupling; each rig pins whatever it likes in its own Cargo.lock . 3. The schema can't drift from th

本文内容来源于互联网,版权归原作者所有
查看原文