MCP Rust CLI server template
A Rust template for creating MCP CLI servers, with support for JSON-based prompts, resources, and tools.
MCP Rust CLI server template
Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you’re building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
mcp-rs-template is a simple application template that demonstrates how to implement MCP CLI server in Rust.
How to use template?
- Clone the repository
- Modify project information in
Cargo.toml
andsrc/mcp/mod.rs
- Modify server handlers:
src/mcp/prompts.rs
: prompts handlerssrc/mcp/resources.rs
: resources handlerssrc/mcp/tools.rs
: tools handlers
- Modify
src/mcp/templates/*.json
if you prefer to use json files for prompts, resources, and tools
mcp-rs-template is based on rust-rpc-router, a JSON-RPC routing library for Rust.
CLI options
--mcp
: Enable MCP server--resources
: display resources--prompts
: display prompts--tools
: display tools
How to use MCP CLI server in Claude Desktop?
- Edit
claude_desktop_config.json
: Claude Desktop ->Settings
->Developer
->Edit Config
- Add the following configuration to the
servers
section:
{
"mcpServers": {
"current-time": {
"command": "mcp-rs-template",
"args": [
"--mcp"
],
"env": {
"API_KEY": "xxxx"
}
}
}
}
If you want to check MCP log, please use tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
.
References
- MCP Specification: https://spec.modelcontextprotocol.io/
- Model Context Protocol (MCP): https://modelcontextprotocol.io/introduction
- rpc-router: json-rpc routing library - https://github.com/jeremychone/rust-rpc-router/
- Zed context_server: https://github.com/zed-industries/zed/tree/main/crates/context_server
Related Servers
Ghost MCP
An MCP server for the Ghost blogging platform with Server-Sent Events (SSE) support.
Cloudflare Remote MCP Server
An example of deploying a customizable, remote MCP server on Cloudflare Workers without authentication.
40ants MCP
A framework for building Model Context Protocol (MCP) servers in Common Lisp.
Model Context Protocol servers
A collection of reference implementations for the Model Context Protocol (MCP), demonstrating secure and controlled access to tools and data sources for Large Language Models (LLMs).
Civil 3D MCP
An MCP server for interacting with Autodesk Civil 3D, requiring a companion plugin and Node.js 18+.
MCP Simple OpenAI Assistant
A simple server for interacting with OpenAI assistants using an API key.
Next.js MCP Server
A Next.js-based MCP server with OAuth 2.1 authentication support using Google as the default provider. Requires a PostgreSQL database and optionally Redis for SSE transport.
Zero-Vector v3
A server for Zero-Vector's hybrid vector-graph persona and memory management system, featuring advanced LangGraph workflow capabilities.
Micromanage
A server for managing sequential development tasks with configurable rules using external .mdc files.
Jimeng
Integrates Jimeng AI for image generation.