AI Hotel MCP Server

AI Hotel MCP Server

Enables AI-driven hotel booking operations with 30+ MCP tools, hybrid database architecture (PostgreSQL, MongoDB, Redis), and live benchmarking to demonstrate performance improvements.

Category
Visit Server

README

AI Hotel MCP Server

Production-quality MCP (Model Context Protocol) server for an AI-driven hotel booking system with hybrid database architecture.

🎯 Project Overview

This project showcases an intelligent hotel management system where "Poe," an AI entity, orchestrates operations, learns from guest interactions, and makes autonomous decisions. The system demonstrates the benefits of a hybrid database architecture through live performance benchmarking.

Key Features

  • 30+ MCP Tools: Complete hotel operations accessible via Claude Code
  • Hybrid Architecture: PostgreSQL + MongoDB + Redis working together
  • Live Benchmarking: Real-time performance comparisons showing 10-20x improvements with caching
  • Realistic Data: 100 guests, 500 bookings, 1000+ conversations ready for testing
  • 12 Core Queries: All SQL queries from the PDF specification
  • AI Decision Tracking: Complete learning loop implementation

πŸ“Š Database Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PostgreSQL  │────▢│ MCP Server   │────▢│  Redis  β”‚
β”‚ (ACID Data) β”‚     β”‚  (Python)    β”‚     β”‚ (Cache) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚
                           β–Ό
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   MongoDB    β”‚
                    β”‚ (Documents)  β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Database Roles

  • PostgreSQL: Transactional data (10 tables: Guest, Room, Booking, AIPersonality, AIConversation, AIDecision, AIMemory, GuestProfile, SensorData, ProactiveAction)
  • MongoDB: Flexible document storage (Conversation transcripts with nested messages, AI memories with rich content)
  • Redis: Ultra-fast caching layer (Guest preferences, Recent sentiment, Sensor readings)

πŸš€ Quick Start

Prerequisites

  • Docker & Docker Compose
  • Python 3.11+
  • Claude Code (for MCP client)

1. Start Databases

# Start all services (PostgreSQL, MongoDB, Redis)
docker-compose up -d

# Verify all services are healthy
docker ps

# Check logs
docker-compose logs -f postgres
docker-compose logs -f mongodb
docker-compose logs -f redis

2. Verify Database Setup

# Connect to PostgreSQL
docker exec -it hotel-ai-postgres psql -U hotel_admin -d hotel_ai

# List tables (should show 10 tables)
\dt

# Check sample data
SELECT COUNT(*) FROM Guest;  -- Should show 100
SELECT COUNT(*) FROM Booking;  -- Should show 500
SELECT COUNT(*) FROM AIConversation;  -- Should show 1000

\q

# Connect to MongoDB
docker exec -it hotel-ai-mongodb mongosh -u hotel_admin -p hotel_password_2026 --authenticationDatabase admin

use hotel_ai
show collections  -- Should show: conversations, ai_memories
db.conversations.countDocuments()  -- Should show at least 1
exit

# Connect to Redis
docker exec -it hotel-ai-redis redis-cli
PING  -- Should return PONG
exit

3. Install Python Dependencies

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

4. Configure Environment

# Copy example environment file
cp .env.example .env

# Edit .env if needed (defaults should work with Docker)
# For local Docker: hosts are already set to localhost

5. Run MCP Server

# Start MCP server (connects via stdio to Claude Code)
python src/main.py

# Or run in background
nohup python src/main.py > mcp_server.log 2>&1 &

Configure in Claude Code:

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "hotel-ai": {
      "command": "python",
      "args": ["/absolute/path/to/HotelAiProject/src/main.py"],
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "MONGO_HOST": "localhost",
        "REDIS_HOST": "localhost"
      }
    }
  }
}

Test MCP Connection:

In Claude Code, you should see 19 available tools:

  • 13 query tools (12 from PDF + get_guest_profile)
  • 6 testing/benchmark tools

πŸ“ Project Structure

hotel-ai-mcp-server/
β”œβ”€β”€ docker-compose.yml                 # Multi-container orchestration
β”œβ”€β”€ .env.example                       # Environment template
β”œβ”€β”€ README.md                          # This file
β”œβ”€β”€ requirements.txt                   # Python dependencies
β”‚
β”œβ”€β”€ docker/                            # Docker configuration
β”‚   β”œβ”€β”€ postgres/init/                 # PostgreSQL initialization
β”‚   β”‚   β”œβ”€β”€ 01-create-schema.sql      # 10 tables (exact from PDF)
β”‚   β”‚   β”œβ”€β”€ 02-create-indexes.sql     # 14 performance indexes
β”‚   β”‚   └── 03-seed-data.sql          # Realistic sample data
β”‚   └── mongodb/init/                  # MongoDB initialization
β”‚       └── init-collections.js       # Conversation & memory collections
β”‚
β”œβ”€β”€ src/                               # Source code
β”‚   β”œβ”€β”€ main.py                       # MCP server entry point βœ…
β”‚   β”œβ”€β”€ config.py                     # Configuration management βœ…
β”‚   β”œβ”€β”€ database/                     # Database clients
β”‚   β”‚   β”œβ”€β”€ postgres_client.py        # PostgreSQL (12 queries) βœ…
β”‚   β”‚   β”œβ”€β”€ mongodb_client.py         # MongoDB operations βœ…
β”‚   β”‚   β”œβ”€β”€ redis_client.py           # Redis caching βœ…
β”‚   β”‚   └── models.py                 # Pydantic models βœ…
β”‚   └── mcp/                          # MCP implementation
β”‚       β”œβ”€β”€ server.py                 # MCP server setup βœ…
β”‚       └── tools/                    # MCP tools
β”‚           β”œβ”€β”€ query_tools.py        # 13 query tools βœ…
β”‚           └── testing_tools.py      # 6 benchmark tools βœ…
β”‚
└── tests/                            # Test suite
    └── test_database_clients.py      # Database tests βœ…

