1、 需求
使用 cursor + mcp 实现一份非常精美的五一旅游攻略
2、 什么是 mcp?
MCP服务官网:Introduction - Model Context Protocol
它是Model Context Protocol的简称,是一种 由Anthropic推出的开放标准,旨在实现大型语言模型(LLM)与 外部数据源和工具之间的无缝集成。MCP通过标准化协议,使AI 模型能够安全地访问和操作本地及远程数据,从而提升AI应用的响应质量和工作效率。
MCP 就像是一个 "通用插头" 或者 "USB 接口",制定了统一的规范,不管是连接数据库、第三方 API,还是本地文件等各种外部资源,目的就是为了解决 AI 模型与外部数据源、工具交互的难题。



3、 高德配置
高德开放平台:我的应用 | 高德控制台

点击:快速接入指南
4、cursor
下载安装:


需要注册和登录 Cursor,登录成功后,选择 AI 使用的语言:

新建文件夹 gonglve,然后打开目录,点击拓展,输入 Chinese 进行安装

点击 Ctrl + shift + p ,输入命令:configure display language,选择 中文(简体)

5、 制作过程
第一步:cursor 中配置高德 mcp server
{
"mcpServers": {
"amap-amap-sse": {
"url": "https://mcp.amap.com/sse?key=您在高德官网上申请的key"
}
}
}

第二步:提示词
第一次的提示词:
使用高德MCP服务,为我规划从北京到洛阳,2025 年 5 月 1 日~5 月 5 日,5 天的旅游指南,坐高铁或者飞机都可以,我喜欢历史遗迹、人文、自然景观,比较喜欢各个地方的当地特色美食,酒店至少三星以上。请为我推荐靠近景点的酒店和景点往来之间的交通方式。我的总预算是 5000 元。
第二次提示词:
我是年轻人,体力旺,每天可以玩8小时,可以再多安排一些景点,费用不变。
第三次的提示词:
请将这个5天的计划,生成为一个html文件,界面要美观,适应 pc 和手机端,点击地址可以打开高德地图
第四次的提示词:
生成的链接,跳转不到高德地图,报404错误,请检查,修复
使用浏览器打开,非常的漂亮

