# 第四章 MCP 模型上下文协议

MCP（Model Context Protocol）是 Anthropic 推出的开放标准，让 Claude 能够安全地连接各种外部数据源和服务。

***

## 什么是 MCP？

MCP 是大模型对其他资源或工具的统一访问接口标准，就像 AI 世界的 **USB-C**，让 Claude 能够：

* 访问本地文件系统
* 连接数据库
* 集成第三方服务（GitHub、Slack、Google Drive 等）
* 使用自定义工具

***

## 本章学习目标

* [ ] 理解 MCP 的架构和核心概念
* [ ] 配置和使用 MCP 服务器
* [ ] 掌握常用 MCP 服务器
* [ ] 开发自定义 MCP 服务器

***

## 章节导航

| 章节                                                                        | 主题                 |
| ------------------------------------------------------------------------- | ------------------ |
| [4.1](/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp/4.1_intro.md)        | MCP 是什么：AI 的 USB-C |
| [4.2](/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp/4.2_architecture.md) | MCP 架构与核心概念        |
| [4.3](/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp/4.3_config.md)       | 配置与使用 MCP 服务器      |
| [4.4](/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp/4.4_practice.md)     | 常用 MCP 服务器实践       |
| [4.5](/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp/4.5_custom.md)       | 开发自定义 MCP 服务器      |

***

> 💡 MCP 可在 Claude Desktop 和 Claude Code 中直接使用，无需编写代码。
>
> 💡 **深入学习**：想了解如何使用 MCP 作为上下文工程的数据源？请参阅《Claude 技术指南》第 13.3 章《Context Engineering 概览：从提示词工程到上下文工程》。

***

> **📚 延伸阅读**：MCP 协议在 OpenClaw 中的实战集成案例，参见 [《OpenClaw 从入门到精通》第 12 章](https://yeasy.gitbook.io/openclaw_guide)；MCP 与上下文工程的结合，参见 [《大模型上下文工程权威指南》](https://yeasy.gitbook.io/context_engineering_guide)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/claude_guide/di-er-bu-fen-gong-ju-pian/04_mcp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
