Langsung ke konten
Skillpedia
API & server (backend)40k Β· #7411

rust-mcp-server-generator

Fungsinya

Agen ini membuat proyek server komunikasi lengkap menggunakan Rust. Agen ini menyiapkan semua tool dan file yang diperlukan agar server dapat berfungsi.

Kapan dipakai

  • βœ“Saat Anda ingin membuat server komunikasi baru di Rust.
  • βœ“Saat Anda membutuhkan titik awal untuk proyek yang menggunakan SDK rmcp resmi.
  • βœ“Saat Anda ingin membuat struktur dasar server lengkap dengan tool dan tes yang sudah disertakan.

Link skill

https://github.com/github/awesome-copilot/blob/main/skills/rust-mcp-server-generator/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/github/awesome-copilot/blob/main/skills/rust-mcp-server-generator/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œBuat server bernama 'my-weather-server' yang mengambil data cuaca, dengan transport stdio dan http.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Anda memberikan nama proyek, deskripsi, jenis komunikasi yang akan digunakan (seperti stdio atau http), dan tool apa saja yang dimiliki server. Agen kemudian membuat semua file dan folder yang diperlukan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Rust MCP Server Generator

You are a Rust MCP server generator. Create a complete, production-ready Rust MCP server project using the official rmcp SDK.

Project Requirements

Ask the user for:

  1. Project name (e.g., "my-mcp-server")
  2. Server description (e.g., "A weather data MCP server")
  3. Transport type (stdio, sse, http, or all)
  4. Tools to include (e.g., "weather lookup", "forecast", "alerts")
  5. Whether to include prompts and resources

Project Structure

Generate this structure:

{project-name}/
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs
β”‚   β”œβ”€β”€ handler.rs
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   └── {tool_name}.rs
β”‚   β”œβ”€β”€ prompts/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   └── {prompt_name}.rs
β”‚   β”œβ”€β”€ resources/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   └── {resource_name}.rs
β”‚   └── state.rs
└── tests/
    └── integration_test.rs

File Templates

Cargo.toml

[package]
name = "{project-name}"
version = "0.1.0"
edition = "2021"

[dependencies]
rmcp = { version = "0.8.1", features = ["server"] }
rmcp-macros = "0.8"
tokio = { version = "1", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = "0.3"
schemars = { version = "0.8", features = ["derive"] }
async-trait = "0.1"

# Optional: for HTTP transports
axum = { version = "0.7", optional = true }
tower-http = { version = "0.5", features = ["cors"], optional = true }

[dev-dependencies]
tokio-test = "0.4"

[features]
default = []
http = ["dep:axum", "dep:tower-http"]

[[bin]]
name = "{project-name}"
path = "src/main.rs"

.gitignore

/target
Cargo.lock
*.swp
*.swo
*~
.DS_Store

README.md

# {Project Name}

{Server description}

## Installation

```bash
cargo build --release

Usage

Stdio Transport

cargo run

SSE Transport

cargo run --features http -- --transport sse

HTTP Transport

cargo run --features http -- --transport http

Configuration

Configure in your MCP client (e.g., Claude Desktop):

{
  "mcpServers": {
    "{project-name}": {
      "command": "path/to/target/release/{project-name}",
      "args": []
    }
  }
}

Tools

  • {tool_name}: {Tool description}

Development

Run tests:

cargo test

Run with logging:

RUST_LOG=debug cargo run

### src/main.rs

```rust
use anyhow::Result;
use rmcp::{
    protocol::ServerCapabilities,
    server::Server,
    transport::StdioTransport,
};
use tokio::signal;
use tracing_subscriber;

mod handler;
mod state;
mod tools;
mod prompts;
mod resources;

use handler::McpHandler;

#[tokio::main]
async fn main() -> Result<()> {
    // Initialize tracing
    tracing_subscriber::fmt()
        .with_max_level(tracing::Level::INFO)
        .with_target(false)
        .init();
    
    tracing::info!("Starting {project-name} MCP server");
    
    // Create handler
    let handler = McpHandler::new();
    
    // Create transport (stdio by default)
    let transport = StdioTransport::new();
    
    // Build server with capabilities
    let server = Server::builder()
        .with_handler(handler)
        .with_capabilities(ServerCapabilities {
            tools: Some(Default::default()),
            prompts: Some(Default::default()),
            resources: Some(Default::default()),
            ..Default::default()
        })
        .build(transport)?;
    
    tracing::info!("Server started, waiting for requests");
    
    // Run server until Ctrl+C
    server.run(signal::ctrl_c()).await?;
    
    tracing::info!("Server shutting down");
    Ok(())
}

src/handler.rs

use rmcp::{
    model::*,
    protocol::*,
    server::{RequestContext, ServerHandler, RoleServer, ToolRouter},
    ErrorData,
};
use rmcp::{tool_router, tool_handler};
use async_trait::async_trait;

use crate::state::ServerState;
use crate::tools;

pub struct McpHandler {
    state: ServerState,
    tool_router: ToolRouter,
}

#[tool_router]
impl McpHandler {
    // Include tool definitions from tools module
    #[tool(
        name = "example_tool",
        description = "An example tool",
        annotations(read_only_hint = true)
    )]
    async fn example_tool(params: Parameters<tools::ExampleParams>) -> Result<String, String> {
        tools::example::execute(params).await
    }
    
    pub fn new() -> Self {
        Self {

…
Pertanyaan umum

Apa itu 'rmcp SDK'?

Itu adalah kumpulan tool dan panduan resmi yang membantu Anda membuat server komunikasi di Rust dengan lebih mudah dan standar.

Apa saja jenis 'transport'?

Transport adalah cara server berkomunikasi. Jenis yang umum digunakan adalah stdio (command line), sse (server-sent events), dan http (web).

Apa itu 'tools' dan 'prompts'?

Tools adalah fungsi yang dapat dijalankan server, seperti mengambil data cuaca. Prompts adalah templat pesan yang dapat digunakan server untuk berinteraksi.

Detail

Deskripsi asli dari pembuat

Generate a complete Rust Model Context Protocol server project with tools, prompts, resources, and tests using the official rmcp SDK

repo: github/awesome-copilot

Popularitas

Bintang GitHub
40k
Peringkat
#7411
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa