# Real Estate Comp Puller (`meticulous_lemonade/real-estate-comp-puller`) Actor

MCP server that pulls recently-sold comps from Zillow & Redfin for any US address. Returns suggested value range, avg $/sqft, median sale price, and full comp list. Handles non-disclosure states (TX, LA + 13 others) using pending listings as proxies.

- **URL**: https://apify.com/meticulous\_lemonade/real-estate-comp-puller.md
- **Developed by:** [Andrew Moon](https://apify.com/meticulous_lemonade) (community)
- **Categories:** Real estate, Automation
- **Stats:** 2 total users, 0 monthly users, 0.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $900.00 / 1,000 comp report generateds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## 🏠 Real Estate Comp Puller — Apify MCP Server

An MCP (Model Context Protocol) server that pulls recently-sold comparable properties from **Zillow** and **Redfin** for any US address, deduplicates them, and returns a structured analysis with a suggested value range, avg $/sqft, and supporting comp list.

Built for homeowners and buyers who want a quick, AI-accessible answer to: *"What's this property worth?"*

---

### What it does

Given an address (plus optional beds/baths/sqft), the `get_comps` tool:

1. Fetches recently-sold listings from Zillow and Redfin via Apify scrapers
2. Deduplicates results across sources
3. Filters by bed/bath match (±1) and sqft tolerance (default ±20%)
4. Returns:
   - **Suggested value range** (±5% of avg comp price)
   - **Avg & median sale price**
   - **Avg price per sqft**
   - **Avg days on market**
   - **Full comp list** sorted by sold date

---

### Project structure

````

real-estate-comp-puller/
├── .actor/
│   ├── actor.json          ## Apify Actor config (standby mode, MCP path)
│   ├── Dockerfile          ## Container build
│   └── pay\_per\_event.json  ## PPE pricing ($0.25/report)
├── src/
│   ├── **init**.py
│   ├── **main**.py         ## Entrypoint
│   ├── main.py             ## MCP server + Starlette app
│   ├── zillow.py           ## Zillow scraper via Apify
│   ├── redfin.py           ## Redfin scraper via Apify
│   └── analysis.py         ## Dedup, filter, and analysis logic
├── requirements.txt
└── README.md

````

---

### Local development

#### 1. Install deps

```bash
pip install -r requirements.txt
````

#### 2. Set env vars

```bash
export APIFY_TOKEN=your_apify_token_here
export APIFY_META_ORIGIN=STANDBY
export ACTOR_STANDBY_PORT=3000
```

#### 3. Run

```bash
python -m src
```

The MCP server will be available at: `http://localhost:3000/mcp`

***

### Deploy to Apify

#### 1. Install Apify CLI

```bash
npm install -g apify-cli
apify login
```

#### 2. Push the Actor

```bash
apify push
```

#### 3. Enable Standby mode

In Apify Console → your Actor → Settings → enable **Standby mode**.

#### 4. Set your APIFY\_TOKEN env var

In Apify Console → your Actor → Settings → Environment variables:

- `APIFY_TOKEN` = your token (needed to call Zillow/Redfin sub-actors)

#### 5. Connect from Claude or any MCP client

```json
{
  "mcpServers": {
    "real-estate-comp-puller": {
      "type": "http",
      "url": "https://YOUR_USERNAME--real-estate-comp-puller.apify.actor/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

***

### Monetization

This Actor uses **Pay Per Event (PPE)** pricing at **$0.25 per comp report**.

- Users are charged once per successful `get_comps` call that returns results
- You earn 80% → **~$0.20/report** after Apify's 20% commission
- Platform costs (Zillow + Redfin actor runs, proxies) ~$0.03–0.07/run
- **Net ~$0.13–0.17 per report**

To activate monetization:

1. Go to Apify Console → your Actor → Publication
2. Select **Pay Per Event**
3. The events are pre-configured in `.actor/pay_per_event.json`

***

### Example prompt

> "Pull comps for 456 Oak Ave, Austin TX 78704 — 3 bed, 2 bath, 1800 sqft"

**Example response:**

```json
{
  "comp_count": 7,
  "summary": {
    "suggested_value_range": { "low": "$418,500", "high": "$461,900" },
    "avg_sale_price": "$440,200",
    "median_sale_price": "$435,000",
    "avg_price_per_sqft": "$241.50",
    "avg_days_on_market": 18.3,
    "sources": ["zillow", "redfin"]
  },
  "comps": [...]
}
```

***

### Roadmap

- \[ ] Geocoding for true radius-based filtering (Google Maps / Nominatim)
- \[ ] Realtor.com as a third source
- \[ ] Price history trend chart
- \[ ] Neighborhood median price trend (90-day, 180-day)
- \[ ] Free tier: 1 free report, then PPE kicks in

## Actor input object example

```json
{}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("meticulous_lemonade/real-estate-comp-puller").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("meticulous_lemonade/real-estate-comp-puller").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call meticulous_lemonade/real-estate-comp-puller --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=meticulous_lemonade/real-estate-comp-puller",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Real Estate Comp Puller",
        "description": "MCP server that pulls recently-sold comps from Zillow & Redfin for any US address. Returns suggested value range, avg $/sqft, median sale price, and full comp list. Handles non-disclosure states (TX, LA + 13 others) using pending listings as proxies.",
        "version": "0.1",
        "x-build-id": "u9oTw3ifMvUmVYJxc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/meticulous_lemonade~real-estate-comp-puller/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-meticulous_lemonade-real-estate-comp-puller",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/meticulous_lemonade~real-estate-comp-puller/runs": {
            "post": {
                "operationId": "runs-sync-meticulous_lemonade-real-estate-comp-puller",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/meticulous_lemonade~real-estate-comp-puller/run-sync": {
            "post": {
                "operationId": "run-sync-meticulous_lemonade-real-estate-comp-puller",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {}
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
