LC

linux-china/mcp-rs-template

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

82 stars 11 forks 质量 56 趋势 0Apache-2.0

linux-china/mcp-rs-template 是从 https://github.com/linux-china/mcp-rs-template. 导入的 MCP 服务器候选。

概览

linux-china/mcp-rs-template 是从 https://github.com/linux-china/mcp-rs-template. 导入的 MCP 服务器候选。

概述(AI 翻译)

MCP Rust CLI 服务器模板

模型上下文协议(MCP)是一种开放协议,能够实现LLM应用之间的无缝集成 以及外部数据源和工具。无论你是在构建一个由人工智能驱动的集成开发环境(IDE),还是在增强聊天界面, 或创建自定义AI工作流,MCP为LLM与所需上下文连接提供了标准化方式。

mcp-rs-template 是一个简单的应用模板,演示如何在 Rust 中实现 MCP CLI 服务器。

如何使用模板?

  1. 克隆仓库
  2. 修改Cargo.toml和[[T1]中的项目信息]
  3. 修改服务器处理器:
  • src/mcp/prompts.rs:提示处理器
  • src/mcp/resources.rs:资源处理程序
  • src/mcp/tools.rs:工具搬运工
  1. 如果你喜欢使用json文件作为提示、资源和工具,请修改src/mcp/templates/*.json

mcp-rs-template 基于 rust-rpc-router,一种 JSON-RPC 路由 Rust 的图书馆。

CLI选项

  • --mcp:启用MCP服务器
  • --resources:显示资源
  • --prompts:显示提示
  • --tools:显示工具

如何在 Claude Desktop 中使用 MCP CLI 服务器?

  1. 编辑’claude_desktop_config。

本页由 AI 翻译,技术细节请以原文为准。

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, 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:
{
   "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

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "current-time": { "command": "mcp-rs-template", "args": [ "--mcp" ], "env": { "API_KEY": "xxxx" } } } }