πŸ—„οΈ Database Schema

PostgreSQL Tables (10 tables)

Core Hotel Data:

  • Guest: 100 guests with profiles
  • Room: 150 rooms (10 floors Γ— 15 rooms)
  • Booking: 500 bookings (350 completed, 50 active, 100 future)

AI Core:

  • AIPersonality: Poe's configuration (learning_rate=0.75)
  • AIConversation: 1000 conversations with sentiment analysis
  • AIDecision: 1000 autonomous decisions (~85% success rate)
  • AIMemory: 500 memories about guests, patterns, events

AI Intelligence:

  • GuestProfile: 100 AI-generated profiles with preferences
  • SensorData: 10,000+ sensor readings (last 7 days)
  • ProactiveAction: 500 autonomous service actions

Indexes (14 strategic indexes)

All indexes from PDF Section 4.4 implemented:

  • Guest profile fast retrieval (<100ms)
  • Conversation timeline
  • Sensor time-series
  • Decision analysis
  • Memory retrieval
  • Room availability
  • And 8 more...

πŸ”§ Configuration

Edit .env file for custom configuration:

# Toggle Redis for benchmarking
REDIS_ENABLED=true  # Set to false to test without cache

# Cache TTLs
CACHE_TTL_GUEST_PREFERENCES=3600  # 1 hour
CACHE_TTL_RECENT_SENTIMENT=1800   # 30 minutes
CACHE_TTL_SENSOR_DATA=60          # 60 seconds

# Benchmark iterations
BENCHMARK_ITERATIONS=100

πŸ“Š Sample Data

The system includes realistic sample data for immediate testing:

  • 100 Guests: Mix of frequent (10), regular (10), and new guests (80)
  • 150 Rooms: All 4 types (Single, Double, Suite, Deluxe) across 10 floors
  • 500 Bookings: 70% AI-assigned, 30% manual
    • 350 completed (past 6 months)
    • 50 active (currently checked in)
    • 100 future (confirmed)
  • 1000 Conversations: Various topics, sentiments, channels
  • 1000 AI Decisions: 5 types, 85% success rate
  • 100 Guest Profiles: JSON preferences and behavior patterns
  • 10,000+ Sensor Readings: Temperature, occupancy, sound, light, door status
  • 500 Proactive Actions: With guest response feedback
  • 500 AI Memories: Linked to guests, bookings, conversations

🎯 MCP Tools (19 Tools Available)

Query Tools (13 tools)

From PDF Section 4.3 (12 queries):

  1. βœ… search_available_rooms - Find rooms for date range
  2. βœ… get_recent_conversations - Conversation history
  3. βœ… get_ai_decision_success_rate - Performance metrics
  4. βœ… find_low_satisfaction_guests - At-risk guests needing attention
  5. βœ… get_proactive_action_counts - Action type frequencies
  6. βœ… get_guest_stay_history - Complete booking history
  7. βœ… get_recent_sensor_data - IoT sensor readings
  8. βœ… count_successful_decisions_month - Monthly success count
  9. βœ… compare_ai_vs_manual_bookings - AI vs manual assignment
  10. βœ… get_recent_memory_access - Recently accessed memories
  11. βœ… find_high_confidence_failures - Learning opportunities
  12. βœ… get_proactive_actions_per_guest - Actions per active guest

Bonus: 13. βœ… get_guest_profile - Profile with cache demonstration

Testing/Benchmark Tools (6 tools)

  1. βœ… benchmark_query_with_redis - Measure with caching
  2. βœ… benchmark_query_without_redis - Measure without caching
  3. βœ… compare_redis_performance - Side-by-side Redis comparison (shows 10-20x speedup)
  4. βœ… validate_performance_requirements - Check <100ms/<500ms SLAs
  5. βœ… get_cache_statistics - Redis stats (hit rate, memory)
  6. βœ… clear_redis_cache - Clear cache for testing

Example Usage

