一款基于人工智能的模型上下文协议(MCP)服务器,用于餐厅发现和预订。该服务器与Google Maps Places API集成,根据位置、菜系偏好、心情和活动类型查找餐厅,并提供智能推荐和预订协助。
<a href="https://glama.ai/mcp/servers/@samwang0723/mcp-booking"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=3242268973,1862850420&fm=3081&app=3081&f=PNG?w=760&h=400" alt="餐厅预订MCP服务器" /> </a>克隆或下载此项目
git clone <repository-url>
cd mcp-restaurant-booking
安装依赖项
npm install
设置环境变量
cp .env.example .env
编辑.env并添加您的Google Maps API密钥:
GOOGLE_MAPS_API_KEY=your_actual_api_key_here
构建项目
npm run build
开发模式:
npm run dev
生产模式:
npm start
要在Docker中运行MCP餐厅预订服务器:
# 构建Docker镜像
docker build -t mcp/booking .
# 在同一网络上运行容器作为Redis
docker run --rm -i mcp/booking
MCP服务器提供了以下工具:
search_restaurants根据位置、菜系、心情和活动类型查找餐厅。
参数:
latitude (数字,可选):搜索纬度(默认:24.1501164 - 台湾)longitude (数字,可选):搜索经度(默认:120.6692299 - 台湾)placeName (字符串,可选):附近地点名称(例如,“纽约”,“东京”,“伦敦”)。替代提供纬度/经度坐标。cuisineTypes (字符串数组):菜系偏好数组mood (字符串):期望氛围event (字符串):活动类型radius (数字,可选):搜索半径(米),默认值:20000priceLevel (数字,可选):价格偏好(1-4)示例(默认台湾位置):
{
"cuisineTypes": ["中式", "台式"],
"mood": "休闲",
"event": "家庭聚会",
"priceLevel": 2
}
示例(明确坐标,台北):
{
"latitude": 25.033,
"longitude": 121.5654,
"cuisineTypes": ["意大利", "地中海"],
"mood": "浪漫",
"event": "约会",
"radius": 15000,
"priceLevel": 3
}
示例(地点名称,纽约):
{
"placeName": "纽约, NY",
"cuisineTypes": ["意大利", "美式"],
"mood": "高档",
"event": "商务会议",
"radius": 10000,
"priceLevel": 3
}
示例(关键词搜索特定食物类型):
{
"keyword": "火锅",
"mood": "休闲",
"event": "家庭聚会",
"radius": 10000
}
get_restaurant_details获取特定餐厅的详细信息。
参数:
placeId (字符串):Google Places ID的餐厅get_booking_instructions获取如何进行预订的指南。
参数:
placeId (字符串):Google Places ID的餐厅check_availability检查预订的可用性(模拟实现)。
参数:
placeId (字符串):Google Places IDdateTime (字符串):首选日期/时间,ISO格式partySize (数字):人数make_reservation尝试进行预订(模拟实现)。
参数:
placeId (字符串):Google Places IDpartySize (数字):人数preferredDateTime (字符串):ISO格式日期/时间contactName (字符串):预订联系人姓名contactPhone (字符串):联系电话contactEmail (字符串,可选):电子邮件地址specialRequests (字符串,可选):特殊请求推荐系统根据以下标准对餐厅进行评分:
不同的活动有不同的标准:
分析餐厅名称、评论和特征中的情绪关键词:
src/
├── types/ # TypeScript类型定义
├── services/ # 核心业务逻辑
│ ├── googleMapsService.ts # Google Maps API集成
│ ├── restaurantRecommendationService.ts # AI推荐引擎
│ └── bookingService.ts # 预订逻辑(模拟)
└── index.ts # MCP服务器实现
npm run build:编译TypeScriptnpm run dev:开发模式运行,支持热重载npm start:运行编译后的版本npm run lint:运行ESLintnpm run lint:fix:修复ESLint问题编辑src/services/googleMapsService.ts中的cuisineMap:
const cuisineMap: { [key: string]: string } = {
new_cuisine_type: "显示名称",
// ... 现有映射
};
更新src/services/restaurantRecommendationService.ts中的评分算法:
calculateRestaurantScore():整体评分逻辑calculateEventSuitability():活动特定标准calculateMoodMatch():情绪匹配逻辑src/types/index.ts中的event枚举calculateEventSuitability()方法中添加活动标准MIT许可证 - 查看LICENSE文件了解详情
对于问题和疑问:
使用Browser MCP