Back to MCP directory
publicPublicdnsLocal runtime

simple-mcp-mcp-project

一个完整的MCP项目,包含客户端和服务器组件,使用标准输入输出传输,支持交互式和单次查询模式,具备健壮的通信和详细日志功能。

article

README

🚀 MCP 项目 - 简单的 MCP 实现

本项目是一个完整的 MCP(管理控制协议)项目,涵盖客户端和服务器组件,采用标准 I/O 进行数据传输,为管理控制提供了可靠的解决方案。

✨ 主要特性

  • 可靠的通信:借助具备错误处理和超时管理的标准 I/O 传输机制,确保通信稳定可靠。
  • 多种连接方式:既可以连接到已在运行的服务器,也能启动新的服务器进程,使用灵活。
  • 交互模式:用户可选择工具并提供参数,实现交互式操作,增强使用体验。
  • 一次性模式:支持直接从命令行运行查询,方便快捷。
  • 全面日志记录:详细的日志有助于调试和监控,便于问题排查和系统维护。

📦 安装指南

构建服务器

cd server
cargo build

构建客户端

cd ../client
cargo build

💻 使用示例

启动服务器

cd server
cargo run

运行客户端

cd client
cargo run -- --name "Your Name"

交互模式

cd client
cargo run -- --interactive

测试方法

./test.sh

📚 详细文档

项目结构

  • client/:存放 MCP 客户端的实现代码。
  • server/:包含 MCP 服务器的实现及工具代码。
  • test.sh:这是一个测试脚本,用于运行客户端和服务器,方便进行项目测试。

可用工具

  • hello:这是一个简单的打招呼工具,能够根据用户输入的名字进行问候。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client