Cover image
Try Now
2025-03-17

3 years

Works with Finder

1

Github Watches

1

Github Forks

3

Github Stars

✈️ Multi Context Protocol (MCP) Server

🌟 Overview

This is a generalized travel mcp server that allows you to ask complex travel planning questions. Try the following

  • I need to be at the Google office tomorrow by 4pm. What is the latest flight I need to take?
  • I would like to stay at a reasonably priced hotel 15 minutes walk from the Eiffel tower, recommend some options.

🔧 Supported Functions

🛫 search-flights

Searches for available flights between two airports via Booking.com's API.

📅 today

Provides the current date to the LLM, ensuring it has up-to-date temporal context.

🏨 search-hotels

Search for available hotels and accommodations.

🔮 Features to Come

🚗 search-car-rentals

Find car rental options at your destination.

hotel-reviews

Access reviews for hotels and accommodations.

🚕 search-taxis

Find taxi and transfer services at your destination.

📦 Installation

This MCP server can be used with either Claude Desktop or your own client.

Pre-requisites

  1. Go to RapidAPI, and look for the booking.com API. Issue yourself a key
  2. Go to google cloud and issue yourself a Google Maps API key.

Use with Claude Desktop

In order to work with Claude Desktop, use the below claude_desktop_config.json

{
  "mcpServers": {
    "travel": {
      "command": "npx",
      "args": ["travel-mcp-server"],
      "env": {
        "BOOKING_COM_API_KEY": "<YOUR_BOOKING_DOT_COM_API_KEY>"
      }
    },
    "google-maps": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "GOOGLE_MAPS_API_KEY",
        "mcp/google-maps"
      ],
      "env": {
        "GOOGLE_MAPS_API_KEY": "<YOUR_GOOGLE_MAPS_API_KEY>"
      }
    }
  }
}

You will need to go get a google maps API key in order to use this.

Programmatic Use

If you want to use this programmatically, here is a code snippet.

class TravelClient {
  private flightsClient: Client;
  private mapsClient: Client;
  private toolDefinitions: any[] = [];

  constructor() {
    this.flightsClient = new Client(
      { name: "FlightsApp", version: "1.0.0" },
      { capabilities: { tools: {}, resources: {}, prompts: {} } }
    );
    this.mapsClient = new Client(
      { name: "MapsApp", version: "1.0.0" },
      { capabilities: { tools: {}, resources: {}, prompts: {} } }
    );
  }

  async initialize() {
    console.log("Initializing MCP clients...");
    try {
      const flightsTransport = new StdioClientTransport({
        command: "node",
        args: ["../../node_modules/travel-mcp-server/build/index.js"],
      });

      console.log("GOOGLE MAPS API KEY", process.env.GOOGLE_MAPS_API_KEY);
      const mapsTransport = new StdioClientTransport({
        command: process.execPath,
        args: [
          "../../node_modules/@modelcontextprotocol/server-google-maps/dist/index.js",
        ],
        env: {
          GOOGLE_MAPS_API_KEY: process.env.GOOGLE_MAPS_API_KEY || "",
        },
      });

      await Promise.all([
        this.flightsClient.connect(flightsTransport),
        this.mapsClient.connect(mapsTransport),
      ]);

      // Discover tools from both servers
      console.log("Discovering tools...");
      const [flightsTools, mapsTools] = await Promise.all([
        this.flightsClient.listTools(),
        this.mapsClient.listTools(),
      ]);

      // Combine tools from both servers
      this.toolDefinitions = [
        ...flightsTools.tools.map((tool) => ({
          name: tool.name,
          description: tool.description || `Tool: ${tool.name}`,
          input_schema: tool.inputSchema,
        })),
        ...mapsTools.tools.map((tool) => ({
          name: tool.name,
          description: tool.description || `Tool: ${tool.name}`,
          input_schema: tool.inputSchema,
        })),
      ];

      console.log(`Discovered ${this.toolDefinitions.length} tools`);
      return this;
    } catch (error) {
      console.error("Error initializing MCP clients:", error);
      throw error;
    }
  }

  async callTool(toolName: string, parameters: any) {
    const tool = this.toolDefinitions.find((t) => t.name === toolName);
    if (!tool) {
      throw new Error(`Tool ${toolName} not found`);
    }

    // Determine which client to use based on the tool name
    const client = toolName.includes("maps")
      ? this.mapsClient
      : this.flightsClient;

    const toolRequest = {
      name: toolName,
      arguments: parameters,
    };

    const result = await client.callTool(toolRequest);
    return result;
  }

  async getToolDefinitions() {
    return this.toolDefinitions;
  }
}

export default TravelClient;

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Yasir Eryilmaz
  • AI scriptwriting assistant for short, engaging video content.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • Daren White
  • A supportive coach for mastering all Spanish tenses.

  • J. DE HARO OLLE
  • Especialista en juegos de palabras en varios idiomas.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

    Reviews

    5 (1)
    Avatar
    user_NDoPuLLx
    2025-04-18

    As a dedicated user of flights-mcp-server, I can confidently say it’s an exceptional tool for managing flight control processes. Its seamless integration and robust performance make it indispensable for developers. Thanks to prakashsanker for creating such a valuable resource. Highly recommend checking it out on GitHub!