Sponsored by Deepsite.site

Rust MCP Server using 'rmcp' 🦀

Created By
RGGH8 months ago
MCP Server - Official SDK demo - "rmcp"
Content

Build Rust Binary

Rust MCP Server using 'rmcp' 🦀

https://github.com/modelcontextprotocol/rust-sdk?tab=readme-ov-file#rmcp

A flexible server implementation supporting Model Context Protocol

Features

  • Multiple transport methods:
    • Server-Sent Events (SSE) over HTTP
    • Standard input/output (stdio)
  • Configurable bind address for SSE server
  • Adjustable logging levels
  • Simple Counter service demonstration

Table of Contents

Installation

Prerequisites

  • Rust and Cargo (latest stable version recommended)
  • Required dependencies will be automatically installed via Cargo

Building the Project

# Clone the repository
git clone https://github.com/rggh/xp_both_mcp.git
cd rmcp-server

# Build the project
cargo build --release

Usage

Run the server with default settings (SSE transport on 127.0.0.1:8000):

cargo run

Command-line Options

Usage: rmcp-server [OPTIONS]

Options:
  -t, --transport <TRANSPORT>        Transport method to use [default: sse] [possible values: stdio, sse]
  -b, --bind-address <BIND_ADDRESS>  Bind address for SSE server (only used with sse transport) [default: 127.0.0.1:8000]
  -l, --log-level <LOG_LEVEL>        Log level (trace, debug, info, warn, error) [default: info]
  -h, --help                         Print help
  -V, --version                      Print version

Examples

Start the server with SSE transport on a custom address:

cargo run -- --bind-address 0.0.0.0:9000

Use stdio transport:

cargo run -- --transport stdio

Set a specific log level:

cargo run -- --log-level debug

Configuration

The server can be configured using command-line arguments:

OptionDescriptionDefault
--transportTransport method (stdio, sse)sse
--bind-addressAddress for SSE server to bind to127.0.0.1:8000
--log-levelLogging verbosityinfo

How It Works

The server uses the RMCP framework to expose services over different transport methods:

  1. Command-line Parsing: Uses clap to parse and validate arguments.
  2. Logging: Configurable tracing via tracing and tracing_subscriber.
  3. Transport Methods:
    • SSE: Server-sent events over HTTP for browser or HTTP client integration
    • Stdio: Standard input/output for command-line or pipe-based usage
  4. Error Handling: Uses anyhow for comprehensive error management

Creating Your Own Service

To create your own service instead of using the built-in Counter:

  1. Define your service structure in a new module
  2. Implement the necessary RMCP traits
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
DeepChatYour AI Partner on Desktop
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
WindsurfThe new purpose-built IDE to harness magic
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Serper MCP ServerA Serper MCP Server
Tavily Mcp
Amap Maps高德地图官方 MCP Server