from client import Client import asyncio import json async def main(): # Initialize the MCP client client = Client() try: # Connect to the Airbnb MCP server await client.connect("airbnb") # Example: Search for listings in a specific location search_params = { "location": "New York, NY", "checkin": "2024-04-01", "checkout": "2024-04-05", "guests": 2 } # Send the search request response = await client.request("search", search_params) # Process and print the results print("Search Results:") print(json.dumps(response, indent=2)) # Example: Get details for a specific listing listing_id = "12345678" # Replace with an actual listing ID listing_details = await client.request("listing_details", {"listing_id": listing_id}) print("\nListing Details:") print(json.dumps(listing_details, indent=2)) except Exception as e: print(f"Error: {str(e)}") finally: # Close the connection await client.close() if __name__ == "__main__": # Run the async main function asyncio.run(main())