TR

Travel Planner MCP Server — Google Maps API

Plan and manage travel itineraries with this MCP server integrating Google Maps API for location search, place details, and optimized route calculations.

Quick Install
npx -y @GongRzhe/TRAVEL-PLANNER-MCP-Server

Overview

This MCP (Model Context Protocol) server integrates Google Maps APIs to provide location search, place detail lookup, and optimized route calculations as tools that can be called by an LLM or other orchestration layer. It exposes a simple HTTP server that implements MCP-style tool metadata and endpoints so conversational agents can discover and invoke location-related capabilities programmatically.

For developers building travel assistants, itinerary planners, or location-aware chatbots, this server centralizes Google Maps operations (Places, Geocoding, Directions/Routes) behind a small, self-hosted API. That allows an LLM to request structured data (search results, coordinates, place attributes, optimized multi-stop routes) without embedding API keys or parsing raw Maps responses inside the model context.

Features

  • Exposes MCP-compatible tools for:
    • Location / place search (query -> ranked places)
    • Place details lookup (place_id -> details, photos, address)
    • Route optimization (multi-stop route optimization and directions)
  • Returns structured JSON outputs designed for use by LLMs or other agents
  • Simple configuration via environment variables (.env) or Docker
  • Rate-limit and error handling wrappers to surface friendly errors to callers
  • Example request/response shapes and sample payloads for quick integration

Installation / Configuration

Prerequisites:

  • Node.js 16+ (or Docker)
  • A Google Maps API key with appropriate APIs enabled (Places, Geocoding, Directions/Routes)

Clone the repo and install dependencies:

git clone https://github.com/GongRzhe/TRAVEL-PLANNER-MCP-Server.git
cd TRAVEL-PLANNER-MCP-Server
npm install

Create a .env file in the project root with these variables:

# .env
PORT=8080
GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
LOG_LEVEL=info

Start the server (development):

npm run dev
# or
npm start

Docker (optional):

# build
docker build -t travel-planner-mcp .
# run
docker run -e GOOGLE_MAPS_API_KEY=your_key -p 8080:8080 travel-planner-mcp

Notes:

  • Ensure your Google API key has billing enabled and the necessary APIs switched on in the Google Cloud Console.
  • Adjust PORT and logging settings to match your deployment environment.

Available Tools / Resources

The server exposes a small set of HTTP endpoints intended for MCP discovery and invocation. Typical endpoints:

EndpointMethodDescription
/mcp/toolsGETReturns tool metadata (name, description, input schema) for agent discovery
/searchPOSTQuery-based place search (query, location bias, radius)
/detailsPOSTFetch place details by place_id
/optimizePOSTOptimize multi-stop route and return directions & travel times
/healthGETSimple health check/status

Example: GET tool metadata

curl http://localhost:8080/mcp/tools

Example tool metadata (partial):

[
  {
    "name": "location_search",
    "description": "Search for places by text query and optional location bias.",
    "inputs": { "query": "string", "location": "lat,lng (optional)", "radius": "meters (optional)" }
  },
  {
    "name": "place_details",
    "description": "Retrieve detailed place information using a Google place_id.",
    "inputs": { "place_id": "string" }
  }
]

API Examples

Search example:

curl -X POST http://localhost:8080/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "best sushi near Shibuya, Tokyo",
    "location": "35.6595,139.7006",
    "radius": 2000
  }'

Typical response:

{
  "results": [
    { "place_id": "ChIJ...", "name": "Sushi Place", "lat": 35.66, "lng": 139.70, "rating": 4.6 },
    ...
  ]
}

Route optimization example:

curl -X POST http://localhost:8080/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "origin": "35.6586,139.7454",
    "stops": ["35.6895,139.6917", "35.6733,139.7109", "35.6581,139.7516"],
    "optimize": true,
    "mode": "driving"
  }'

Response includes ordered waypoints, total duration, distance, and step-by-step directions.

Use Cases

  • Day trip planning: An assistant can search attractions near a user’s hotel, fetch details (opening hours, ratings), and produce an optimized route to visit several spots within a time window.
  • Multi-stop itinerary optimization: Given a list of desired stops, the MCP server can compute an efficient driving route and return explicit directions for navigation or for display in a UI.
  • Location-aware chatbots: Let an LLM call the search and details tools during a conversation to present verified place names, addresses, or photo references, reducing hallucinations.
  • Travel app backend: Use the server as a thin abstraction layer for Google Maps calls to centralize API key usage, apply logging, and enforce rate limits before serving data to mobile/web clients.

Operational Considerations

  • Billing and quotas: Google Maps APIs bill per request; monitor usage and set quotas in Google Cloud.
  • Rate limiting: Deploy rate limiting in front of the server (API gateway) if multiple agents will call it concurrently.
  • Caching: Consider caching place details and route results to reduce repeated external API calls and latency.
  • Security: Keep your GOOGLE_MAPS_API_KEY secret. For production, use secret managers and restrict key usage by HTTP referrer or IP addresses.

This MCP server provides a compact, agent-friendly bridge between LLM-driven workflows and Google Maps capabilities—ideal for building travel planning assistants and location-sensitive automation.