← Back to all posts

Build an AI-Powered Booking System with MCP-Native Email Confirmations

· MailAnvil Team

Build an AI-Powered Booking System with MCP-Native Email Confirmations

You're building a booking system — travel, homestay, kelas online, whatever. Customer books. System sends confirmation email.

Traditional stack: frontend → backend → SendGrid/Mailgun REST API → email.

AI-native stack: frontend → AI agent → MCP email tool → email.

No backend endpoint for "send confirmation." No curl. No SDK. The agent just calls send_email because the MCP server puts it in its toolbelt.

Let me show you exactly how this works with MailAnvil.

Prerequisites

Step 1: Connect MailAnvil MCP Server

Add this to your claude_desktop_config.json (or Cursor → Settings → MCP Servers):

{
  "mcpServers": {
    "mailanvil": {
      "url": "https://mcp.mailanvil.com/mcp",
      "headers": {
        "Authorization": "Bearer re_your_api_key_here"
      }
    }
  }
}

Restart your AI tool. Now any agent can send email by just describing what they want.

Step 2: Let the Agent Build Your Booking Flow

Tell your AI agent what you want to build:

"Build a simple booking system for a homestay in Yogyakarta. When a guest books a room, send a confirmation email using the MailAnvil MCP server."

The agent discovers send_email as an available tool automatically. It doesn't need to read API docs, construct HTTP requests, or handle auth. It just calls the tool.

Step 3: What the Agent Generates

The agent will build a web form + backend logic that calls the MCP tool. Here's the core booking flow:

# Agent-generated booking confirmation flow
def process_booking(guest_email, room_type, check_in, check_out):
    # Calculate price
    nights = (check_out - check_in).days
    price = nights * 350000  # Rp 350k/night

    # Call MCP tool to send email confirmation
    # (This happens via MCP, not a raw HTTP call)
    send_email(
        to=[guest_email],
        subject="Konfirmasi Pemesanan - Homestay Jogja",
        html=f"""
        <h2>Terima kasih atas pemesanan Anda!</h2>
        <p><strong>Kamar:</strong> {room_type}</p>
        <p><strong>Check-in:</strong> {check_in}</p>
        <p><strong>Check-out:</strong> {check_out}</p>
        <p><strong>Total:</strong> Rp {price:,}</p>
        <p>Silakan lakukan pembayaran melalui QRIS atau transfer ke BCA 1234567890 a.n. Homestay Jogja.</p>
        """,
        headers={"X-Booking-ID": booking_id}
    )

No requests.post(). No JSON construction. No auth headers. The agent just sends email.

Why This Matters for Indonesian Devs

Traditional Approach MCP-Native Approach
Read SendGrid/Mailgun docs Agent discovers tool automatically
Write curl/Python HTTP boilerplate Agent calls send_email directly
Handle auth tokens, error codes MCP handles auth + error handling
Test email integration separately Agent verifies as it builds

Combined with MailAnvil's IDR pricing and local payment:

Real Example: AI Travel Agent

I built an AI travel agent that books tours in Dieng. The flow:

  1. Customer says: "I want a sunrise tour for 2 people this Saturday"
  2. AI agent checks availability, calculates price
  3. Agent calls MCP send_email → confirmation lands in customer's inbox
  4. Agent generates QRIS payment link

Total code the agent needed to write for email: zero manual API integration. The MCP server handles everything.

Try It Yourself

  1. Sign up at mailanvil.com
  2. Add MCP server config
  3. Tell your AI agent: "Build a booking system that sends email confirmations"

The agent does the rest.


Follow @mailanvil for updates. Open source at github.com/richaferry/mailanvil.