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:
- Clone the repository.
- Modify the project information in Cargo.toml and src/mcp/mod.rs.
- Modify the server handlers:
- src/mcp/prompts.rs: prompts handler
- src/mcp/resources.rs: resources handler
- src/mcp/tools.rs: tools handler
- 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:
- Edit claude_desktop_config.json, at Claude Desktop -> Settings -> Developer -> Edit Config.
- 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).
- 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.