Labsco
hirochachacha logo

Rakuten Travel

โ˜… 1

from hirochachacha

Search for hotels and check their availability using the Rakuten Travel API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Rakuten Travel MCP Server

A Model Context Protocol (MCP) server that provides an interface to the Rakuten Travel API for hotel searching and availability checking.

Features

  • Hotel Search: Search for hotels by location, hotel number, or area code
  • Availability Search: Find vacant hotels with real-time availability
  • Area Code Resource: Access hierarchical Japanese location data
  • Type-Safe: Comprehensive TypeScript types with Zod validation
  • MCP Compliant: Works with any MCP-compatible client

Development

Running Tests

# Run all tests
deno task test

# Run tests in watch mode
deno task test:watch

Project Structure

rakuten_travel_mcp/
โ”œโ”€โ”€ serve.ts           # Main MCP server implementation
โ”œโ”€โ”€ types.ts           # TypeScript types and Zod schemas
โ”œโ”€โ”€ area_code.json     # Hierarchical location data
โ”œโ”€โ”€ *.test.ts          # Test files
โ”œโ”€โ”€ deno.json          # Deno configuration
โ””โ”€โ”€ .env              # Environment variables (create this)

API Parameters

Common Parameters

  • hits: Number of results per page (1-30, default: 30)
  • page: Page number for pagination
  • sort: Sort order (various options available)

Hotel Search Specific

  • hotelNo: Array of hotel numbers
  • latitude/longitude: Coordinates for geographic search
  • searchRadius: Search radius in km (1-3)
  • squeezeCondition: Filter for hotels with/without vacancies
  • hotelType: Filter by hotel type (0-3)

Vacant Hotel Search Specific

  • checkinDate/checkoutDate: Required dates (YYYY-MM-DD)
  • rooms: Number of rooms (1-5)
  • adultNum: Adults per room (1-5)
  • minCharge/maxCharge: Price range filters

Testing

The project includes comprehensive tests for:

  • Schema validation
  • API parameter building
  • Response processing
  • Error handling
  • Network timeouts

Error Handling

The server handles various error scenarios:

  • Missing required parameters
  • Invalid date formats
  • API rate limits
  • Network timeouts
  • Invalid API responses