使用FastMCP开发MCP服务简单尝试
FastMCP安装和资料汇总
FastMCP 的完整文档: https://gofastmcp.com/
FactMCP安装指南:https://gofastmcp.com/getting-started/installation
从官方 MCP SDK 的 FastMCP 1.0 升级到 FastMCP 2.0 通常很简单。核心服务器 API 高度兼容,在许多情况下,将您的 import 语句从from mcp.server.fastmcp import FastMCP
更改为from fastmcp import FastMCP
就足够了。
另外mcp/fastmcp包对python版本要求>=python3.10,所以在本地另外安装了python3.11,然后在pycharm中配置虚拟环境,base环境指向安装的python3.11路径。
安装fastmcp (V2版本)
pip install fastmcp
如果想要在命令行中使用此环境,可以打开git bash,切换到该虚拟环境目录下:
source python311/Scripts/activate