6、 代码
html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>洛阳五日游攻略 - 2025年5月</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background-color: #f5f5f5;
}
.header {
text-align: center;
padding: 40px 0;
background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
color: white;
border-radius: 10px;
margin-bottom: 30px;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
}
.header p {
font-size: 1.2em;
opacity: 0.9;
}
.card {
background: white;
border-radius: 10px;
padding: 20px;
margin-bottom: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.day-title {
color: #1e3c72;
border-bottom: 2px solid #1e3c72;
padding-bottom: 10px;
margin-bottom: 20px;
}
.schedule-item {
margin-bottom: 15px;
padding-left: 20px;
border-left: 3px solid #1e3c72;
}
.time {
font-weight: bold;
color: #2a5298;
}
.location {
color: #0066cc;
text-decoration: none;
padding: 2px 5px;
border-radius: 3px;
transition: background-color 0.3s;
}
.location:hover {
background-color: #f0f7ff;
}
.budget-section {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 20px;
margin-top: 20px;
}
.budget-item {
background: #f8f9fa;
padding: 15px;
border-radius: 8px;
border-left: 4px solid #1e3c72;
}
.tips {
background-color: #e8f4f8;
padding: 20px;
border-radius: 8px;
margin-top: 20px;
}
.tips h3 {
color: #1e3c72;
margin-bottom: 10px;
}
.tips ul {
list-style-position: inside;
}
@media (max-width: 768px) {
body {
padding: 10px;
}
.header {
padding: 20px 0;
}
.header h1 {
font-size: 1.8em;
}
.budget-section {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="header">
<h1>洛阳五日游攻略</h1>
<p>2025年5月1日 - 5月5日</p>
</div>
<div class="card">
<h2 class="day-title">交通方案</h2>
<div class="schedule-item">
<p><span class="time">高铁方案:</span> 北京站/北京西站 -> 洛阳龙门站,约4-5小时,票价二等座约420-500元</p>
<p><span class="time">飞机方案:</span> 北京首都机场 -> 洛阳北郊机场,约2小时,机票约800-1200元</p>
</div>
</div>
<div class="card">
<h2 class="day-title">推荐住宿</h2>
<div class="schedule-item">
<p><span class="time">老城区:</span> <a class="location" href="https://uri.amap.com/marker?position=112.453895,34.619702&name=洛阳升龙广场亚朵酒店" target="_blank">洛阳升龙广场亚朵酒店</a>(四星,约300-400元/晚)</p>
<p><span class="time">龙门区域:</span> <a class="location" href="https://uri.amap.com/marker?position=112.477141,34.567215&name=洛阳龙门石窟智选假日酒店" target="_blank">洛阳龙门石窟智选假日酒店</a>(四星,约350-450元/晚)</p>
</div>
</div>
<div class="card">
<h2 class="day-title">第一天(5月1日):抵达洛阳</h2>
<div class="schedule-item">
<p><span class="time">上午:</span> 北京出发(建议乘坐上午的高铁)</p>
<p><span class="time">下午:</span> 抵达洛阳,入住老城区酒店</p>
<p><span class="time">晚上:</span> 游览<a class="location" href="https://uri.amap.com/marker?position=112.469687,34.681462&name=洛邑古城" target="_blank">洛邑古城</a>,品尝洛阳水席</p>
<p><span class="time">特色美食:</span> 洛阳牡丹燕菜、银针面、胡辣汤</p>
</div>
</div>
<div class="card">
<h2 class="day-title">第二天(5月2日):老城区游览</h2>
<div class="schedule-item">
<p><span class="time">上午:</span> <a class="location" href="https://uri.amap.com/marker?position=112.605311,34.721828&name=白马寺" target="_blank">白马寺</a>(门票60元)</p>
<p><span class="time">中午:</span> 品尝洛阳杂肝汤</p>
<p><span class="time">下午:</span> <a class="location" href="https://uri.amap.com/marker?position=112.469825,34.682115&name=洛阳博物馆" target="_blank">洛阳博物馆</a>(免费)、天子驾六博物馆</p>
<p><span class="time">晚上:</span> <a class="location" href="https://uri.amap.com/marker?position=112.469687,34.681462&name=丽景门夜市" target="_blank">丽景门夜市</a></p>
</div>
</div>
<div class="card">
<h2 class="day-title">第三天(5月3日):龙门石窟</h2>
<div class="schedule-item">
<p><span class="time">上午:</span> 换住龙门区域酒店,游览<a class="location" href="https://uri.amap.com/marker?position=112.477141,34.567215&name=龙门石窟" target="_blank">龙门石窟</a>(门票120元)</p>
<p><span class="time">中午:</span> 龙门石窟附近农家乐</p>
<p><span class="time">下午:</span> 继续游览龙门石窟,<a class="location" href="https://uri.amap.com/marker?position=112.475874,34.563199&name=香山寺" target="_blank">香山寺</a></p>
<p><span class="time">晚上:</span> 龙门大道夜市</p>
</div>
</div>
<div class="card">
<h2 class="day-title">第四天(5月4日):关林-老君山</h2>
<div class="schedule-item">
<p><span class="time">上午:</span> <a class="location" href="https://uri.amap.com/marker?position=112.401780,34.658220&name=关林" target="_blank">关林</a>(门票50元)</p>
<p><span class="time">中午:</span> 品尝关林水席</p>
<p><span class="time">下午:</span> <a class="location" href="https://uri.amap.com/marker?position=112.854681,34.477466&name=老君山风景区" target="_blank">老君山风景区</a>(门票90元)</p>
<p><span class="time">晚上:</span> 返回酒店,品尝特色小吃</p>
</div>
</div>
<div class="card">
<h2 class="day-title">第五天(5月5日):返程</h2>
<div class="schedule-item">
<p><span class="time">上午:</span> <a class="location" href="https://uri.amap.com/marker?position=112.442252,34.627755&name=洛阳国花园" target="_blank">洛阳国花园</a>(赏牡丹,门票40元)</p>
<p><span class="time">中午:</span> 购买特产(核桃、牡丹饼等)</p>
<p><span class="time">下午:</span> 返回北京</p>
</div>
</div>
<div class="card">
<h2 class="day-title">预算分配(约5000元)</h2>
<div class="budget-section">
<div class="budget-item">
<h3>交通费</h3>
<p>高铁往返:约1000元</p>
<p>市内交通:约400元</p>
</div>
<div class="budget-item">
<h3>住宿费</h3>
<p>4晚住宿:约1500元</p>
</div>
<div class="budget-item">
<h3>门票费</h3>
<p>景点门票总计:约360元</p>
</div>
<div class="budget-item">
<h3>餐饮费</h3>
<p>日均150元,5天约750元</p>
</div>
<div class="budget-item">
<h3>购物和其他</h3>
<p>特产和纪念品:约500元</p>
<p>预备金:约490元</p>
</div>
</div>
</div>
<div class="card tips">
<h3>出行建议</h3>
<ul>
<li>5月天气较好,但昼夜温差大,建议带件外套</li>
<li>洛阳公共交通便利,可以下载高德地图导航</li>
<li>建议提前在网上预订酒店和景点门票</li>
<li>准备一些零食和水,景区游览时补充体力</li>
<li>龙门石窟游览建议请导游讲解,更能了解历史文化</li>
</ul>
</div>
</body>
</html>