旅行规划MCP服务器

一个综合性的模型上下文协议(MCP)服务器,通过整合政府公开API、天气情报、货币信息和文化背景,提供智能旅行规划辅助。

  • by rdwj
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 rdwj/travel-planner-mcp

使用说明

Travel Planner MCP Server

A comprehensive Model Context Protocol (MCP) server that provides intelligent travel planning assistance by combining publicly available government APIs with weather intelligence, currency information, and cultural context. This server demonstrates how to build production-ready MCP servers that can be used by AI agents like Claude or custom applications.

Note: This is an independent project using publicly available government APIs. It is not affiliated with or endorsed by any government agency.

What This Server Does

The Travel Planner MCP provides AI agents with access to:

  • Safety Intelligence: Official travel advisories and security assessments
  • Entry Requirements: Visa policies, passport rules, customs regulations
  • Weather Planning: Historical climate data and current forecasts
  • Cultural Context: Local customs, laws, etiquette, public holidays
  • Practical Information: Currency rates, time zones, health requirements
  • Destination Comparison: Side-by-side analysis of multiple destinations

Available Capabilities

12+ Tools for real-time data queries:

  • get_travel_safety_brief - Comprehensive safety assessment
  • get_entry_requirements - Visa and entry documentation
  • get_country_profile - Demographics, geography, economics
  • get_weather_planning_info - Historical weather and forecasts
  • get_currency_info - Exchange rates and practical guidance
  • get_health_and_vaccination_info - Medical requirements
  • get_local_customs_and_laws - Cultural norms and legal considerations
  • get_public_holidays - National holidays and observances
  • get_time_zone_info - Time zones and DST information
  • search_historical_relations - Historical context between countries
  • compare_destinations - Multi-destination analysis
  • find_passport_services - Passport and consular services

6 Prompts for synthesized planning:

  • plan_comprehensive_trip - End-to-end trip planning
  • safety_briefing_report - Detailed security assessment
  • business_travel_prep - Business-specific preparation
  • cultural_context_deep_dive - Cultural immersion guidance
  • destination_comparison_analysis - Multi-option evaluation
  • packing_and_preparation_checklist - Customized packing lists

4 Resource Categories:

  • Travel checklists (first-time, business, family)
  • Regional safety guides (by geographic area)
  • Visa guides (Schengen, Chinese, common processes)
  • Emergency protocols (medical, lost passport)

Quick Start with Claude Desktop

The easiest way to test this MCP server is using Claude Desktop with the mcp-test-mcp bridge server.

Prerequisites

  1. Claude Desktop: Download from claude.com/download
  2. OpenShift Deployment: Deploy this MCP server to an OpenShift cluster
    • Important: Use a non-FIPS cluster due to how the MCP communicates with government APIs
  3. mcp-test-mcp: Install the MCP bridge server
    npm install -g mcp-test-mcp
    

