Files
2026-07-13 11:08:54 +00:00

399 lines
34 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- WEHUB_ZH_README -->
> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/microsoft/mcp-for-beginners) · [上游 README](https://github.com/microsoft/mcp-for-beginners/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
![MCP-for-beginners](./images/mcp-beginners.png)
[![GitHub contributors](https://img.shields.io/github/contributors/microsoft/mcp-for-beginners.svg)](https://GitHub.com/microsoft/mcp-for-beginners/graphs/contributors)
[![GitHub issues](https://img.shields.io/github/issues/microsoft/mcp-for-beginners.svg)](https://GitHub.com/microsoft/mcp-for-beginners/issues)
[![GitHub pull-requests](https://img.shields.io/github/issues-pr/microsoft/mcp-for-beginners.svg)](https://GitHub.com/microsoft/mcp-for-beginners/pulls)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
[![GitHub watchers](https://img.shields.io/github/watchers/microsoft/mcp-for-beginners.svg?style=social&label=Watch)](https://GitHub.com/microsoft/mcp-for-beginners/watchers)
[![GitHub forks](https://img.shields.io/github/forks/microsoft/mcp-for-beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/mcp-for-beginners/fork)
[![GitHub stars](https://img.shields.io/github/stars/microsoft/mcp-for-beginners?style=social&label=Star)](https://GitHub.com/microsoft/mcp-for-beginners/stargazers)
[![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
按照以下步骤开始使用这些资源:
1. **Fork 仓库**:点击 [![GitHub forks](https://img.shields.io/github/forks/microsoft/mcp-for-beginners.svg?style=social&label=Fork)](https://GitHub.com/microsoft/mcp-for-beginners/fork)
2. **克隆仓库** `git clone https://github.com/microsoft/mcp-for-beginners.git`
3. **加入** [![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
### 🌐 多语言支持
#### 通过 GitHub Action 提供支持(自动化且始终保持最新)
<!-- CO-OP TRANSLATOR LANGUAGES TABLE START -->
[Arabic](./translations/ar/README.md) | [Bengali](./translations/bn/README.md) | [Bulgarian](./translations/bg/README.md) | [Burmese (Myanmar)](./translations/my/README.md) | [Chinese (Simplified)](./translations/zh-CN/README.md) | [Chinese (Traditional, Hong Kong)](./translations/zh-HK/README.md) | [Chinese (Traditional, Macau)](./translations/zh-MO/README.md) | [Chinese (Traditional, Taiwan)](./translations/zh-TW/README.md) | [Croatian](./translations/hr/README.md) | [Czech](./translations/cs/README.md) | [Danish](./translations/da/README.md) | [Dutch](./translations/nl/README.md) | [Estonian](./translations/et/README.md) | [Finnish](./translations/fi/README.md) | [French](./translations/fr/README.md) | [German](./translations/de/README.md) | [Greek](./translations/el/README.md) | [Hebrew](./translations/he/README.md) | [Hindi](./translations/hi/README.md) | [Hungarian](./translations/hu/README.md) | [Indonesian](./translations/id/README.md) | [Italian](./translations/it/README.md) | [Japanese](./translations/ja/README.md) | [Kannada](./translations/kn/README.md) | [Khmer](./translations/km/README.md) | [Korean](./translations/ko/README.md) | [Lithuanian](./translations/lt/README.md) | [Malay](./translations/ms/README.md) | [Malayalam](./translations/ml/README.md) | [Marathi](./translations/mr/README.md) | [Nepali](./translations/ne/README.md) | [Nigerian Pidgin](./translations/pcm/README.md) | [Norwegian](./translations/no/README.md) | [Persian (Farsi)](./translations/fa/README.md) | [Polish](./translations/pl/README.md) | [Portuguese (Brazil)](./translations/pt-BR/README.md) | [Portuguese (Portugal)](./translations/pt-PT/README.md) | [Punjabi (Gurmukhi)](./translations/pa/README.md) | [Romanian](./translations/ro/README.md) | [Russian](./translations/ru/README.md) | [Serbian (Cyrillic)](./translations/sr/README.md) | [Slovak](./translations/sk/README.md) | [Slovenian](./translations/sl/README.md) | [Spanish](./translations/es/README.md) | [Swahili](./translations/sw/README.md) | [Swedish](./translations/sv/README.md) | [Tagalog (Filipino)](./translations/tl/README.md) | [Tamil](./translations/ta/README.md) | [Telugu](./translations/te/README.md) | [Thai](./translations/th/README.md) | [Turkish](./translations/tr/README.md) | [Ukrainian](./translations/uk/README.md) | [Urdu](./translations/ur/README.md) | [Vietnamese](./translations/vi/README.md)
> **更倾向于在本地克隆?**
>
> 本仓库包含 50 多种语言翻译,会显著增加下载体积。若要在克隆时排除翻译内容,请使用 sparse checkout(稀疏检出):
>
> **Bash / macOS / Linux**
> ```bash
> git clone --filter=blob:none --sparse https://github.com/microsoft/mcp-for-beginners.git
> cd mcp-for-beginners
> git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'
> ```
>
> **CMD (Windows)**
> ```cmd
> git clone --filter=blob:none --sparse https://github.com/microsoft/mcp-for-beginners.git
> cd mcp-for-beginners
> git sparse-checkout set --no-cone "/*" "!translations" "!translated_images"
> ```
>
> 这样你就能获得完成课程所需的全部内容,同时下载速度会快得多。
<!-- CO-OP TRANSLATOR LANGUAGES TABLE END -->
# 🚀 面向初学者的 Model Context Protocol (MCP) 课程
## **通过 C#、Java、JavaScript、Rust、Python 和 TypeScript 的动手代码示例学习 MCP**
## 🧠 Model Context Protocol 课程概览
欢迎来到 Model Context Protocol 的学习之旅!如果你曾好奇 AI 应用如何与不同工具和服务通信,你即将发现一种优雅的解决方案——它正在改变开发者构建智能系统的方式。
可以把 MCP 想象成 AI 应用的通用翻译器——就像 USB 接口让你能把任何设备连接到电脑一样,MCP 让 AI 模型能以标准化方式连接任何工具或服务。无论你是在构建第一个聊天机器人,还是在处理复杂的 AI 工作流,理解 MCP 都能让你创建更强大、更灵活的应用。
本课程耐心而细致地围绕你的学习路径设计。我们会从你已熟悉的简单概念出发,通过你喜爱的编程语言中的动手实践,逐步提升你的能力。每一步都包含清晰的讲解、实用的示例,以及一路上的鼓励与支持。
完成这段学习之旅后,你将有信心构建自己的 MCP 服务器,将其与主流 AI 平台集成,并理解这项技术如何重塑 AI 开发的未来。让我们一起开启这段激动人心的旅程吧!
### 官方文档与规范
本课程与 **MCP Specification 2025-11-25**(最新稳定版本)保持一致。MCP 规范采用基于日期的版本号(YYYY-MM-DD 格式),以确保协议版本追踪清晰明确。
> **展望未来:** 下一版规范的候选发布版本 **2026-07-28** 计划于 2026 年 7 月 28 日发布。该版本将在传输层使协议无状态(stateless),正式确立 Extensions 框架(MCP Apps、Tasks),加强授权机制,并弃用 Roots、Sampling 和 Logging。完整说明请参阅 [What's Changing in MCP: The 2026-07-28 Release Candidate](./01-CoreConcepts/mcp-2026-07-28-release-candidate.md)。
随着理解的加深,这些资源会愈发有价值,但不必有立刻读完所有内容的压力。先从你最感兴趣的领域开始吧!
- 📘 [MCP Documentation](https://modelcontextprotocol.io/) – 这是你获取分步教程和用户指南的首选资源。文档面向初学者编写,提供清晰示例,你可以按自己的节奏跟随学习。
- 📜 [MCP Specification](https://modelcontextprotocol.io/specification/2025-11-25) – 可将其视为你的全面参考手册。在学习课程的过程中,你会经常回到这里查阅具体细节并探索高级功能。
- 📜 [MCP Specification Versioning](https://modelcontextprotocol.io/specification/versioning) – 其中包含协议版本历史信息,以及 MCP 如何使用基于日期的版本号(YYYY-MM-DD 格式)。
- 🧑‍💻 [MCP GitHub Repository](https://github.com/modelcontextprotocol) – 在这里你可以找到多种编程语言的 SDK、工具和代码示例。它就像一座宝库,满是实用示例和可直接使用的组件。
- 🌐 [MCP Community](https://github.com/orgs/modelcontextprotocol/discussions) 与 fellow learners 和经验丰富的开发者一起讨论 MCP。这是一个互助社区,欢迎提问,知识自由分享。
## 学习目标
完成本课程后,你将对自己的新能力充满信心并充满期待。以下是你将达成的目标:
**理解 MCP 基础**:你将掌握 Model Context Protocol(模型上下文协议)是什么,以及它为何正在革新 AI 应用之间的协作方式,并通过易于理解的类比和示例来加深认识。
**构建你的第一个 MCP 服务器**:你将以自己偏好的编程语言创建一个可运行的 MCP 服务器,从简单示例起步,循序渐进地提升技能。
**将 AI 模型连接到真实工具**:你将学习如何弥合 AI 模型与实际服务之间的鸿沟,为你的应用赋予强大的新能力。
**实施安全最佳实践**:你将了解如何保障 MCP 实现的安全可靠,保护你的应用和用户。
**自信地部署**:你将掌握如何将 MCP 项目从开发推向生产,并运用在真实环境中行之有效的实用部署策略。
**加入 MCP 社区**:你将成为不断壮大的开发者社区的一员,共同塑造 AI 应用开发的未来。
## 必备背景知识
在深入 MCP 细节之前,让我们先确保你对一些基础概念感到得心应手。即便你在这些领域并非专家也无需担心——我们会在学习过程中解释你需要了解的一切!
### 理解协议(基础)
可以把协议想象成一场对话的规则。当你给朋友打电话时,你们都知道接听时说「你好」,轮流说话,结束时说「再见」。计算机程序也需要类似的规则才能有效通信。
MCP 是一种协议——一套约定好的规则,帮助 AI 模型和应用与工具和服务进行富有成效的「对话」。就像对话规则让人类交流更顺畅一样,MCP 让 AI 应用之间的通信更加可靠、更加强大。
### 客户端-服务器关系(程序如何协同工作)
你每天都在使用客户端-服务器关系!当你用 Web 浏览器(客户端)访问网站时,你连接的是向你发送页面内容的 Web 服务器。浏览器知道如何请求信息,服务器知道如何响应。
在 MCP 中,我们也有类似的关系:AI 模型充当客户端,请求信息或操作;MCP 服务器则提供这些能力。这就像有一个得力助手(服务器),AI 可以请它执行特定任务。
### 为何标准化很重要(让事物协同工作)
想象一下,如果每家汽车制造商都使用不同形状的加油泵——你就需要为每辆车配备不同的转接头!标准化意味着就通用方法达成一致,使事物能够无缝协同工作。
MCP 为 AI 应用提供了这种标准化。与其让每个 AI 模型都需要定制代码才能与每个工具配合,MCP 为它们创造了一种通用的通信方式。这意味着开发者可以一次构建工具,就能与多种不同的 AI 系统配合使用。
## 🧭 学习路径概览
你的 MCP 学习之旅经过精心设计,将逐步建立你的信心与技能。每个阶段都会引入新概念,同时巩固你已学内容。
### 🌱 基础阶段:理解基础知识(模块 0-2)
你的冒险从这里开始!我们将用熟悉的类比和简单示例介绍 MCP 概念。你将理解 MCP 是什么、为何存在,以及它如何融入更广阔的 AI 开发生态。
**模块 0 - MCP 简介**:我们将首先探索 MCP 是什么,以及它对现代 AI 应用为何如此重要。你将看到 MCP 在实际场景中的真实示例,并理解它如何解决开发者面临的常见问题。
**模块 1 - 核心概念详解**:在这里你将学习 MCP 的基本构建块。我们会大量使用类比和可视化示例,确保这些概念感觉自然且易于理解。
**模块 2 - MCP 中的安全**:安全听起来可能令人望而生畏,但我们会展示 MCP 如何内置安全特性,并教你从一开始就保护应用的最佳实践。
### 🔨 构建阶段:创建你的首批实现(模块 3)
真正的乐趣现在开始!你将动手构建真实的 MCP 服务器和客户端。别担心——我们会从简单入手,一步步引导你完成。
本模块包含多份动手指南,让你可以用自己偏好的编程语言进行练习。你将创建第一个服务器、构建连接它的客户端,甚至与 VS Code 等流行开发工具集成。
每份指南都包含完整代码示例、故障排查技巧,以及对特定设计选择原因的说明。到本阶段结束时,你将拥有值得骄傲的、可运行的 MCP 实现!
### 🚀 成长阶段:高级概念与实际应用(模块 4-5)
掌握基础后,你已准备好探索更复杂的 MCP 功能。我们将涵盖实用实现策略、调试技巧,以及多模态 AI 集成等高级主题。
你还将学习如何为生产使用扩展 MCP 实现,并与 Azure 等云平台集成。这些模块将帮助你构建能够应对真实世界需求的 MCP 解决方案。
### 🌟 精通阶段:社区与专业化(模块 6-11)
最后阶段聚焦于加入 MCP 社区,并在你最感兴趣的领域深耕。你将学习如何为开源 MCP 项目做贡献、实现高级认证模式,并构建全面的数据库集成解决方案。
模块 11 值得特别一提——它是一条完整的 13 个实验动手学习路径,教你构建可与 PostgreSQL 集成的生产级 MCP 服务器。它就像一份毕业设计,将你所学融会贯通!
### 📚 完整课程结构
| Module | Topic | Description | Link |
|--------|-------|-------------|------|
| **Module 0-3: Fundamentals** | | | |
| 00 | Introduction to MCP | Model Context Protocol 概览及其在 AI 流水线中的意义 | [Read more](./00-Introduction/README.md) |
| 01 | Core Concepts Explained | 深入探索 MCP 核心概念 | [Read more](./01-CoreConcepts/README.md) |
| 1.1 | What's Changing in MCP (2026-07-28 RC) | 无状态协议、Extensions 框架,以及下一版规范中的功能弃用 | [Guide](./01-CoreConcepts/mcp-2026-07-28-release-candidate.md) |
| 02 | Security in MCP | 安全威胁与最佳实践 | [Read more](./02-Security/README.md) |
| 03 | Getting Started with MCP | 环境搭建、基础服务器/客户端、集成 | [Read more](./03-GettingStarted/README.md) |
| **Module 3: Building Your First Server & Client** | | | |
| 3.1 | First Server | 创建你的第一个 MCP 服务器 | [Guide](./03-GettingStarted/01-first-server/README.md) |
| 3.2 | First Client | 开发基础 MCP 客户端 | [Guide](./03-GettingStarted/02-client/README.md) |
| 3.3 | Client with LLM | 集成大语言模型 | [Guide](./03-GettingStarted/03-llm-client/README.md) |
| 3.4 | VS Code Integration | 在 VS Code 中使用 MCP 服务器 | [Guide](./03-GettingStarted/04-vscode/README.md) |
| 3.5 | stdio Server | 使用 stdio 传输创建服务器 | [Guide](./03-GettingStarted/05-stdio-server/README.md) |
| 3.6 | HTTP Streaming | 在 MCP 中实现 HTTP 流式传输 | [Guide](./03-GettingStarted/06-http-streaming/README.md) |
| 3.7 | Microsoft Foundry Toolkit | 将 Microsoft Foundry Toolkit 与 MCP 配合使用 | [Guide](./03-GettingStarted/07-aitk/README.md) |
| 3.8 | Testing | 测试你的 MCP 服务器实现 | [Guide](./03-GettingStarted/08-testing/README.md) |
| 3.9 | Deployment | 将 MCP 服务器部署到生产环境 | [Guide](./03-GettingStarted/09-deployment/README.md) |
| 3.10 | Advanced server usage | 使用高级服务器实现高级功能并改进架构 | [Guide](./03-GettingStarted/10-advanced/README.md) |
| 3.11 | Simple auth | 从零讲解认证与 RBAC 的章节 | [Guide](./03-GettingStarted/11-simple-auth/README.md) |
| 3.12 | MCP Hosts | 配置 Claude Desktop、Cursor、Cline 及其他 MCP 宿主 | [Guide](./03-GettingStarted/12-mcp-hosts/README.md) |
| 3.13 | MCP Inspector | 使用 Inspector 工具调试和测试 MCP 服务器 | [Guide](./03-GettingStarted/13-mcp-inspector/README.md) |
| 3.14 | Sampling | 使用 sampling 与客户端协作 | [Guide](./03-GettingStarted/14-sampling/README.md) |
| 3.15 | MCP Apps | 构建 MCP Apps | [Guide](./03-GettingStarted/15-mcp-apps/README.md) |
| **Module 4-5: Practical & Advanced** | | | |
| 04 | Practical Implementation | SDK、调试、测试、可复用提示模板 | [Read more](./04-PracticalImplementation/README.md) |
| 4.1 | Pagination | 使用基于游标的分页处理大型结果集 | [Guide](./04-PracticalImplementation/pagination/README.md) |
| 05 | Advanced Topics in MCP | 多模态 AI、扩展、企业级使用 | [Read more](./05-AdvancedTopics/README.md) |
| 5.1 | Azure Integration | 与 Azure 的 MCP 集成 | [Guide](./05-AdvancedTopics/mcp-integration/README.md) |
| 5.2 | Multi-modality | 处理多种模态 | [Guide](./05-AdvancedTopics/mcp-multi-modality/README.md) |
| 5.3 | OAuth2 Demo | 实现 OAuth2 认证 | [Guide](./05-AdvancedTopics/mcp-oauth2-demo/README.md) |
| 5.4 | Root Contexts | 理解并实现 root contexts | [Guide](./05-AdvancedTopics/mcp-root-contexts/README.md) |
| 5.5 | Routing | MCP 路由策略 | [Guide](./05-AdvancedTopics/mcp-routing/README.md) |
| 5.6 | Sampling | MCP 中的 sampling 技术 | [Guide](./05-AdvancedTopics/mcp-sampling/README.md) |
| 5.7 | Scaling | 扩展 MCP 实现 | [Guide](./05-AdvancedTopics/mcp-scaling/README.md) |
| 5.8 | Security | 高级安全考量 | [Guide](./05-AdvancedTopics/mcp-security/README.md) |
| 5.9 | Web Search | 实现 Web 搜索能力 | [Guide](./05-AdvancedTopics/web-search-mcp/README.md) |
| 5.10 | Realtime Streaming | 构建实时流式传输功能 | [Guide](./05-AdvancedTopics/mcp-realtimestreaming/README.md) |
| 5.11 | Realtime Search | 实现实时搜索 | [Guide](./05-AdvancedTopics/mcp-realtimesearch/README.md) |
| 5.12 | Entra ID Auth | 使用 Microsoft Entra ID 进行认证 | [Guide](./05-AdvancedTopics/mcp-security-entra/README.md) |
| 5.13 | Foundry Integration | 与 Microsoft Foundry 集成 | [Guide](./05-AdvancedTopics/mcp-foundry-agent-integration/README.md) |
| 5.14 | Context Engineering | 高效上下文工程(Context Engineering)技术 | [Guide](./05-AdvancedTopics/mcp-contextengineering/README.md) |
| 5.15 | MCP Custom Transport | 自定义 Transport 实现 | [Guide](./05-AdvancedTopics/mcp-transport/README.md) |
| 5.16 | Protocol Features | 进度通知、取消、资源模板 | [Guide](./05-AdvancedTopics/mcp-protocol-features/README.md) |
| 5.17 | Adversarial Multi-Agent Reasoning | 两个智能体使用共享 MCP 工具持相反立场辩论,由评判智能体评估 | [Guide](./05-AdvancedTopics/mcp-adversarial-agents/README.md) |
| **Module 6-10: Community & Best Practices** | | | |
| 06 | Community Contributions | 如何为 MCP 生态做贡献 | [Guide](./06-CommunityContributions/README.md) |
| 07 | Insights from Early Adoption | 真实世界的实现案例 | [Guide](./07-LessonsfromEarlyAdoption/README.md) |
| 08 | Best Practices for MCP | 性能、容错、韧性 | [Guide](./08-BestPractices/README.md) |
| 09 | MCP Case Studies | 实用实现示例 | [Guide](./09-CaseStudy/README.md) |
| 10 | Hands-on Workshop | 使用 Microsoft Foundry Toolkit 构建 MCP 服务器 | [Lab](./10-StreamliningAIWorkflowsBuildingAnMCPServerWithAIToolkit/README.md) |
| **Module 11: MCP Server Hands On Lab** | | | |
| 11 | MCP Server Database Integration | 面向 PostgreSQL 集成的完整 13 个实验动手学习路径 | [Labs](./11-MCPServerHandsOnLabs/README.md) |
| 11.1 | Introduction | MCP 与数据库集成概览及零售分析用例 | [Lab 00](./11-MCPServerHandsOnLabs/00-Introduction/README.md) |
| 11.2 | Core Architecture | 理解 MCP 服务器架构、数据库层与安全模式 | [Lab 01](./11-MCPServerHandsOnLabs/01-Architecture/README.md) |
| 11.3 | Security & Multi-Tenancy | 行级安全(Row Level Security)、认证与多租户数据访问 | [Lab 02](./11-MCPServerHandsOnLabs/02-Security/README.md) |
| 11.4 | Environment Setup | 搭建开发环境、Docker、Azure 资源 | [Lab 03](./11-MCPServerHandsOnLabs/03-Setup/README.md) |
| 11.5 | Database Design | PostgreSQL 搭建、零售模式设计与示例数据 | [Lab 04](./11-MCPServerHandsOnLabs/04-Database/README.md) |
| 11.6 | MCP Server Implementation | 构建带数据库集成的 FastMCP 服务器 | [Lab 05](./11-MCPServerHandsOnLabs/05-MCP-Server/README.md) |
| 11.7 | Tool Development | 创建数据库查询工具与模式内省 | [Lab 06](./11-MCPServerHandsOnLabs/06-Tools/README.md) |
| 11.8 | Semantic Search | 使用 Azure OpenAI 与 pgvector 实现向量嵌入 | [Lab 07](./11-MCPServerHandsOnLabs/07-Semantic-Search/README.md) |
| 11.9 | Testing & Debugging | 测试策略、调试工具与验证方法 | [Lab 08](./11-MCPServerHandsOnLabs/08-Testing/README.md) |
| 11.10 | VS Code Integration | 配置 VS Code MCP 集成与 AI Chat 使用 | [Lab 09](./11-MCPServerHandsOnLabs/09-VS-Code/README.md) |
| 11.11 | Deployment Strategies | Docker 部署、Azure Container Apps 与扩展考量 | [Lab 10](./11-MCPServerHandsOnLabs/10-Deployment/README.md) |
| 11.12 | Monitoring | Application Insights、日志与性能监控 | [Lab 11](./11-MCPServerHandsOnLabs/11-Monitoring/README.md) |
| 11.13 | Best Practices | 性能优化、安全加固与生产环境技巧 | [Lab 12](./11-MCPServerHandsOnLabs/12-Best-Practices/README.md) |
| **Module 12: MCP Tooling** | | | |
| 12.1 | Tooling | Copilot App 中的 MCP 使用 | [ Guide ](./12-tooling/README.md) |
### 💻 示例代码项目
学习 MCP 最令人兴奋的部分之一,就是见证自己的编程能力逐步提升。我们设计的代码示例从简单入手,并随着你对 MCP 理解的加深而愈发完善。以下是我们引入概念的方式——通过易于理解却能体现真实 MCP 原则的代码,你不仅能明白这段代码在做什么,还能理解它为何如此组织,以及它如何融入更大的 MCP 应用。
#### 基础 MCP 计算器示例
| Language | Description | Link |
|----------|-------------|------|
| C# | MCP Server Example | [View Code](./03-GettingStarted/samples/csharp/README.md) |
| Java | MCP Calculator | [View Code](./03-GettingStarted/samples/java/calculator/README.md) |
| JavaScript | MCP Demo | [View Code](./03-GettingStarted/samples/javascript/README.md) |
| Python | MCP Server | [View Code](./03-GettingStarted/samples/python/mcp_calculator_server.py) |
| TypeScript | MCP Example | [View Code](./03-GettingStarted/samples/typescript/README.md) |
| Rust | MCP Example | [View Code](./03-GettingStarted/samples/rust/README.md) |
#### 高级 MCP 实现
| Language | Description | Link |
|----------|-------------|------|
| C# | Advanced Sample | [View Code](./04-PracticalImplementation/samples/csharp/README.md) |
| Java with Spring | Container App Example | [View Code](./04-PracticalImplementation/samples/java/containerapp/README.md) |
| JavaScript | Advanced Sample | [View Code](./04-PracticalImplementation/samples/javascript/README.md) |
| Python | Complex Implementation | [View Code](./04-PracticalImplementation/samples/python/README.md) |
| TypeScript | Container Sample | [View Code](./04-PracticalImplementation/samples/typescript/README.md) |
## 🎯 学习 MCP 的前置条件
要充分利用本课程体系,你应具备:
- 至少掌握以下一门语言的基础编程知识:C#、Java、JavaScript、Python 或 TypeScript
- 理解客户端-服务器(client-server)模型与 API
- 熟悉 REST 与 HTTP 概念
- (可选)具备 AI/ML 相关背景
- 参与我们的社区讨论以获得支持
## 📚 学习指南与资源
本仓库提供多项资源,帮助你高效浏览并学习:
### 学习指南
我们提供了一份全面的[学习指南](./study_guide.md),帮助你高效浏览本仓库。这份可视化的课程地图展示了各主题之间的关联,并指导你如何有效使用示例项目。若你是喜欢先把握全局的视觉型学习者,它会特别有帮助。
该指南包括:
- 展示所有涵盖主题的可视化课程地图
- 各仓库章节的详细拆解
- 如何使用示例项目的指导
- 面向不同技能水平的推荐学习路径
- 补充你学习之旅的额外资源
### 更新日志
我们维护一份详细的[更新日志](./changelog.md),记录课程体系材料的所有重要更新,便于你及时了解最新改进与新增内容。
- 新增内容
- 结构调整
- 功能改进
- 文档更新
## 🛠️ 如何有效使用本课程体系
本指南中的每节课都包含:
1. 对 MCP 概念的清晰讲解
2. 多种语言的实时代码示例
3. 用于构建真实 MCP 应用的练习
4. 面向进阶学习者的额外资源
### 用 C# 学习 MCP——教程系列
让我们了解模型上下文协议(Model Context ProtocolMCP)——一个旨在标准化 AI 模型与客户端应用之间交互的前沿框架。通过这场对初学者友好的课程,我们将向你介绍 MCP,并引导你创建第一个 MCP 服务器。
#### C#: [https://aka.ms/letslearnmcp-csharp](https://aka.ms/letslearnmcp-csharp)
#### Java: [https://aka.ms/letslearnmcp-java](https://aka.ms/letslearnmcp-java)
#### JavaScript: [https://aka.ms/letslearnmcp-javascript](https://aka.ms/letslearnmcp-javascript)
#### Python: [https://aka.ms/letslearnmcp-python](https://aka.ms/letslearnmcp-python)
## 🎓 你的 MCP 之旅从这里开始
恭喜!你刚刚迈出了激动人心旅程的第一步;它将拓展你的编程能力,并让你与 AI 开发的前沿紧密相连。
### 你已经取得的进展
通读本介绍后,你已经开始搭建 MCP 知识基础。你理解了 MCP 是什么、它为何重要,以及本课程体系将如何支持你的学习之旅。这是一项重要成就,也是你在这一关键技术领域积累专业能力的起点。
### 前方的探索
随着你逐步完成各模块,请记住:每位专家都曾是初学者。如今看似复杂的概念,会在你不断练习与应用后变得得心应手。每一个小步都会汇聚成强大的能力,并在你的开发生涯中持续发挥作用。
### 你的支持网络
你将加入一个由学习者和专家组成的社区;他们热爱 MCP,并乐于帮助他人成功。无论你卡在编码难题上,还是兴奋地想要分享突破,社区都会支持你的旅程。
如果你在构建 AI 应用时遇到困难,或对任何问题存有疑问,可与同伴学习者和经验丰富的开发者一起讨论 MCP。这是一个友善的社区:欢迎提问,知识自由分享。
[![Microsoft Foundry Discord](https://dcbadge.limes.pink/api/server/nTYy5BXMWG)](https://discord.gg/nTYy5BXMWG)
如果你在构建过程中有产品反馈或发现错误,请访问:
[![Microsoft Foundry Developer Forum](https://img.shields.io/badge/GitHub-Microsoft_Foundry_Developer_Forum-blue?style=for-the-badge&logo=github&color=000000&logoColor=fff)](https://aka.ms/foundry/forum)
### 准备好开始了吗?
你的 MCP 冒险现在开始!从模块 0 开始,进入你的第一次 MCP 动手实践;或浏览示例项目,看看你将构建什么。请记住——每位专家都曾站在你现在的位置;凭借耐心与练习,你会对自己能取得的成就感到惊喜。
欢迎来到模型上下文协议(Model Context Protocol)开发的世界。让我们一起构建精彩的作品!
## 🤝 为学习社区做贡献
本课程体系会因像你这样的学习者贡献而更加完善!无论你是修正笔误、提出更清晰的表述,还是新增示例,你的贡献都能帮助其他初学者成功。
感谢 Microsoft 最有价值专家(Most Valuable Professional[Shivam Goyal](https://www.linkedin.com/in/shivam2003/) 贡献代码示例。
贡献流程旨在友好且易于上手。大多数贡献需要签署贡献者许可协议(Contributor License AgreementCLA),但自动化工具会顺畅地引导你完成流程。
## 📜 开源学习
整套课程体系均在 MIT [LICENSE](./LICENSE) 许可下提供,这意味着你可以自由使用、修改和分享。这支持我们让 MCP 知识惠及全球开发者的使命。
## 🤝 贡献指南
本项目欢迎贡献与建议。大多数贡献要求你同意贡献者许可协议(Contributor License AgreementCLA),声明你有权且确实授予我们使用你贡献内容的权利。详情请访问 <https://cla.opensource.microsoft.com>。
当你提交拉取请求(pull request)时,CLA 机器人会自动判断你是否需要提供 CLA,并相应地标注 PR(例如状态检查、评论)。只需按照机器人提供的说明操作即可。在我们使用 CLA 的所有仓库中,你只需完成一次该流程。
本项目已采用 [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
更多信息请参阅 [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 或
联系 [opencode@microsoft.com](mailto:opencode@microsoft.com) 提出任何其他问题或意见。
---
*准备好开启你的 MCP 之旅了吗?从 [Module 00 - Introduction to MCP](./00-Introduction/README.md) 开始,迈出进入 Model Context Protocol(模型上下文协议)开发世界的第一步!*
## 🎒 其他课程
我们团队还制作了其他课程!快来看看:
<!-- CO-OP TRANSLATOR OTHER COURSES START -->
### LangChain
[![LangChain4j for Beginners](https://img.shields.io/badge/LangChain4j%20for%20Beginners-22C55E?style=for-the-badge&&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchain4j-for-beginners)
[![LangChain.js for Beginners](https://img.shields.io/badge/LangChain.js%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://aka.ms/langchainjs-for-beginners?WT.mc_id=m365-94501-dwahlin)
[![LangChain for Beginners](https://img.shields.io/badge/LangChain%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=0553D6)](https://github.com/microsoft/langchain-for-beginners?WT.mc_id=m365-94501-dwahlin)
---
### Azure / Edge / MCP / Agents
[![AZD for Beginners](https://img.shields.io/badge/AZD%20for%20Beginners-0078D4?style=for-the-badge&labelColor=E5E7EB&color=0078D4)](https://github.com/microsoft/AZD-for-beginners?WT.mc_id=academic-105485-koreyst)
[![Edge AI for Beginners](https://img.shields.io/badge/Edge%20AI%20for%20Beginners-00B8E4?style=for-the-badge&labelColor=E5E7EB&color=00B8E4)](https://github.com/microsoft/edgeai-for-beginners?WT.mc_id=academic-105485-koreyst)
[![MCP for Beginners](https://img.shields.io/badge/MCP%20for%20Beginners-009688?style=for-the-badge&labelColor=E5E7EB&color=009688)](https://github.com/microsoft/mcp-for-beginners?WT.mc_id=academic-105485-koreyst)
[![AI Agents for Beginners](https://img.shields.io/badge/AI%20Agents%20for%20Beginners-00C49A?style=for-the-badge&labelColor=E5E7EB&color=00C49A)](https://github.com/microsoft/ai-agents-for-beginners?WT.mc_id=academic-105485-koreyst)
---
### 生成式 AI 系列
[![Generative AI for Beginners](https://img.shields.io/badge/Generative%20AI%20for%20Beginners-8B5CF6?style=for-the-badge&labelColor=E5E7EB&color=8B5CF6)](https://github.com/microsoft/generative-ai-for-beginners?WT.mc_id=academic-105485-koreyst)
[![Generative AI (.NET)](https://img.shields.io/badge/Generative%20AI%20(.NET)-9333EA?style=for-the-badge&labelColor=E5E7EB&color=9333EA)](https://github.com/microsoft/Generative-AI-for-beginners-dotnet?WT.mc_id=academic-105485-koreyst)
[![Generative AI (Java)](https://img.shields.io/badge/Generative%20AI%20(Java)-C084FC?style=for-the-badge&labelColor=E5E7EB&color=C084FC)](https://github.com/microsoft/generative-ai-for-beginners-java?WT.mc_id=academic-105485-koreyst)
[![Generative AI (JavaScript)](https://img.shields.io/badge/Generative%20AI%20(JavaScript)-E879F9?style=for-the-badge&labelColor=E5E7EB&color=E879F9)](https://github.com/microsoft/generative-ai-with-javascript?WT.mc_id=academic-105485-koreyst)
---
### 核心学习
[![ML for Beginners](https://img.shields.io/badge/ML%20for%20Beginners-22C55E?style=for-the-badge&labelColor=E5E7EB&color=22C55E)](https://aka.ms/ml-beginners?WT.mc_id=academic-105485-koreyst)
[![Data Science for Beginners](https://img.shields.io/badge/Data%20Science%20for%20Beginners-84CC16?style=for-the-badge&labelColor=E5E7EB&color=84CC16)](https://aka.ms/datascience-beginners?WT.mc_id=academic-105485-koreyst)
[![AI for Beginners](https://img.shields.io/badge/AI%20for%20Beginners-A3E635?style=for-the-badge&labelColor=E5E7EB&color=A3E635)](https://aka.ms/ai-beginners?WT.mc_id=academic-105485-koreyst)
[![Cybersecurity for Beginners](https://img.shields.io/badge/Cybersecurity%20for%20Beginners-F97316?style=for-the-badge&labelColor=E5E7EB&color=F97316)](https://github.com/microsoft/Security-101?WT.mc_id=academic-96948-sayoung)
[![Web Dev for Beginners](https://img.shields.io/badge/Web%20Dev%20for%20Beginners-EC4899?style=for-the-badge&labelColor=E5E7EB&color=EC4899)](https://aka.ms/webdev-beginners?WT.mc_id=academic-105485-koreyst)
[![IoT for Beginners](https://img.shields.io/badge/IoT%20for%20Beginners-14B8A6?style=for-the-badge&labelColor=E5E7EB&color=14B8A6)](https://aka.ms/iot-beginners?WT.mc_id=academic-105485-koreyst)
[![XR Development for Beginners](https://img.shields.io/badge/XR%20Development%20for%20Beginners-38BDF8?style=for-the-badge&labelColor=E5E7EB&color=38BDF8)](https://github.com/microsoft/xr-development-for-beginners?WT.mc_id=academic-105485-koreyst)
---
### Copilot 系列
[![Copilot for AI Paired Programming](https://img.shields.io/badge/Copilot%20for%20AI%20Paired%20Programming-FACC15?style=for-the-badge&labelColor=E5E7EB&color=FACC15)](https://aka.ms/GitHubCopilotAI?WT.mc_id=academic-105485-koreyst)
[![Copilot for C#/.NET](https://img.shields.io/badge/Copilot%20for%20C%23/.NET-FBBF24?style=for-the-badge&labelColor=E5E7EB&color=FBBF24)](https://github.com/microsoft/mastering-github-copilot-for-dotnet-csharp-developers?WT.mc_id=academic-105485-koreyst)
[![Copilot Adventure](https://img.shields.io/badge/Copilot%20Adventure-FDE68A?style=for-the-badge&labelColor=E5E7EB&color=FDE68A)](https://github.com/microsoft/CopilotAdventures?WT.mc_id=academic-105485-koreyst)
<!-- CO-OP TRANSLATOR OTHER COURSES END -->