@mcp.tool()
async def get_integration_guide(
platform: str,
deployment_type: str = "production"
) -> Dict[str, Any]:
"""
Get detailed integration guide by fetching from CDN for specific platforms and deployment scenarios
Perfect for: DevOps setup, deployment planning, team onboarding
Token-optimized: Fetches comprehensive guides from CDN instead of hardcoded responses
Args:
platform: Target platform (vercel, netlify, heroku, aws, gcp, azure, docker, etc.)
deployment_type: Deployment type (development, staging, production)
Returns:
Step-by-step integration guide with platform-specific instructions fetched from CDN
Updated for new /api/message/ endpoints and X-API-KEY authentication
"""
try:
platform = platform.lower()
deployment_type = deployment_type.lower()
# Try to fetch guide from CDN
guide_url = f"https://cdn.mbaas.kr/templates/sms-mms/deployment/{platform}-{deployment_type}.md"
try:
response = await client.get(guide_url)
if response.status_code == 200:
guide_content = response.text
return {
"success": True,
"platform": platform,
"deployment_type": deployment_type,
"guide_content": guide_content,
"source": "CDN",
"guide_url": guide_url,
"api_changes": {
"endpoints": "Updated to /api/message/sms and /api/message/mms",
"authentication": "X-API-KEY header only (no project_id needed)",
"breaking_changes": "Project ID parameter removed from API calls"
},
"security_checklist": [
"API 키를 코드에 하드코딩하지 않기",
"환경 변수 또는 시크릿 관리 서비스 사용",
"HTTPS 통신 확인",
"적절한 에러 로깅 설정"
],
"message": f"{platform.title()} {deployment_type} 배포 가이드입니다 (CDN 최적화)"
}
except Exception:
# Fallback to basic guides if CDN unavailable
pass
# Fallback guides with updated API information
basic_guides = {
"vercel": {
"title": "Vercel 배포 가이드",
"steps": [
"1. 환경 변수 설정: BAAS_API_KEY (PROJECT_ID 불필요)",
"2. vercel.json 설정에 환경 변수 추가",
"3. API Routes에서 /api/message/ 엔드포인트 사용",
"4. X-API-KEY 헤더로 인증 처리"
],
"config": {
"env_vars": "Vercel Dashboard > Settings > Environment Variables",
"api_routes": "/api/send-sms.js 형태로 구현",
"endpoints": "/api/message/sms, /api/message/mms"
}
},
"netlify": {
"title": "Netlify Functions 가이드",
"steps": [
"1. netlify/functions 디렉토리에 함수 생성",
"2. 환경 변수 BAAS_API_KEY를 Netlify 대시보드에서 설정",
"3. X-API-KEY 헤더로 인증하는 함수 구현",
"4. /api/message/ 엔드포인트 사용"
]
},
"docker": {
"title": "Docker 컨테이너 배포",
"steps": [
"1. Dockerfile에 필요한 의존성 설치",
"2. ENV BAAS_API_KEY로 환경 변수 설정",
"3. 또는 docker run -e BAAS_API_KEY 옵션 사용",
"4. 네트워크 접근성 확인 (api.aiapp.link/api/message/)"
]
}
}
guide = basic_guides.get(platform)
if not guide:
return {
"success": False,
"error": f"플랫폼 '{platform}'에 대한 가이드가 아직 준비되지 않았습니다",
"available_platforms": list(basic_guides.keys()),
"cdn_url": f"https://cdn.mbaas.kr/templates/sms-mms/deployment/",
"error_code": "PLATFORM_NOT_SUPPORTED"
}
# Add deployment-specific notes
deployment_notes = {
"development": "개발 환경에서는 .env 파일 사용 권장",
"staging": "스테이징 환경에서는 별도 API 키 사용",
"production": "프로덕션에서는 환경 변수 암호화 및 로깅 설정 필요"
}
return {
"success": True,
"platform": platform,
"deployment_type": deployment_type,
"guide": guide,
"source": "Local fallback",
"deployment_notes": deployment_notes.get(deployment_type, ""),
"api_changes": {
"endpoints": "Updated to /api/message/sms and /api/message/mms",
"authentication": "X-API-KEY header only (no project_id needed)",
"breaking_changes": "Project ID parameter removed from API calls"
},
"security_checklist": [
"API 키를 코드에 하드코딩하지 않기",
"환경 변수 또는 시크릿 관리 서비스 사용",
"HTTPS 통신 확인",
"적절한 에러 로깅 설정"
],
"message": f"{platform.title()} {deployment_type} 배포 가이드입니다 (로컬 폴백)"
}
except Exception as e:
return {
"success": False,
"error": f"가이드 조회에 실패했습니다: {str(e)}",
"error_code": "GUIDE_RETRIEVAL_ERROR"
}