# Japan Property Hazard Scraper — Japan Used & Resale Market D... (`fruitful_quintessence/japan-property-hazard-mcp`) Actor

Query flood, earthquake, and landslide hazard risk data for Japanese properties via MCP protocol. Structured hazard map overlay data for real estate due diligence.

- **URL**: https://apify.com/fruitful_quintessence/japan-property-hazard-mcp.md
- **Developed by:** [atushi ino](https://apify.com/fruitful_quintessence) (community)
- **Categories:** E-commerce, Automation, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## MCP Hazard Server — 日本物件ハザードリスク

住所を渡すと、その地点のハザードリスク(洪水・土砂・津波・液状化)を 0-3 で返す
Model Context Protocol サーバー。AIエージェント(Claude / ChatGPT / Cursor 等)から
ツールとして呼び出せる。

### アーキテクチャ

```
住所文字列
  │  (1) ジオコーディング: 国土地理院 住所検索API (APIキー不要)
  ▼
緯度経度 (lat, lon)
  │  (2) ハザード取得: 国土交通省 不動産情報ライブラリAPI (XKT025-029, BYOK)
  ▼
{address, lat, lon, flood, landslide, tsunami, liquefaction, sources, credit}
```

### リスクレベル定義 (0-3)

| レベル | 意味 |
|--------|------|
| 0 | 情報なし / 区域外 |
| 1 | 低 (浸水深 <0.5m 等) |
| 2 | 中 (浸水深 0.5〜3m) |
| 3 | 高 (浸水深 >=3m / 警戒区域内) |

### 出力例

```json
{
  "address": "東京都千代田区丸の内1-1",
  "lat": 35.684559,
  "lon": 139.761765,
  "flood": 0, "landslide": 0, "tsunami": 0, "liquefaction": 0,
  "sources": ["MLIT_XKT025","MLIT_XKT026","MLIT_XKT027","MLIT_XKT028","MLIT_XKT029"],
  "credit": "出典: 国土交通省 不動産情報ライブラリAPI (国土数値情報, CC-BY 4.0相当) ..."
}
```

### セットアップ

```bash
export MLIT_API_KEY="<あなたのAPIキー>"   # BYOK: 利用者自身が取得
```

#### MLIT 不動産情報ライブラリAPIキーの取得 (無料)

1. https://www.reinfolib.mlit.go.jp/ にアクセス
2. 「API利用申請」からメールアドレス等を登録
3. 発行されたキーを `Ocp-Apim-Subscription-Key` として設定
   (`MLIT_API_KEY` 環境変数、または `get_hazard(api_key=...)` 引数)

キー未設定の場合、ジオコーディングは動作するがハザード値は全て 0(情報なし)となる。

### ローカル実行

```bash
uvicorn mcp_hazard.server:app --host 0.0.0.0 --port 8000
## または
python mcp_hazard/server.py
```

### MCP 接続確認

```bash
BASE=http://localhost:8000

## initialize
curl -sS -D /tmp/h.txt -X POST $BASE/mcp \
  -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"t","version":"1.0"}}}'

## tools/list
curl -sS -X POST $BASE/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

## tools/call (住所のみ)
curl -sS -X POST $BASE/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_hazard","arguments":{"address":"東京都千代田区丸の内1-1"}}}'
```

### テスト

```bash
python -m pytest tests/test_mcp_hazard.py -v   # 26 tests
python -m mypy mcp_hazard/                      # strict 0 error
```

### データソースとライセンス

- ジオコーディング: 国土地理院 住所検索API (キー不要)
- ハザード: 国土交通省 不動産情報ライブラリAPI (XKT025-029)
- 出典表示は出力の `credit` フィールドに必ず含まれる (CC-BY 4.0相当)

### Apify Actor

- `actor.json`: `usesStandbyMode: true`, `webServerMcpPath: "/mcp"`
- `pay_per_event.json`: `$0.005/call` (PPE課金)

# Actor input Schema

## Actor input object example

```json
{}
```

# Actor output Schema

## `mcp_endpoint` (type: `string`):

Streamable-HTTP MCP endpoint of this run's Standby container (append /mcp, Bearer Apify token required).

## `run_output` (type: `string`):

Console view of this run (MCP servers return results inline over the protocol, not via dataset).

# 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("fruitful_quintessence/japan-property-hazard-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("fruitful_quintessence/japan-property-hazard-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).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 fruitful_quintessence/japan-property-hazard-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fruitful_quintessence/japan-property-hazard-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XJCgrhOZE47qc7T3i/builds/JRX0TAG3bv7QVYWTh/openapi.json
