cwa-mcp-server
cwa-mcp-server
MCP サーバー。中央気象署(CWA)のオープンデータ API をラップし、エージェントが天気予報、地震報告、気象特報、台風警報を照会して、避難アドバイスを生成できるようにします。
機能
Related MCP server: mcp-cwa
ツール get_weather_forecast(county) — 指定した県・市の今後 36 時間の天気予報
ツール get_earthquake_report(limit) — 直近 N 件の顕著な有感地震報告
ツール get_weather_warning(county) — 指定した県・市で現在有効な気象警報(大雨、強風など)
ツール get_typhoon_warning(limit) — 直近 N 件の台風警報
リソース cwa://counties — 有効な県市名の一覧
プロンプト evacuation_advisory(county) — リアルタイムの天気・警報・地震・台風データに基づいて避難アドバイスを生成するためのプロンプトテンプレート
API Key の申請
気象データ開放プラットフォーム で登録(メールとパスワードのみ、審査不要)
ログイン後、「API 認可コード」→「認可コードを取得」をクリックすると、即座にキーが生成されます
インストール(一般ユーザー)
PyPI に公開済みなので、この repo をクローンする必要はありません。Claude Desktop / Claude Code の MCP 設定で uvx を指定して実行すれば、自動的にパッケージを取得します。
{
"mcpServers": {
"cwa-weather": {
"command": "uvx",
"args": ["cwa-mcp-server"],
"env": { "CWA_API_KEY": "你申請到的授權碼" }
}
}
}または Claude Code CLI を使う方法:
claude mcp add cwa-weather -e CWA_API_KEY=你申請到的授權碼 -- uvx cwa-mcp-server開発(この repo のソースコードを変更する場合)
git clone https://github.com/gary2376/cwa-mcp-server
cd cwa-mcp-server
uv sync
cp .env.example .env # 填入 CWA_API_KEY
uv run python tests/test_client.py # 最小自我檢查(不打真網路)
uv run mcp dev src/cwa_mcp/server.py # 本地用 inspector 手動測試 tools状態
4つのツール(天気予報、地震報告、気象警報、台風警報)はすべて実キーでオンライン API に接続して検証済みであり、Claude Code にも接続して実際の会話フローをテスト済みです。リスクレベルを正しく判断し、具体的なアドバイスを提示できます。PyPI と MCP Server Registry に公開済みです。
既知の修正済みの不具合: v0.1.0 で最初にアップロードした wheel は、uv_build がデフォルトで project.name からモジュール名(cwa_mcp_server)を推測するため、実際のソースコードディレクトリ
src/cwa_mcp/ と一致せず、空のパッケージとしてビルドされました。uvx cwa-mcp-server を実行すると ModuleNotFoundError が発生します。pyproject.toml に [tool.uv.build-backend] module-name = "cwa_mcp" を追加して修正し、ビルドし直して内容が正しいことを検証済みです。
License
MIT
Available Tools
4 toolsget_earthquake_reportA
查詢最近 N 筆顯著有感地震報告(時間、地點、規模、深度)。
Inputs: limit. Returns: result
get_typhoon_warningA
查詢最近 N 筆颱風警報(命名、路徑強度描述、大雨/強風特報段落)。
Inputs: limit. Returns: result
get_weather_forecastA
查詢指定縣市未來 36 小時天氣預報(天氣現象、降雨機率、氣溫等)。
county 必須是 cwa://counties 清單中的完整縣市名稱,例如「臺北市」。
Inputs: county (required). Returns: result
get_weather_warningB
查詢指定縣市目前生效中的天氣特報(豪雨、強風等現象與有效時段)。
county 必須是 cwa://counties 清單中的完整縣市名稱,例如「臺北市」。
Inputs: county (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The four tools cover distinct domains: weather forecast, earthquake reports, weather warnings, and typhoon warnings. However, get_weather_warning and get_typhoon_warning could overlap during typhoons (heavy rain/strong wind warnings), but their descriptions focus on different parameters, so confusion is minimal.
All tools follow a get_<domain>_<type> pattern, making them predictable. The only deviation is 'report' in get_earthquake_report versus 'forecast' and 'warning' in others, which is a minor inconsistency but does not harm readability.
At 4 tools, the server is tightly scoped to the Central Weather Administration's primary data products. This is within the ideal 3-15 range, and each tool justifies its presence.
The server covers forecast, seismic events, and warnings comprehensively for its niche. Minor gaps exist, such as no get_current_weather or an explicit county-list tool (referenced externally via cwa://counties), but these are easily worked around and do not break core workflows.
Maintenance
Related MCP Connectors
Taiwan data for AI agents: THSR/TRA timetables, TWSE/TPEx stocks, invoice lottery, garbage, outages
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Taiwan official open data for AI agents: property prices and laws in English, with change alerts
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides access to Hong Kong Observatory weather data APIs, enabling retrieval of forecasts, earthquake info, tide data, and more via natural language.202MIT
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Taiwan's Central Weather Administration (CWA) Open Data API, offering 36 tools across 7 categories including weather forecasts, observations, earthquakes, and astronomy.MIT
- AlicenseAqualityDmaintenanceEnables to access Taiwan Central Weather Administration data, including 3-day and 1-week weather forecasts for counties/cities and historical rainfall data.3MIT
- AlicenseAqualityCmaintenanceAn MCP server that provides real-time weather forecasts, weather warnings, and recent earthquake information in Taiwan via the Central Weather Administration's open data API.3MIT