# Miami Property Estimator Backend

## Setup

1. Create a virtual environment:
   ```bash
   python -m venv venv
   source venv/bin/activate  # Linux/Mac
   venv\Scripts\activate     # Windows
   ```

2. Install dependencies:
   ```bash
   pip install -r requirements.txt
   ```

3. Set up API Keys (optional but recommended):
   
   **MCP API Key** (for property data):
   ```bash
   export MCP_API_KEY="your-mcp-api-key"
   ```
   
   **Google Gemini API Key** (for AI property estimation):
   ```bash
   export GEMINI_API_KEY="your-gemini-api-key"
   ```
   
   Get your Google Gemini API key from: https://aistudio.google.com/app/apikey
   
   Note: If GEMINI_API_KEY is not set, property estimation will be disabled but the server will still work for property lookups.

4. Run the server:
   ```bash
   python main.py
   ```
   
   The server will start on `http://localhost:5001`

## Features

- **Property Lookup**: Fetches property data from MCP service
- **AI Estimation**: Uses Google Gemini to estimate property value (requires GEMINI_API_KEY)
- **REST API**: Exposes `/address` endpoint for property lookups

## Endpoints

- `GET /` - Health check
- `POST /address` - Lookup property and get AI estimate
  - Body: `{"address": "123 Main St, Miami, FL"}`
  - Returns: Property data + Gemini AI estimate
- `GET /debug` - Debug endpoint showing request headers