https://github.com/linux-china/mcp-rs-template
Model Context Protocol (MCP) CLI server template for Rust
https://github.com/linux-china/mcp-rs-template
json-rpc mcp
Last synced: 8 months ago
JSON representation
Model Context Protocol (MCP) CLI server template for Rust
- Host: GitHub
- URL: https://github.com/linux-china/mcp-rs-template
- Owner: linux-china
- License: apache-2.0
- Created: 2024-11-30T10:21:20.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T05:02:38.000Z (10 months ago)
- Last Synced: 2025-04-10T15:44:29.289Z (8 months ago)
- Topics: json-rpc, mcp
- Language: Rust
- Homepage:
- Size: 14.6 KB
- Stars: 65
- Watchers: 1
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-mcp-servers - mcp-rs-template - MCP CLI server template for Rust (Frameworks / 🛠️ <a name="other-tools-and-integrations"></a>Other Tools and Integrations)
- awesome-mcp - mcp-rs-template - Rust 的 MCP CLI 服务器模板 (框架)
- awesome-mcp-servers - mcp-rs-template - RustのためのMCP CLIサーバーテンプレート (フレームワーク / 🎧 <a name="text-to-speech"></a>テキスト読み上げ)
- awesome-mcp-lists - GitHub
- awesome-mcp-servers - MCP-RS Template - Model Context Protocol (MCP) CLI server template for Rust (Table of Contents / Developer Tools)
- awesome-mcp-devtools - linux-china/mcp-rs-template - MCP CLI server template for Rust (SDKs / Rust)
- awesome-mcp-servers - **mcp-rs-template** - Model Context Protocol (MCP) CLI server template for Rust `rust` `json-rpc` `mcp` `server` `cargo install --git https://github.com/linux-china/mcp-rs-template` (🔧 Utilities)
- awesome-mcp-servers - mcp-rs-template - RustのためのMCP CLIサーバーテンプレート (フレームワーク / 🎧 <a name="text-to-speech"></a>テキスト読み上げ)
README
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?
1. Clone the repository
2. Modify project information in `Cargo.toml` and `src/mcp/mod.rs`
3. Modify server handlers:
- `src/mcp/prompts.rs`: prompts handlers
- `src/mcp/resources.rs`: resources handlers
- `src/mcp/tools.rs`: tools handlers
4. 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](https://github.com/jeremychone/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?
1. Edit `claude_desktop_config.json`: Claude Desktop -> `Settings` -> `Developer` -> `Edit Config`
2. Add the following configuration to the `servers` section:
```json
{
"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