Voyana MCP
基于AI的旅行计划推荐服务(MCP+Gemini+Google Places API)
🎯 主要功能
- 利用Gemini AI创建定制的旅行日程
- 结合基于Google Places API的真实地点信息
- 模型上下文协议(MCP)集成
- 基于预算、强度和偏好进行优化
🚀 快速入门
基本要求
- JDK 17+
- Gradle 8.x
- Google Places API密钥
- Gemini API密钥
首选参数
# application.yml
google:
places:
api-key: your_google_places_api_key
gemini:
api:
key: your_gemini_api_key
url: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-exp:generateContent执行
./gradlew bootRun服务器运行后:http://localhost:8080
📡 API
创建旅行计划
POST /api/v2/travel/plan
Content-Type: application/json
{
"destination": "서울",
"days": 3,
"budget": 500000,
"intensity": "MODERATE",
"preferences": ["CULTURE", "FOOD", "SHOPPING"]
}示例响应:
{
"days": [
{
"day": 1,
"places": [
{
"name": "경복궁",
"category": "CULTURE",
"startTime": "09:00",
"duration": 120,
"estimatedCost": 50000,
"location": {
"latitude": 37.5796,
"longitude": 126.9770,
"address": "서울 종로구"
}
}
]
}
],
"totalCost": 450000
}Google Places测试
GET /api/test/places/nearby?location=37.5665,126.9780&radius=1000&type=restaurant🛠️ 技术堆栈
- 语言Kotlin 1.9.25
- 框架:弹簧靴3.5.4
- 人工智能:双子座2.5闪光灯
- API:Google Places API(新增)
- 超文本传输协议:OkHttp、WebFlux
- 构建:Gradle
📂 项目结构
src/main/kotlin/voyana/mcpprototype/
├── client/mcp/ # Gemini API 클라이언트
├── controller/v2/ # REST API
├── service/v2/ # 비즈니스 로직
│ ├── GooglePlacesService.kt
│ └── TravelPlanService.kt
└── McpPrototypeApplication.kt🔧 主要类
TravelPlanService:旅行计划生成核心逻辑GooglePlacesService:Google Places API集成GeminiApiClient:Gemini AI通信
📝 开发说明
- 利用Gemini创建基于JSON的旅行计划
- 使用Google Places API(New)中的Nearby Search
- 基于代码的异步处理
- 基于位置的地点搜索和筛选
为环境变量设置API密钥
**빌드 오류**./gradlew clean build