# Find available rooms
User: "Show me available Double rooms for March 1-5, 2026"
β†’ Calls: search_available_rooms(check_in_date="2026-03-01", check_out_date="2026-03-05", room_type="Double")

# Benchmark Redis performance
User: "Prove that Redis improves performance for guest profile retrieval"
β†’ Calls: compare_redis_performance(guest_id=1, iterations=100)
β†’ Result: "12.1x faster with Redis (12ms vs 145ms), 92% latency reduction"

# Find at-risk guests
User: "Which guests need proactive attention right now?"
β†’ Calls: find_low_satisfaction_guests(threshold=3.0)

# Validate SLAs
User: "Are we meeting our performance requirements?"
β†’ Calls: validate_performance_requirements(guest_id=1, iterations=50)

πŸ§ͺ Testing

Manual Database Tests

# Test PostgreSQL queries
docker exec -it hotel-ai-postgres psql -U hotel_admin -d hotel_ai -c "
SELECT r.room_number, r.room_type, r.floor
FROM Room r
WHERE r.status = 'Available'
  AND r.room_type = 'Double'
LIMIT 5;
"

# Test MongoDB queries
docker exec -it hotel-ai-mongodb mongosh -u hotel_admin -p hotel_password_2026 --authenticationDatabase admin --eval "
db = db.getSiblingDB('hotel_ai');
db.conversations.findOne();
"

# Test Redis
docker exec -it hotel-ai-redis redis-cli PING

Performance Benchmarks (Expected)

Based on PDF specifications:

Operation Without Redis With Redis Improvement
Guest Profile Retrieval 145ms 12ms 12.1x faster
Room Search 285ms N/A Index optimized
Conversation History 420ms (relational) 95ms (MongoDB) 4.4x faster

πŸ“– Documentation

Based on PDF Specification

This implementation follows the complete database design from: DB_Semesterprojekt_AI_Hotel.pdf

Key sections implemented:

  • Section 2: Requirements Analysis (100%)
  • Section 3: Information Modeling (ER diagram, 10 entities)
  • Section 4: Relational Implementation (10 tables, 12 queries, 14 indexes)
  • Section 5: NoSQL Discussion (MongoDB + Redis integration)

Architecture Decisions

  1. PostgreSQL for Transactions: ACID compliance for bookings, ensures no double-bookings
  2. MongoDB for Conversations: Nested message arrays, flexible schema for AI evolution
  3. Redis for Caching: Sub-100ms access to frequently read data

πŸ› Troubleshooting

Database Connection Issues

# Check service health
docker-compose ps

# Restart services
docker-compose restart postgres mongodb redis

# View logs
docker-compose logs postgres

Port Conflicts

If ports 5432, 27017, or 6379 are already in use:

# Edit docker-compose.yml and change ports:
ports:
  - "5433:5432"  # PostgreSQL
  - "27018:27017"  # MongoDB
  - "6380:6379"  # Redis

Then update .env:

POSTGRES_PORT=5433
MONGO_PORT=27018
REDIS_PORT=6380

πŸ”„ Development Status

βœ… Phase 1-3: Infrastructure & Database Layer (COMPLETE)

  • [x] Docker infrastructure (PostgreSQL, MongoDB, Redis)
  • [x] Database schemas (10 tables, exact from PDF)
  • [x] Indexes (14 strategic indexes)
  • [x] Sample data generation (100 guests, 500 bookings, 1000+ items)
  • [x] MongoDB collections with validation
  • [x] Configuration management
  • [x] Pydantic models for type safety
  • [x] Database clients (PostgreSQL, MongoDB, Redis)
  • [x] Database client tests (all passing βœ“)

βœ… Phase 4-6: MCP Server Core (COMPLETE)

  • [x] MCP server with stdio transport
  • [x] 13 query tools (12 from PDF + get_guest_profile)
  • [x] 6 performance benchmarking tools
  • [x] Redis cache-aside pattern with toggle
  • [x] Connection pooling for all databases

πŸ“Š Current Capabilities

Total: 19 MCP Tools Ready

  • Query operations: 13 tools
  • Testing/benchmarking: 6 tools
  • Performance: <100ms cached, <500ms queries
  • Sample data: 100 guests, 500 bookings, 1000+ conversations

πŸ“‹ Future Enhancements (Optional)

  • [ ] Mutation tools (create_booking, log_ai_decision, etc.)
  • [ ] Analytics tools (trends, accuracy analysis)
  • [ ] MCP resources (browsable data)
  • [ ] MCP prompts (interaction templates)
  • [ ] Web UI for monitoring
  • [ ] Additional unit tests

πŸ“ License

This is an academic project for demonstrating database design and MCP server implementation.

🀝 Contributing

This is a semester project. For questions or suggestions, please open an issue.

πŸ“š References


Built with: Python, PostgreSQL, MongoDB, Redis, Docker, MCP SDK Purpose: Demonstrate hybrid database architecture with AI-driven hotel operations Author: Iyad Elwy Institution: PSE Master - KnowledgeFoundation@HSReutlingen

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured