Skip to main content
Glama
cwa-mcp-server

cwa-mcp-server

by gary2376

cwa-mcp-server

MCP server,包中央氣象署(CWA)開放資料 API,讓 agent 能查天氣預報、地震報告、天氣特報、颱風警報,並產生避難建議。

功能

  • Tool get_weather_forecast(county) — 縣市未來 36 小時天氣預報

  • Tool get_earthquake_report(limit) — 最近 N 筆顯著有感地震報告

  • Tool get_weather_warning(county) — 縣市目前生效中的天氣特報(豪雨、強風等)

  • Tool get_typhoon_warning(limit) — 最近 N 筆颱風警報

  • Resource cwa://counties — 合法縣市名稱清單

  • Prompt evacuation_advisory(county) — 根據即時天氣/特報/地震/颱風資料生成避難建議的提示模板

Related MCP server: mcp-cwa

申請 API Key

  1. 到 氣象資料開放平台 註冊會員(email + 密碼即可,免審核)

  2. 登入後點「API 授權碼」→「取得授權碼」,立即產生 key

安裝(一般使用者)

已發布到 PyPI,不需要 clone 這個 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

狀態

四個 tool(天氣預報、地震報告、天氣特報、颱風警報)都已用真實 key 打過線上 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" 修正,重新 build 驗證過 wheel 內容正確。

License

MIT

Available Tools

4 tools
get_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

    A3.8/5.0

    Scored across 4 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Provides access to Hong Kong Observatory weather data APIs, enabling retrieval of forecasts, earthquake info, tide data, and more via natural language.
      20
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides 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
    • A
      license
      A
      quality
      D
      maintenance
      Enables to access Taiwan Central Weather Administration data, including 3-day and 1-week weather forecasts for counties/cities and historical rainfall data.
      3
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An 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.
      3
      MIT