korea-data-mcp

korea-data-mcp

MCP server providing normalized JSON APIs for Korean public data, including holidays, business days, and real estate transactions.

Category
访问服务器

README

Korea Data Suite

English | 한국어

Clean, developer-friendly REST APIs for Korean public data. Korean government open data is powerful but hard to consume — Korean-only docs, XML responses, legacy auth. This suite normalizes it into simple JSON APIs.

Try it on RapidAPI — free tier, no setup. Hosted and auto-updated; same code as this repo. For AI agents, it's on the MCP Registryuvx korea-data-mcp.

APIs

API Status Description
Holidays & Business Days ✅ v1 Korean public holidays (incl. substitute & temporary holidays) and business-day calculations
Real Estate Transactions ✅ v1 Normalized MOLIT real transaction prices (apartment/officetel/land, sale & rent) — nationwide (261 sigungu)
Address Toolkit 🚧 planned Road/lot address conversion, romanization
Business Registration 🚧 planned BRN validation & enrichment

Get started

Hosted (recommended) — a maintained instance with a free tier and no setup:

Subscribe on RapidAPI, grab your key, and call any endpoint. RapidAPI injects the key for you — copy a ready-made snippet from its Code Snippets panel.

RapidAPI (hosted) Self-host
Setup API key in seconds data.go.kr key + server + cron
Data refresh automatic (we run the sync) you manage the scheduler
Cost free tier, then paid free (your own infra)

Both run the exact same code (this repo). Pick RapidAPI if you'd rather not operate data pipelines; self-host if you want full control.

Self-host

uv sync
uv run uvicorn app.main:app --port 8642
curl "http://127.0.0.1:8642/v1/health"

Holidays & Business Days API

# All holidays in a year (or a month)
curl "http://127.0.0.1:8642/v1/holidays?year=2026" -H "X-API-Key: <key>"

# Is a given date a holiday / business day?
curl "http://127.0.0.1:8642/v1/holidays/check?date=2026-03-02" -H "X-API-Key: <key>"

# Add N business days (skips weekends & holidays)
curl "http://127.0.0.1:8642/v1/business-days/add?date=2026-12-31&days=1" -H "X-API-Key: <key>"

# Count business days in a range (inclusive)
curl "http://127.0.0.1:8642/v1/business-days/count?start=2026-09-21&end=2026-09-27" -H "X-API-Key: <key>"

Covers official public holidays, substitute holidays (대체공휴일), temporary holidays (임시공휴일), and election days — the cases most global holiday APIs get wrong for Korea.

Real Estate Transactions API

Normalized MOLIT (Ministry of Land) real transaction prices — apartment, officetel, and land; sale, jeonse, and monthly-rent — as clean English JSON with cursor pagination.

# Real transaction prices (apartment sales in Gangnam-gu)
curl "http://127.0.0.1:8642/v1/realestate/transactions?region=11680&property_type=apartment&trade_type=sale" -H "X-API-Key: <key>"

# Filter by date range + paginate with the returned cursor
curl "http://127.0.0.1:8642/v1/realestate/transactions?region=11680&date_from=2026-01-01&limit=50&cursor=<next_cursor>" -H "X-API-Key: <key>"

# Region codes (LAWD 5-digit)
curl "http://127.0.0.1:8642/v1/realestate/regions" -H "X-API-Key: <key>"

Daily sync ingests the current + previous month; use the backfill CLI for history:

uv run python scripts/backfill.py --from 2025-01 --to 2025-12 --regions 11680,11650

Configuration

Environment variables (prefix KDS_, .env supported):

Variable Default Description
KDS_DEV_MODE false Skip API-key auth (local dev)
KDS_API_KEYS Comma-separated accepted API keys
KDS_PROXY_SECRETS Comma-separated marketplace proxy secrets
KDS_DB_PATH data/kds.db SQLite path
KDS_DATA_GO_KR_KEY data.go.kr service key (optional; enables holiday + real-estate sync)
KDS_ENABLE_SCHEDULER true Holiday (weekly) + real-estate (daily) sync scheduler
KDS_RE_REGIONS all 261 nationwide sigungu Comma LAWD codes to sync (subset override)
KDS_RE_DATASETS all Comma dataset keys (apt_trade, apt_rent, offi_trade, offi_rent, land_trade)

Data sources & attribution

  • Holiday data: KASI Special Day Information (한국천문연구원 특일정보), via Korea Public Data Portal (data.go.kr) — KOGL Type 1. Ships with bundled seed data (2025–2027); refreshed weekly when a service key is configured.
  • Real transaction data: MOLIT 실거래가 공개시스템 (국토교통부), via Korea Public Data Portal (data.go.kr) — KOGL Type 1.

Run as a daemon (macOS)

# Install & start (auto-restart on crash, start at login)
./scripts/install-daemon.sh

# With Cloudflare Tunnel (after one-time `cloudflared tunnel login/create`)
./scripts/install-daemon.sh --with-tunnel

# Logs
tail -f ~/Library/Logs/kds/api.out.log

# Uninstall
launchctl bootout "gui/$(id -u)" ~/Library/LaunchAgents/com.choiyounggi.kds-api.plist
rm ~/Library/LaunchAgents/com.choiyounggi.kds-api.plist

To keep the machine awake for serving, disable system sleep (sudo pmset -a sleep 0) or use a dedicated always-on machine. See deploy/cloudflared.example.yml for exposing the API via Cloudflare Tunnel without opening ports.

Handling concurrent traffic

