Skip to main content
Glama
ganeshakhila6

TravelMind AI MCP Server

โœˆ TravelMind AI โ€” Real-Time Agentic Travel Planner

A multi-agent AI travel planner powered by Google Serper API (live Google search) and an MCP Server (Model Context Protocol). Four specialized agents collaborate in a pipeline to produce a complete, real-time travel plan.


๐Ÿค– Agent Architecture

User Input
    โ”‚
    โ–ผ
AgentOrchestrator
    โ”‚
    โ”œโ”€โ”€ Phase 1 โ”€โ”€ SearchAgent โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Google Serper API
    โ”‚               Fires 10 concurrent live searches:
    โ”‚               flights ยท hotels ยท attractions ยท weather ยท visa
    โ”‚               food ยท safety ยท budget ยท return flights ยท news
    โ”‚
    โ”œโ”€โ”€ Phase 2 (parallel) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
    โ”‚   โ”œโ”€โ”€ PlanningAgent   โ€” synthesises search results into travel info
    โ”‚   โ”‚                      (visa, safety, weather, attractions, news)
    โ”‚   โ””โ”€โ”€ BudgetAgent     โ€” extracts real prices from Serper snippets,
    โ”‚                          builds full cost breakdown
    โ”‚
    โ””โ”€โ”€ Phase 3 โ”€โ”€ ItineraryAgent โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                   Builds day-by-day plan from live Serper places data
                   AI-generated (if Gemini key) or rule-based fallback

๐Ÿ”Œ MCP Server

The MCP server exposes all agent tools as JSON-RPC 2.0 endpoints.

Endpoint

Method

Description

/mcp

POST

JSON-RPC 2.0 tool dispatcher

/mcp/tools

GET

List all 18 registered tools

/mcp/health

GET

Health check & status

/mcp/events

GET

SSE stream โ€” real-time agent events

Registered Tools (18)

Tool

Description

search_flights

Live flight search between two cities

search_hotels

Hotels with live prices and ratings

search_attractions

Top tourist attractions at destination

search_weather

Current and forecast weather

search_visa

Visa requirements by nationality

search_food

Restaurants and dining options

search_safety

Travel safety advisories

search_budget

Daily cost and expense estimates

general_search

General Google search for any travel query

search_trains

Targeted train fares and duration search

search_restaurants

Targeted restaurant and cuisine search

get_opening_hours

Targeted attraction hours and ticket search

get_travel_time

Targeted route travel-time search

calculate_budget

Structured category budget calculation

convert_currency

Transparent caller-rate currency conversion

plan_full_trip

Run the full 4-agent pipeline, returns full plan

get_itinerary

Day-by-day itinerary from live data

get_budget_breakdown

Detailed budget calculation


๐Ÿš€ Quick Start

1. Install

npm install

2. Configure

cp .env.example .env
# Edit .env โ€” add your Serper API key (required for live data)

Get your free Serper API key at serper.dev โ€” 2,500 free searches/month.

3. Run

# Interactive CLI planner
npm start

# MCP server only (for integrations)
npm run mcp

# Browser trip planner
# Start the MCP server, then open http://localhost:3001

# Run verification tests
npm run verify

๐Ÿ”‘ API Keys

Key

Required?

Where to get

Free tier

SERPER_API_KEY

โœ… Yes

serper.dev

2,500 searches/mo

GEMINI_API_KEY

โŒ No

Google AI Studio

Free tier

Without Serper: App runs in estimation mode with built-in data.
Without Gemini: Uses rule-based itinerary and snippet extraction (fully functional).


๐Ÿ“ก MCP Server API โ€” Example Calls

Health check

curl http://localhost:3001/mcp/health

List tools

curl http://localhost:3001/mcp/tools

Call a tool (JSON-RPC 2.0)

curl -X POST http://localhost:3001/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "tools/call",
    "params": {
      "name": "search_flights",
      "arguments": {
        "origin": "New York",
        "destination": "Bangkok",
        "date": "2026-11-15"
      }
    }
  }'

Plan a full trip via MCP

curl -X POST http://localhost:3001/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "2",
    "method": "tools/call",
    "params": {
      "name": "plan_full_trip",
      "arguments": {
        "origin": "London",
        "destination": "Tokyo",
        "startDate": "2026-12-01",
        "endDate": "2026-12-10",
        "numTravelers": 2,
        "totalBudget": 5000,
        "currency": "USD",
        "budgetTier": "moderate",
        "travelType": "cultural",
        "nationality": "GB"
      }
    }
  }'