Configure Claude Desktop

  1. Set up mcp-test-mcp in Claude Desktop

    Follow the MCP server configuration guide at modelcontextprotocol.io/docs/develop/connect-local-servers

    Add mcp-test-mcp to your Claude Desktop configuration (usually ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

    {
      "mcpServers": {
        "mcp-test": {
          "command": "npx",
          "args": ["-y", "mcp-test-mcp"]
        }
      }
    }
    
  2. Restart Claude Desktop

Test the Server

Once configured, you can interact with your deployed Travel Planner MCP through Claude:

Example 1: Discover Capabilities

Use mcp-test-mcp to discover the capabilities of the travel-planner-mcp server at https://your-route-url/mcp/

Example 2: Safety Briefing

Write me a safety briefing if I am traveling from the US to Paris, France in December 2025

Example 3: Comprehensive Trip Planning

I'm planning a 2-week trip to Japan in April 2026. Help me plan everything I need to know about safety, weather, cultural considerations, and entry requirements.

Example 4: Destination Comparison

Compare Thailand, Vietnam, and Indonesia as destinations for a 3-week trip in November. Consider safety, weather, costs, and cultural experiences.

Deploying to OpenShift

Prerequisites

  • OpenShift CLI (oc) installed and configured
  • Access to an OpenShift cluster (non-FIPS required)
  • Podman (for local container builds)

Deployment Options

Option 1: Using Make (Recommended)

# Deploy to default project
make deploy

# Deploy to specific project
make deploy PROJECT=travel-planner

# Clean up deployment
make clean PROJECT=travel-planner

Option 2: Manual Deployment

# Login to OpenShift
oc login <your-cluster-url>

# Create or switch to project
oc new-project travel-planner

# Run deployment script
./deploy.sh travel-planner

Get the Server URL

After deployment, get your MCP server URL:

oc get route mcp-server -o jsonpath='{.spec.host}'

Your MCP endpoint will be at: https://<route-host>/mcp/

Testing the Deployment

Use the MCP Inspector for interactive testing:

npx @modelcontextprotocol/inspector https://<route-host>/mcp/

Building Custom Agents

While Claude Desktop is great for testing and understanding how the MCP works, you can also build custom agents that leverage this server's capabilities.

Use Cases for Custom Agents

  • Travel booking platforms: Integrate safety and weather intelligence into booking flows
  • Corporate travel systems: Automated safety briefings for business travelers
  • Travel blogs/content: Generate destination guides and comparisons
  • Educational applications: Teaching geography, culture, and international relations
  • Emergency preparedness: Safety assessments for organizations with international operations

Development Resources

  • Source Code: github.com/rdwj/travel-planner-mcp

    • Open source under MIT license
    • Use as reference for building your own MCP servers
    • See src/tools/ for example tool implementations
    • See src/prompts/ for prompt engineering patterns
  • Built With: FIPS-Agents CLI

    • Scaffolding and code generation tool
    • Simplifies MCP server development
    • Includes templates for tools, resources, and prompts

Local Development

Setup

# Clone the repository
git clone https://github.com/rdwj/travel-planner-mcp.git
cd travel-planner-mcp

# Install dependencies
make install

# Run locally (STDIO mode)
make run-local

Testing Locally

# Run pytest suite
make test

# Test with cmcp (in another terminal)
cmcp ".venv/bin/python -m src.main" tools/list
cmcp ".venv/bin/python -m src.main" tools/call name=get_travel_safety_brief arguments:='{"country_code":"FR"}'

Project Structure

src/
├── core/           # MCP server core (FastMCP, loaders, auth)
├── tools/          # 12+ travel intelligence tools
├── resources/      # Static reference materials
├── prompts/        # Prompt templates for planning workflows
└── data/           # Reference data (checklists, guides)

tests/              # Comprehensive test suite
├── tools/          # Tool tests
├── resources/      # Resource tests
└── prompts/        # Prompt tests

Environment Variables

Local Development

  • MCP_TRANSPORT=stdio - STDIO mode (default)
  • MCP_HOT_RELOAD=1 - Auto-reload on file changes

OpenShift Deployment

  • MCP_TRANSPORT=http - HTTP mode (automatic)
  • MCP_HTTP_HOST=0.0.0.0 - Listen address
  • MCP_HTTP_PORT=8080 - Server port
  • MCP_HTTP_PATH=/mcp/ - Endpoint path

Optional Authentication

  • MCP_AUTH_JWT_SECRET - JWT secret for symmetric signing
  • MCP_AUTH_JWT_PUBLIC_KEY - JWT public key for asymmetric verification
  • MCP_REQUIRED_SCOPES - Comma-separated required scopes

Architecture

This server uses:

  • FastMCP 2.x: Modern MCP framework with decorator-based APIs
  • Dynamic Loading: Tools, resources, and prompts loaded at runtime
  • Multi-Transport: STDIO (local) and HTTP (OpenShift) support
  • Hot Reload: Development mode with automatic reload
  • Red Hat UBI: Production containers using Universal Base Images
  • OpenShift-Native: BuildConfigs, Deployments, Routes, HPA

See ARCHITECTURE.md for detailed architecture information.

API Data Sources

This server integrates multiple publicly available APIs:

  • Travel advisories and country information (government APIs)
  • Geographic and demographic data (REST Countries API)
  • Weather forecasts and climate data (Open-Meteo API)
  • Country profiles and economic indicators

All data is fetched in real-time to ensure current information.

Important Notes

Non-FIPS Cluster Requirement

The MCP server must be deployed to a non-FIPS OpenShift cluster due to specific SSL/TLS requirements when communicating with government APIs. FIPS-enabled clusters have stricter cryptographic requirements that may cause compatibility issues with some external APIs.

Rate Limiting

Be mindful of API rate limits when making frequent requests. The server includes appropriate error handling for rate limit scenarios.

Data Accuracy

While this server uses official government data sources, travel conditions can change rapidly. Always verify critical information through official channels before making travel decisions.

Contributing

Contributions are welcome! This is an open-source project designed to demonstrate MCP server development patterns.

See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE file for details.

Support and Resources

Acknowledgments

Built using publicly available government APIs and open-source tools. Special thanks to the FastMCP, MCP Protocol, and Anthropic communities for their excellent documentation and tools.