The read path and the write path are separated so traffic scales independently:

  • SQLite in WAL mode (set once at init) + busy_timeout — readers never block the daily writer and vice-versa, and multiple read workers can run concurrently.
  • API process is read-only, multi-worker. scripts/run.sh runs uvicorn with --workers ${KDS_WORKERS:-2} and KDS_ENABLE_SCHEDULER=false. Each worker is a separate process (separate GIL); WAL lets them all read at once. Raise KDS_WORKERS to scale reads with cores.
  • The daily ingest runs as its own process (com.choiyounggi.kds-sync, 04:00) via scripts/sync.py — never inside the API server, so a multi-thousand-row batch never competes with request handling for the GIL.
  • Edge caching (optional): responses carry Cache-Control: no-store for security. The real-estate data is public and changes at most daily — if origin load grows, serve it with a short Cache-Control: public, max-age=... and let the CDN absorb reads.

Security checklist before exposing externally

The app is hardened at the code layer (API-key auth fail-closed, parameterized SQL, strict input validation, security headers on every response including 5xx, docs/schema off by default, sanitized errors). The following are edge/deploy responsibilities that must be in place before opening the tunnel:

  • Never set KDS_DEV_MODE=true in production — it disables all auth. The app logs a warning at startup if it is on.
  • Cloudflare rate limiting + WAF on the tunnel hostname — the app has no app-layer rate limit by design (edge responsibility).
  • HSTS + TLS are terminated at the Cloudflare edge; confirm HSTS is enabled there (the origin serves plain HTTP on 127.0.0.1 only).
  • Keep KDS_ENABLE_DOCS unset (or false) in production; set true only to serve /docs /openapi.json at the origin.

SEO marketing site (programmatic)

A static, SEO-optimized marketing site is generated from the live DB by scripts/gen_site.py. For every region that has real transaction data it emits a Korean landing page (the query users actually type — "강남구 아파트 실거래가 API" — backed by real MOLIT stats, a working curl example, and a signup CTA), plus a holidays pillar page, a home page, sitemap.xml, and robots.txt.

Quality gate (important): a region is only published if it has at least MIN_SALE_ROWS (30) apartment-sale rows. Regions without enough data are skipped — this deliberately avoids thin/doorway pages, which search engines penalize.

# generate into site/dist (reads data/kds.db)
uv run python scripts/gen_site.py --out site/dist

Config is env-driven so the same generator works for any domain (put these in deploy/site.env, gitignored — copy deploy/site.env.example):

Env Meaning
KDS_SITE_URL canonical/sitemap base, e.g. https://korea-data.cloud
KDS_API_ORIGIN origin shown in the on-page curl examples, e.g. https://api.korea-data.cloud
KDS_CTA_URL signup call-to-action (RapidAPI / Zyla / Postman listing)
KDS_SITE_DIR output dir the app serves (default site/dist)

Serving — the API app serves it

The FastAPI app serves site/dist at all non-API paths (app.mount("/")), while /v1/* stays the JSON API. The two get different response headers: the API keeps its locked-down default-src 'none' CSP + no-store; the site gets an HTML-renderable CSP (script-src 'none', inline styles allowed) + public cache. Files are read from disk per request, so regenerating the site goes live with no app restart — only a code change needs a restart.

The site is served on the same host as the API (api.korea-data.cloud) — the API lives under /v1, the site everywhere else — so no new tunnel hostname or DNS is needed. One-time on the serving host:

cp deploy/site.env.example deploy/site.env    # KDS_SITE_URL == KDS_API_ORIGIN == https://api.korea-data.cloud
uv run python scripts/gen_site.py --out site/dist   # generate once
# restart the API app so this integration (new code) takes effect — the site is
# then live at https://api.korea-data.cloud/ , /holidays/ , /realestate/... .

Submit https://api.korea-data.cloud/sitemap.xml once in Google Search Console.

Want the site on a bare korea-data.cloud / www later? Add an ingress rule pointing that hostname at the same http://127.0.0.1:8642, route its DNS, and switch KDS_SITE_URL to it. Not required — the api host works for SEO today.

First run needs history: the daily sync only ingests the current month. To give pages real depth, backfill once — uv run python scripts/backfill.py --from 2025-07 --to 2026-06 --regions <codes> --datasets apt_trade,apt_rent.

Automate (macOS daemon)

deploy/com.choiyounggi.kds-site.plist regenerates the site daily at 04:30 (right after the 04:00 sync) via scripts/publish_site.sh. Because the app serves from disk, the refreshed pages are live immediately — no restart, no external deploy:

cp deploy/com.choiyounggi.kds-site.plist ~/Library/LaunchAgents/
launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/com.choiyounggi.kds-site.plist
tail -f ~/Library/Logs/kds/site.out.log

Uptime note: since the site is served by the local app (not a CDN), its SEO availability tracks the machine — keep it awake for serving (pmset, as the API already requires). If always-on hosting is wanted later, the same site/dist can be pushed to Cloudflare Pages instead.

MCP server (AI-agent access)

The API is also packaged as a standalone Model Context Protocol server — packages/korea-data-mcp/ — so AI agents (Claude Desktop/Code, Cursor, …) can discover and call the endpoints directly. It is its own minimal package (deps: mcp, httpx) and is what gets published to PyPI / listed in the MCP Registry.

Quick add (before PyPI, straight from this repo — users bring their own key):

claude mcp add korea-data-suite --env KDS_API_KEY=<key> \
  -- uvx --from "git+https://github.com/choiyounggi/korea-data-suite#subdirectory=packages/korea-data-mcp" korea-data-mcp

See packages/korea-data-mcp/README.md for tools, client config, and uvx korea-data-mcp (once on PyPI).

License

MIT © choiyounggi

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选