SSE event stream

curl -N http://localhost:3001/mcp/events

๐Ÿ“ Project Structure

Travel_planner_agent/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.js                          # Entry point
โ”‚   โ”œโ”€โ”€ agents/
โ”‚   โ”‚   โ”œโ”€โ”€ SearchAgent.js               # Fires all Serper searches
โ”‚   โ”‚   โ”œโ”€โ”€ PlanningAgent.js             # Synthesises search โ†’ travel info
โ”‚   โ”‚   โ”œโ”€โ”€ RealtimeBudgetAgent.js       # Real-time price extraction & budget
โ”‚   โ”‚   โ”œโ”€โ”€ RealtimeItineraryAgent.js    # Day-by-day plan from live places
โ”‚   โ”‚   โ”œโ”€โ”€ BaseAgent.js                 # (shared base)
โ”‚   โ”‚   โ”œโ”€โ”€ TransportationAgent.js       # (legacy, used by fallback pipeline)
โ”‚   โ”‚   โ”œโ”€โ”€ AccommodationAgent.js
โ”‚   โ”‚   โ”œโ”€โ”€ BudgetAgent.js
โ”‚   โ”‚   โ”œโ”€โ”€ FoodAgent.js
โ”‚   โ”‚   โ””โ”€โ”€ ItineraryAgent.js
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ AgentOrchestrator.js         # Real-time 3-phase coordinator
โ”‚   โ”‚   โ”œโ”€โ”€ PlannerOrchestrator.js       # (legacy offline orchestrator)
โ”‚   โ”‚   โ”œโ”€โ”€ config.js
โ”‚   โ”‚   โ””โ”€โ”€ constants.js
โ”‚   โ”œโ”€โ”€ mcp/
โ”‚   โ”‚   โ”œโ”€โ”€ mcpServer.js                 # MCP JSON-RPC 2.0 server (Express)
โ”‚   โ”‚   โ”œโ”€โ”€ mcpClient.js                 # MCP client with convenience wrappers
โ”‚   โ”‚   โ””โ”€โ”€ startServer.js              # Standalone server entry point
โ”‚   โ”œโ”€โ”€ realtime/
โ”‚   โ”‚   โ””โ”€โ”€ serperClient.js              # Google Serper API wrapper
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ TravelPlan.js                # Shared data model
โ”‚   โ”œโ”€โ”€ ui/
โ”‚   โ”‚   โ”œโ”€โ”€ realtimeApp.js               # Real-time app loop
โ”‚   โ”‚   โ”œโ”€โ”€ realtimeDisplay.js           # Terminal rendering (live-aware)
โ”‚   โ”‚   โ”œโ”€โ”€ realtimePrompts.js           # Inquirer prompts
โ”‚   โ”‚   โ”œโ”€โ”€ app.js                       # (legacy UI)
โ”‚   โ”‚   โ”œโ”€โ”€ display.js
โ”‚   โ”‚   โ””โ”€โ”€ prompts.js
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ”œโ”€โ”€ destinationData.js           # Curated city data (fallback)
โ”‚   โ”‚   โ””โ”€โ”€ visaRules.js
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ logger.js
โ”‚       โ”œโ”€โ”€ helpers.js
โ”‚       โ”œโ”€โ”€ openaiClient.js
โ”‚       โ”œโ”€โ”€ geoClient.js
โ”‚       โ””โ”€โ”€ weatherClient.js
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ verify.js                        # End-to-end test suite
โ”œโ”€โ”€ plans/                               # Saved JSON trip plans (auto-created)
โ”œโ”€โ”€ .env.example
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

โœ… What's Live vs Estimated

Feature

With Serper key

Without Serper key

Flight prices

โœ… Live Google search

โšก Distance-based estimate

Hotel prices & names

โœ… Live + ratings

โšก Tier-based estimate

Attractions

โœ… Live places + ratings

โšก Built-in city data

Weather

โœ… Live forecast

โšก Open-Meteo API (free)

Visa info

โœ… Live Google search

โšก Local rules database

Restaurant names

โœ… Live places

โšก Built-in city data

Safety info

โœ… Live advisories

โšก Local curated data

Daily cost estimates

โœ… Live cost pages

โšก Tier-based defaults

Itinerary

โœ… AI+live places / rule-based+live

โšก Rule-based built-in


๐Ÿ›  Requirements

  • Node.js 18+

  • npm