43 lines
1.6 KiB
Markdown
43 lines
1.6 KiB
Markdown
---
|
||
title: "Modal Context Protocol (MCP)"
|
||
type: concept
|
||
tags: [ai, ai-agent, mcp, protocol]
|
||
sources: [mcp在cursor中的集成与应用详解]
|
||
last_updated: 2026-04-26
|
||
---
|
||
|
||
## Definition
|
||
MCP(Modal Context Protocol)是一种基于 **Client-Server 架构**的协议,旨在实现 AI 大模型与外部工具和服务的高效集成。MCP 为 AI 应用提供了标准化的工具扩展框架,使大模型能够无缝调用外部数据源和工具。
|
||
|
||
## Architecture
|
||
MCP 基于 Client-Server 架构,包含两个核心组件:
|
||
- **MCP Server(服务端)**:服务提供方,负责对外暴露资源和工具接口。
|
||
- **MCP Client(客户端)**:集成 MCP 协议的应用程序或大模型对话客户端(如 Cursor、Claude Desktop)。
|
||
|
||
## Core Interfaces
|
||
MCP Server 提供三类核心功能接口:
|
||
|
||
| 接口类型 | 类比 | 用途 |
|
||
|----------|------|------|
|
||
| 资源访问(Resource) | HTTP GET | 获取外部数据 |
|
||
| 工具调用(Tool) | HTTP POST | 执行外部操作 |
|
||
| Promise 提示词 | 扩展接口 | 异步交互 |
|
||
|
||
## MCP in Cursor
|
||
在 Cursor 中,MCP Server 有两种接入方式:
|
||
1. **SSE(Server-Sent Events)**:通过 HTTP SSE 方式连接远程 MCP Server。
|
||
2. **Command(命令行)**:通过本地执行命令的方式与 MCP Server 交互。
|
||
|
||
接入后在 Cursor Composer 中切换到 Agent 模式即可调用 MCP 工具链。
|
||
|
||
## Connections
|
||
- [[Mcp在Cursor中的集成与应用详解]] ← 使用场景
|
||
- [[McpBuilderAgent]] ← 构建工具
|
||
- [[Cursor]] ← 客户端
|
||
- [[SequentialThinking]] ← 常用 MCP 工具
|
||
|
||
## See Also
|
||
- [[ClientServerArchitecture]]
|
||
- [[AgentMode]]
|
||
- [[McpBuilderAgent]]
|