MCP服务器示例

一个简单的MCP服务器示例,提供问候和时间查询功能。

  • by i3estCorder
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 i3estCorder/mcp_example

使用说明

mcp示例

此存储库包含 fastmcp包含用实现的简单MCP服务器示例。

安装

pip install -r requirements.txt

执行

python hello_mcp.py

服务器启动后 say_hello哇 current_time 有两种工具可用。

可用工具

工具名称说明输入示例输出 | --- | --- | --- | --- | | say_hello |用问候语回答姓名。 | { "name": "Alice" } | "Hello, Alice!" | current_time 以ISO-8601格式返回当前UTC时间。|没有输入| "2024-01-01T12:00:00+00:00"

say_hello 当只输入空格时,该工具会自动替换为“there”,以提供自然的问候语。