【教程】MCP 保姆级教程
【教程】MCP 保姆级教程
微信:445991224AI 速览
本文讨论了MCP幼儿园级别入门图文教程,介绍了MCP的概念、实操步骤、补充案例等内容,帮助读者上手体验解锁AI的动手能力。关键要点包括:
- MCP简介:MCP即模型上下文协议,规定外部数据和工具与大模型的连接和“交流”方式。MCP Host是支持调用MCP工具的大模型对话客户端,MCP Server是开发者基于MCP协议开发的“工具”程序。
- Cursor前置准备:需下载Cursor客户端和Node.js,配置MCP工具清单,在Cursor软件的设置中操作,创建mcp.json文件并粘贴配置代码,添加服务亮起绿灯表示准备就绪。
- 优化体验:可在Cursor Settings -> “Features” -> “Agent”中打开 “auto-run mode” 开关,避免每次调用弹窗确认,也可添加禁止的命令防止误操作。
- MCP工具使用:在Agent模式下询问问题,可了解可用工具及其功能。查找新工具需了解mcp.json服务器清单,可删除不用的工具代码块,也可从网站复制新工具代码添加到mcp.json文件。
- 补充案例:以添加高德地图功能为例,需先在高德开放平台创建API Key,再将特定代码复制到mcp.json文件。
📌 简介
- 本文档是一份详细的 MCP 幼儿园级别入门图文教程,旨在带你先上手,体验 解锁 AI的 动手能力!
- 本期视频教程在这里哦~ 👇
一、MCP简介
Anthropic MCP 官方指南:https://docs.anthropic.com/en/docs/agents-and-tools/mcp
MCP (Model Context Protocol)模型上下文协议。
简单来说:
- MCP 本身是一个协议:规定了外部的数据和工具怎么样跟大模型连接和“交流”。
- MCP Host:支持调用MCP工具的各类大模型对话客户端,例如cursor
- MCP Server:开发者基于 MCP 协议开发的各种“工具”,本质上是一个具备某种功能的程序,比如可以文件操作、网页浏览等。
我们只需要准备好环境,简单配置后,AI 就能在需要时,自己挑选合适的工具干活啦!💪
二、实操
1. Cursor 前置准备
第一步:下载 Cursor 客户端
- 访问 Cursor 官网下载并安装
- Cursor是一个支持 MCP 的 AI 编程工具
第二步:下载 Node.js
- 访问 Node.js 官网下载 LTS 版本并安装。
- 常规安装即可。
- 验证安装(可选):
a. 打开电脑的“命令提示符 (cmd)”
b. 输入node -v并按回车
c. 如果显示版本号,就说明安装成功
第三步:配置 MCP 工具清单
- 打开 Cursor 软件
- 找到 “首选项” (Preferences) -> “Cursor Settings”
- 在设置里找到 MCP 选项卡,并点击 “Add a new global MCP server”
- 如果是第一次,会提示创建
mcp.json文件,点击 创建 (Create)这个文件就是你的“工具清单”
- 复制 MCP 配置代码,粘贴到刚刚创建的
mcp.json文件里(可以手动修改和限制本地文件操作的盘符地址)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80{
"mcpServers": {
"@smithery-ai-server-sequential-thinking": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@smithery-ai/server-sequential-thinking",
"--config",
"{}"
]
},
"@smithery-ai-fetch": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@smithery-ai/fetch",
"--config",
"{}"
]
},
"files": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@modelcontextprotocol/server-filesystem",
"C:/Users/Administrator/Desktop" // 修改为你允许操作的盘符地址
]
},
"@wopal-mcp-server-hotnews": {
"command": "cmd",
"args": [
"/c",
"npx",
"@wopal/mcp-server-hotnews"
]
}
,
"playwright": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@executeautomation/playwright-mcp-server"
]
},
"hn-server": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@pskill9/hn-server"
]
},
"duckduckgo-mcp-server": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@nickclyde/duckduckgo-mcp-server"
]
}
}
} - 回到 Cursor 的 MCP 设置界面
- 添加的服务前面亮起 绿灯 ✅ 就表示准备就绪
- 如果没亮,点旁边的 刷新 按钮
2. MCP 工具基本使用方式
- 在聊天界面,确保模式选择了 Agent
- 在 Agent 模式下询问问题
1
我现在有哪些可用的 MCP 工具?它们分别能做什么?
- AI 会告诉你它拥有的“工具”和各自的“说明书”
3. 查找新的 MCP 工具/服务器
第一步:了解mcp.json - 服务器清单
mcp.json就相当于我们拥有的mcp服务清单- 每个
"名字":{...},的结构就是一个工具的配置 - 如果觉得某个工具用不上,可以删除对应的
"服务名":{...},代码块
第二步:添加新工具
- 以 Smithery 网站为例,在该网站找到想要的工具
- 点进你想要的工具,这里以 Think Tool Server 为例子
- 在右侧的Installation里选择对应的代码
本次使用的工具是Cursor,文件格式是JSON,系统时Windows. 我们做出相应的选择就好
- 复制工具代码
复制中间绿框的就可以
- 回到Cursor,打开
mcp.json文件,在最后一个工具的}后面加一个, - 把复制的新工具代码粘贴进去,并且保存
三、补充案例(添加高德地图功能)
1. 高德地图规划路线
第一步:创建 API Key
- 访问 高德开放平台 控制台并登录
- 在 应用 中点击 创建新应用
- 填写表单即可创建新的应用
- 添加Key,创建成功后,可获取 Key 和安全密钥
注意: 24小时内申请的 Key 不允许删除
第二步:复制代码
- 复制以下黄色部分代码,粘贴到创建的
mcp.json文件中1
2
3
4
5
6
7{
"mcpServers": {
"amap-amap-sse": {
"url": "https://mcp.amap.com/sse?key=你在高德官网上申请的key"
}
}
}官方 MCP Server 说明 :概述-MCP Server | 高德地图API
四、MCP 服务聚合平台
| 名称 | 网址 |
|---|---|
| MCP.so | https://mcp.so/ |
| 阿里云百炼 | https://bailian.console.aliyun.com/mcp-market?tab=mc… |
| HiMCP | https://himcp.ai/ |
| Smithery.ai | https://smithery.ai/ |
| Awesome MCP Servers | https://mcpservers.org/ |
| MCP Market | https://mcpmarket.com/ |
| PulseMCP | https://www.pulsemcp.com/servers |
| Glama MCP | https://glama.ai/mcp/servers |
| cursor.directory | https://cursor.directory/mcp |
| Potkey.ai | https://portkey.ai/mcp-servers |
| MCP 官方开源库 | https://github.com/modelcontextprotocol/servers |
| Cline’s MCP Marketplace | https://github.com/cline/mcp-marketplace |
| MCP Hub | https://www.aimcp.info/en |
| Reddit MCP 官方社区 | https://www.reddit.com/r/mcp/ |
| shareMCP | https://sharemcp.cn/ |
| MCPServers | https://www.mcpservers.cn/ |
五、支持 MCP 的客户端
| 名称 | 网址 | 系统支持 |
|---|---|---|
| Cursor | https://www.cursor.com/ | Windows、MacOS、Linux |
| Cherry Studio | https://cherry-ai.com/ | Windows、MacOS、Linux |
| 5ire | https://5ire.app/ | Windows、MacOS |
| Continue | https://continue.dev/ | Windows、MacOS |
| Cline | https://marketplace.visu… | Windows、MacOS |
| ChatMCP | https://github.com/dao… | Windows、MacOS、Linux |
| Claude Desktop | https://claude.ai/downlo… | Windows、MacOS |
| ClaudeMind | https://claudemind.com/ | Windows、MacOS |
| HyperChat | https://github.com/BigS… | Windows、MacOS |
| Zed | https://zed.dev/ | Windows、MacOS |
| ChatWise | https://chatwise.app/ | Windows、MacOS |
评论(0)
帮助中心
效率指南



















