# FHFA House Price Index MCP — HPI & Mortgage Market Data (`andrew_avina/fhfa-housing-mcp`) Actor

Label: FHFA | Sublabel: HOUSE PRICE

- **URL**: https://apify.com/andrew\_avina/fhfa-housing-mcp.md
- **Developed by:** [Andrew Avina](https://apify.com/andrew_avina) (community)
- **Categories:** MCP servers, Business
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 result item returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## FHFA House Price Index MCP

**Label:** FHFA | **Sublabel:** HOUSE PRICE

A government data intelligence actor that serves Federal Housing Finance Agency (FHFA) House Price Index (HPI) data for U.S. metros, states, and nationally. Runs as a one-shot Apify dataset actor or as a persistent HTTP MCP server for AI agent and mortgage market analysis integration.

---

### What This Actor Does

- Queries the FHFA open data portal (`data.fhfa.gov`) for HPI records
- Supports annual and quarterly HPI at the metro (MSA), state, and national level
- Provides HPI index values (base Q1 1991 = 100) and year-over-year percentage changes
- Falls back to a curated dataset of 20 real FHFA HPI records if the live API is unavailable
- Exposes an MCP tool (`query_fhfa_hpi`) for AI agent integration

---

### What Is the FHFA HPI?

The FHFA House Price Index is the most comprehensive and broadly cited measure of U.S. residential house prices. It tracks changes in the value of single-family homes based on repeat-sales data from Fannie Mae and Freddie Mac conventional conforming mortgages. The HPI is base-indexed to Q1 1991 = 100.

Current national HPI (2023): approximately **462.8** — meaning average prices have risen ~362% since 1991.

---

### Output Fields

| Field | Description |
|-------|-------------|
| `metro_or_state` | Metro area name or state name |
| `period` | Year (annual) or year+quarter (e.g. `2023Q3`) |
| `hpi_index` | FHFA HPI value (base 100 = Q1 1991) |
| `hpi_change_pct` | Year-over-year change in percent |
| `area_type` | MSA, State, or National |
| `source` | Always "FHFA HPI" |

---

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `area` | string | _(blank)_ | Metro or state name (e.g. "Los Angeles", "Texas") |
| `periodType` | string | `annual` | Data frequency: `annual` or `quarterly` |
| `year` | integer | _(blank)_ | Filter to specific year (e.g. 2023) |
| `limit` | integer | `50` | Max records to return (1–500) |
| `serveMcp` | boolean | `false` | Start HTTP MCP server on port 4321 |

---

### Usage Modes

#### Batch Mode (default)

Run with `serveMcp: false`. The actor queries the FHFA open data API, normalizes results, and pushes records to an Apify dataset.

**Example input — top metros annual 2023:**
```json
{
  "periodType": "annual",
  "year": 2023,
  "limit": 50,
  "serveMcp": false
}
````

**Example input — specific metro quarterly:**

```json
{
  "area": "Phoenix",
  "periodType": "quarterly",
  "limit": 20,
  "serveMcp": false
}
```

#### MCP Server Mode

Set `serveMcp: true`. The actor starts an HTTP server on port 4321 and exposes:

- `GET /` — Health check (`label: "FHFA"`, `sublabel: "HOUSE PRICE"`)
- `GET /mcp/tools` — List available MCP tools
- `POST /` — Execute a tool call (`{"tool": "query_fhfa_hpi", "arguments": {...}}`)

***

### Data Source

**Federal Housing Finance Agency (FHFA)**

- Open Data Portal: `https://data.fhfa.gov`
- HPI Dataset: `https://data.fhfa.gov/api/explore/v2.1/catalog/datasets/hpi-master/records`
- Published quarterly; no API key required for public access
- Official source: [fhfa.gov/DataTools/Downloads/Pages/House-Price-Index.aspx](https://www.fhfa.gov/DataTools/Downloads/Pages/House-Price-Index.aspx)

***

### Fallback Dataset

The curated fallback contains **20 real FHFA HPI records** for 2023:

| Area | HPI Index | YoY Change |
|------|-----------|-----------|
| New York-Newark-Jersey City | 452.3 | +5.8% |
| Los Angeles-Long Beach-Anaheim | 612.7 | +4.2% |
| Chicago-Naperville-Elgin | 348.1 | +6.1% |
| Houston-The Woodlands-Sugar Land | 389.4 | +3.7% |
| Phoenix-Mesa-Chandler | 524.6 | +2.1% |
| Miami-Fort Lauderdale-Pompano Beach | 539.6 | +8.4% |
| Dallas-Fort Worth-Arlington | 445.2 | +2.8% |
| Austin-Round Rock-Georgetown | 511.8 | -3.9% |
| Seattle-Tacoma-Bellevue | 558.9 | +4.0% |
| United States (National) | 462.8 | +5.5% |
| ...and 10 more metros/states | | |

***

### Use Cases

- Real estate market intelligence and investment analysis
- Mortgage market research and risk modeling
- AI-powered housing affordability analysis
- Geographic comparison of price appreciation trends
- Integration with MCP-compatible AI assistants for real-time housing Q\&A

***

### Categories

`MCP_SERVERS` | `BUSINESS`

# Actor input Schema

## `serveMcp` (type: `boolean`):

If true, starts an HTTP MCP server on port 4321 to serve tools to MCP clients instead of running a one-shot batch query.

## `area` (type: `string`):

Metro area or state name to filter results (e.g. 'New York', 'Los Angeles', 'Texas'). Leave blank for all areas.

## `periodType` (type: `string`):

Return annual or quarterly HPI data. Valid values: 'annual', 'quarterly'.

## `year` (type: `integer`):

Filter to a specific year (e.g. 2023). Leave blank for multi-year data.

## `limit` (type: `integer`):

Maximum number of records to return (1–500).

## Actor input object example

```json
{
  "serveMcp": false,
  "periodType": "annual",
  "limit": 50
}
```

# 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("andrew_avina/fhfa-housing-mcp").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("andrew_avina/fhfa-housing-mcp").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 andrew_avina/fhfa-housing-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=andrew_avina/fhfa-housing-mcp",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "FHFA House Price Index MCP — HPI & Mortgage Market Data",
        "description": "Label: FHFA | Sublabel: HOUSE PRICE",
        "version": "0.1",
        "x-build-id": "c2JmBHKEoQQbEfZ7Q"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/andrew_avina~fhfa-housing-mcp/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-andrew_avina-fhfa-housing-mcp",
                "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/andrew_avina~fhfa-housing-mcp/runs": {
            "post": {
                "operationId": "runs-sync-andrew_avina-fhfa-housing-mcp",
                "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/andrew_avina~fhfa-housing-mcp/run-sync": {
            "post": {
                "operationId": "run-sync-andrew_avina-fhfa-housing-mcp",
                "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": {
                    "serveMcp": {
                        "title": "Serve as MCP Server",
                        "type": "boolean",
                        "description": "If true, starts an HTTP MCP server on port 4321 to serve tools to MCP clients instead of running a one-shot batch query.",
                        "default": false
                    },
                    "area": {
                        "title": "Area (MSA or State)",
                        "type": "string",
                        "description": "Metro area or state name to filter results (e.g. 'New York', 'Los Angeles', 'Texas'). Leave blank for all areas."
                    },
                    "periodType": {
                        "title": "Period Type",
                        "type": "string",
                        "description": "Return annual or quarterly HPI data. Valid values: 'annual', 'quarterly'.",
                        "default": "annual"
                    },
                    "year": {
                        "title": "Year",
                        "type": "integer",
                        "description": "Filter to a specific year (e.g. 2023). Leave blank for multi-year data."
                    },
                    "limit": {
                        "title": "Result Limit",
                        "type": "integer",
                        "description": "Maximum number of records to return (1–500).",
                        "default": 50
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
