SuperAPIAI Directory

mcp-rs-template

github.com · AI developer platforms

mcp-rs-template is a Rust application template that demonstrates how to implement a Model Context Protocol (MCP) CLI server. MCP is an open protocol designed to enable seamless integration between LLM applications and external data sources and tools, and can be used to build AI-driven IDEs, enhance chat interfaces, or create custom AI workflows. This template is built on rust-rpc-router, a JSON-RPC routing library for Rust, and provides the locations to modify for three types of server handlers: prompts, resources, and tools, and supports defining these with JSON files. It includes command-line arguments such as --mcp, --resources, --prompts, and --tools, and can be configured for use in Claude Desktop.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

Purpose

mcp-rs-template is a simple application template that demonstrates how to implement a Model Context Protocol (MCP) CLI server in Rust.

MCP is an open protocol for enabling seamless integration between LLM applications and external data sources and tools. Whether building AI-driven IDEs, enhancing chat interfaces, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need. This template provides a Rust-side implementation skeleton around this protocol.

Main capabilities

  • Provides a sample implementation of an MCP CLI server as a starting point for new projects.
  • Built on rust-rpc-router (a JSON-RPC routing library for Rust).
  • Handler files are organized by MCP capability category for easy replacement and extension:
    • src/mcp/prompts.rs: prompts handler
    • src/mcp/resources.rs: resources handler
    • src/mcp/tools.rs: tools handler
  • Supports defining prompts, resources, and tools using JSON files, in the directory src/mcp/templates/*.json.
  • Provides command-line arguments to enable the server and view content:
    • --mcp: enable the MCP server
    • --resources: display resources
    • --prompts: display prompts
    • --tools: display tools

Usage

Steps to use the template:

  1. Clone the repository.
  2. Modify the project information in Cargo.toml and src/mcp/mod.rs.
  3. Modify the server handlers:
    • src/mcp/prompts.rs: prompts handler
    • src/mcp/resources.rs: resources handler
    • src/mcp/tools.rs: tools handler
  4. If you prefer to define prompts, resources, and tools using JSON files, you can modify src/mcp/templates/*.json.

Using this MCP CLI server in Claude Desktop:

  1. Edit claude_desktop_config.json, at Claude Desktop -> Settings -> Developer -> Edit Config.
  2. Add the corresponding configuration in the servers section (the specific content of this configuration is not given in the materials and is not provided here).
  3. To view MCP logs, run: tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

Use cases

  • Developers who need to build an MCP server from scratch in Rust.
  • Scenarios where you want to connect your own tools, resources, and prompts to an LLM client that supports MCP (such as Claude Desktop).
  • Integration development scenarios where you need to quickly validate and iterate on the three capability types: prompts, resources, and tools.

Related specifications and dependencies

  • MCP specification:https://spec.modelcontextprotocol.io/
  • Model Context Protocol (MCP) introduction:https://modelcontextprotocol.io/introduction
  • rpc-router: a JSON-RPC routing library for Rust,https://github.com/jeremychone/rust-rpc-router/
  • Zed context_server:https://github.com/zed-industries/zed/tree/main/crates/context_server

Limitations

The materials do not provide the template's specific run commands, build method, license, supported MCP protocol version, performance, or statements about production readiness; the above content is not provided here. This template is positioned as a sample template, and actual functionality depends on the user's own implementation and modifications.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools