diff --git a/README.md b/README.md index b2b8c18..69972d6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ + +> [!NOTE] +> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。 +> [English](./README.en.md) · [原始项目](https://github.com/PrefectHQ/fastmcp) · [上游 README](https://github.com/PrefectHQ/fastmcp/blob/HEAD/README.md) +> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。 +
@@ -10,9 +16,9 @@ # FastMCP 🚀 -Move fast and make things. +快速行动,动手造物。 -*Made with 💙 by [Prefect](https://www.prefect.io/)* +*由 [Prefect](https://www.prefect.io/)* 用 💙 打造* [![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com) [![Discord](https://img.shields.io/badge/community-discord-5865F2?logo=discord&logoColor=white)](https://discord.gg/uu8dJCgttd) @@ -25,7 +31,7 @@ --- -The [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) connects LLMs to tools and data. FastMCP gives you everything you need to go from prototype to production: +[模型上下文协议](https://modelcontextprotocol.io/)(Model Context Protocol,MCP)将 LLM 与工具和数据连接起来。FastMCP 为你提供从原型到生产所需的一切: ```python from fastmcp import FastMCP @@ -41,13 +47,13 @@ if __name__ == "__main__": mcp.run() ``` -## Why FastMCP +## 为什么选择 FastMCP -Building an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: **with FastMCP, best practices are built in.** +构建一个高效的 MCP 应用比看起来更难。FastMCP 为你搞定这一切。用一个 Python 函数声明一个工具,schema、验证和文档会自动生成。用 URL 连接服务器,传输协商、认证和协议生命周期都会替你管理。你只需专注业务逻辑,MCP 部分自然就能工作:**有了 FastMCP,最佳实践已内置其中。** -**That's why FastMCP is the standard framework for working with MCP.** FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages. +**正因如此,FastMCP 是使用 MCP 的标准框架。** FastMCP 1.0 于 2024 年被并入官方 MCP Python SDK。如今,这个积极维护的独立项目每天下载量达一百万次,各语言中约 70% 的 MCP 服务器都由某个版本的 FastMCP 提供支持。 -FastMCP has three pillars: +FastMCP 有三大支柱: @@ -56,68 +62,68 @@ FastMCP has three pillars: Servers
Servers -
Expose tools, resources, and prompts to LLMs. +
向 LLM 暴露工具、资源和 prompts。
Apps
Apps
-
Give your tools interactive UIs rendered directly in the conversation. +
为你的工具提供直接在对话中渲染的交互式 UI。
Clients
Clients
-
Connect to any MCP server — local or remote, programmatic or CLI. +
连接任意 MCP 服务器——本地或远程、编程或 CLI。
-**[Servers](https://gofastmcp.com/servers/server)** wrap your Python functions into MCP-compliant tools, resources, and prompts. **[Clients](https://gofastmcp.com/clients/client)** connect to any server with full protocol support. And **[Apps](https://gofastmcp.com/apps/overview)** give your tools interactive UIs rendered directly in the conversation. +**[Servers](https://gofastmcp.com/servers/server)** 将你的 Python 函数封装为符合 MCP 规范的工具、资源和 prompts。**[Clients](https://gofastmcp.com/clients/client)** 以完整协议支持连接任意服务器。而 **[Apps](https://gofastmcp.com/apps/overview)** 为你的工具提供直接在对话中渲染的交互式 UI。 -Ready to build? Start with the [installation guide](https://gofastmcp.com/getting-started/installation) or jump straight to the [quickstart](https://gofastmcp.com/getting-started/quickstart). +准备好开始构建了吗?从[安装指南](https://gofastmcp.com/getting-started/installation) 入手,或直接跳到[快速入门](https://gofastmcp.com/getting-started/quickstart). -## Run FastMCP in production with Horizon +## 使用 Horizon 在生产环境运行 FastMCP -FastMCP is the standard way to build MCP servers. **[Prefect Horizon](https://www.prefect.io/horizon?utm_source=github&utm_medium=readme&utm_campaign=readme_horizon&utm_content=readme_body)** is the enterprise MCP gateway for running them safely. +FastMCP 是构建 MCP 服务器的标准方式。**[Prefect Horizon](https://www.prefect.io/horizon?utm_source=github&utm_medium=readme&utm_campaign=readme_horizon&utm_content=readme_body)** 是用于安全运行它们的企业级 MCP 网关。 -Built by the FastMCP team, Horizon packages the best practices we've learned shipping the world's most popular MCP framework. +由 FastMCP 团队打造,Horizon 打包了我们在交付全球最受欢迎的 MCP 框架过程中积累的最佳实践。 -Deploy FastMCP servers from GitHub with branch previews and instant rollback. Create a private registry of every MCP your company uses. Secure access with SSO and tool-level RBAC. Get audit logs, observability, and governance across your MCP stack. Remix approved tools into purpose-built endpoints for teams and agents. +从 GitHub 部署 FastMCP 服务器,支持分支预览和即时回滚。为公司使用的每个 MCP 创建私有注册表。通过 SSO 和工具级 RBAC 保障访问安全。在整个 MCP 技术栈上获取审计日志、可观测性和治理能力。将经批准的工具 remix 为面向团队与代理的专用端点。 -Start with FastMCP. [Scale with Horizon →](https://www.prefect.io/horizon?utm_source=github&utm_medium=readme&utm_campaign=readme_horizon&utm_content=readme_cta) +从 FastMCP 起步。[用 Horizon 规模化扩展 →](https://www.prefect.io/horizon?utm_source=github&utm_medium=readme&utm_campaign=readme_horizon&utm_content=readme_cta) -## Installation +## 安装 -We recommend installing FastMCP with [uv](https://docs.astral.sh/uv/): +我们建议使用 [uv](https://docs.astral.sh/uv/): 安装 FastMCP: ```bash uv pip install fastmcp ``` -For full installation instructions, including verification and upgrading, see the [**Installation Guide**](https://gofastmcp.com/getting-started/installation). +有关完整安装说明(包括验证与升级),请参阅 [**安装指南**](https://gofastmcp.com/getting-started/installation). -**Upgrading?** We have guides for: -- [Upgrading from FastMCP v2](https://gofastmcp.com/getting-started/upgrading/from-fastmcp-2) -- [Upgrading from the MCP Python SDK](https://gofastmcp.com/getting-started/upgrading/from-mcp-sdk) -- [Upgrading from the low-level SDK](https://gofastmcp.com/getting-started/upgrading/from-low-level-sdk) +**需要升级?** 我们提供以下指南: +- [从 FastMCP v2 升级](https://gofastmcp.com/getting-started/upgrading/from-fastmcp-2) +- [从 MCP Python SDK 升级](https://gofastmcp.com/getting-started/upgrading/from-mcp-sdk) +- [从底层 SDK 升级](https://gofastmcp.com/getting-started/upgrading/from-low-level-sdk) > [!NOTE] -> If `import fastmcp` fails right after a `pip` upgrade from FastMCP 3.2 or earlier, run `pip install --force-reinstall fastmcp`. See [Troubleshooting](https://gofastmcp.com/getting-started/installation#troubleshooting) for why this happens (`uv` is unaffected). +> 如果在从 FastMCP 3.2 或更早版本升级 `pip` 后,`import fastmcp` 立即失败,请运行 `pip install --force-reinstall fastmcp`。关于原因请参阅[故障排除](https://gofastmcp.com/getting-started/installation#troubleshooting)(`uv` 不受影响)。 -## 📚 Documentation +## 📚 文档 -FastMCP's complete documentation is available at **[gofastmcp.com](https://gofastmcp.com)**, including detailed guides, API references, and advanced patterns. +FastMCP 的完整文档可在 **[gofastmcp.com](https://gofastmcp.com)**, 获取,包括详细指南、API 参考和高级模式。 -Documentation is also available in [llms.txt format](https://llmstxt.org/), which is a simple markdown standard that LLMs can consume easily: +文档还提供 [llms.txt 格式](https://llmstxt.org/),,这是一种 LLM 易于消费的简单 Markdown 标准: -- [`llms.txt`](https://gofastmcp.com/llms.txt) is essentially a sitemap, listing all the pages in the documentation. -- [`llms-full.txt`](https://gofastmcp.com/llms-full.txt) contains the entire documentation. Note this may exceed the context window of your LLM. +- [`llms.txt`](https://gofastmcp.com/llms.txt) 本质上是一份站点地图,列出文档中的所有页面。 +- [`llms-full.txt`](https://gofastmcp.com/llms-full.txt) 包含完整文档。请注意,这可能会超出你的 LLM 上下文窗口。 -**Community:** Join our [Discord server](https://discord.gg/uu8dJCgttd) to connect with other FastMCP developers and share what you're building. +**社区:** 加入我们的 [Discord 服务器](https://discord.gg/uu8dJCgttd),与其他 FastMCP 开发者交流并分享你的作品。 -## Contributing +## 贡献 -We welcome contributions! See the [Contributing Guide](https://gofastmcp.com/development/contributing) for setup instructions, testing requirements, and PR guidelines. +我们欢迎贡献!请参阅[贡献指南](https://gofastmcp.com/development/contributing) 了解环境搭建说明、测试要求和 PR 规范。