taiwan-weather-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@taiwan-weather-mcp台中明天天氣如何?降雨機率高嗎?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
taiwan-weather-mcp
台灣即時天氣預報、天氣特報與有感地震查詢的 MCP(Model Context Protocol)server, 讓 Claude Desktop / Claude Code 直接查中央氣象署的開放資料。
English: An MCP server for Taiwan weather — 36-hour forecasts, active weather warnings, and recent felt earthquakes — backed by Central Weather Administration (CWA) open data. Tool descriptions and responses are in Traditional Chinese. Requires a free CWA API key via the
CWA_API_KEYenvironment variable.
使用官方 mcp Python SDK 的 FastMCP
(SDK v2 起更名為 MCPServer,本專案使用穩定版 v1 系列),stdio transport。
資料來源:中央氣象署開放資料平臺。
提供的工具
工具 | 說明 | 參數 |
| 某縣市未來 36 小時天氣預報(天氣現象、降雨機率、氣溫區間、舒適度)。縣市名稱有模糊對應:「台中」→「臺中市」、「Taipei」→「臺北市」;「新竹」「嘉義」會同時回傳市與縣 |
|
| 目前生效中的天氣特報(颱風、豪雨、低溫、強風等),依特報種類彙整影響縣市;沒有特報時會明確說明 | 無 |
| 最近幾筆顯著有感地震(時間、規模、深度、震央、各縣市最大震度摘要) |
|
對應的 CWA dataset:F-C0032-001(36 小時預報)、W-C0033-001(天氣特報)、E-A0015-001(顯著有感地震報告)。
除了 tools 之外也提供其他 MCP primitive:
Resource
taiwan-weather://cities:22 個可查詢縣市的官方名稱清單。Prompt
weather_briefing(city):「查詢並播報某縣市天氣」的提示詞範本。三個工具都帶
readOnlyHintannotation(只讀公開資料、不改變任何狀態)。
Related MCP server: mcp-cwa
1. 申請 CWA API 授權碼(免費)
到 中央氣象署開放資料平臺 點右上角「登入/註冊」,註冊會員(一般 Email 即可,即時核發)。
登入後到 會員資訊 → API授權碼。
點「取得授權碼」,複製形如
CWA-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX的字串。
授權碼只透過環境變數
CWA_API_KEY讀取,不要寫進任何檔案。 本機開發可複製.env.example為.env填入(.env已被.gitignore排除)。
2. 安裝
先安裝 uv:
# Windows(PowerShell)
winget install astral-sh.uv
# WSL / Linux / macOS
curl -LsSf https://astral.sh/uv/install.sh | sh然後:
git clone https://github.com/kuotunyu/taiwan-weather-mcp.git
cd taiwan-weather-mcp
uv sync # 會自動下載 Python 3.12 與所有依賴3. 在 Claude Code 使用
最快(免 clone,只要裝好 uv):
claude mcp add taiwan-weather -e CWA_API_KEY=你的授權碼 -- uvx --from git+https://github.com/kuotunyu/taiwan-weather-mcp taiwan-weather-mcp或使用本機 clone:
# Windows(PowerShell,路徑換成你 clone 的位置)
claude mcp add taiwan-weather -e CWA_API_KEY=你的授權碼 -- uv --directory "C:\path\to\taiwan-weather-mcp" run server.py
# WSL / Linux / macOS(repo 需 clone 在該環境內)
claude mcp add taiwan-weather -e CWA_API_KEY=你的授權碼 -- uv --directory ~/taiwan-weather-mcp run server.py加好後用 claude mcp list 確認,然後在對話中直接問「台中明天天氣如何?」即可。
4. 在 Claude Desktop(Windows)使用
設定檔位置:%APPDATA%\Claude\claude_desktop_config.json
(Claude Desktop → 設定 → 開發人員 → 編輯設定檔)。
改完設定檔請從系統匣完全結束 Claude Desktop 再重開;檔案須以 UTF-8 儲存。
寫法 A:server 在 WSL 內,透過 wsl.exe 橋接
前置(在 WSL 內執行一次):
curl -LsSf https://astral.sh/uv/install.sh | sh # 安裝 uv
git clone https://github.com/kuotunyu/taiwan-weather-mcp.git ~/taiwan-weather-mcp
cd ~/taiwan-weather-mcp && uv syncrepo 請放 WSL 自己的檔案系統(如
~/),不要放/mnt/c/...,速度差很多。
{
"mcpServers": {
"taiwan-weather": {
"command": "wsl.exe",
"args": [
"-e", "bash", "-c",
"CWA_API_KEY=你的授權碼 exec $HOME/.local/bin/uv --directory $HOME/taiwan-weather-mcp run server.py"
]
}
}
}兩個常見地雷這個寫法都避開了:
Claude Desktop 的
env區塊不會自動穿透 WSL 邊界,所以金鑰用行內環境變數帶入。 若不想讓金鑰出現在 args,可改用WSLENV轉送:{ "mcpServers": { "taiwan-weather": { "command": "wsl.exe", "args": ["-e", "/home/你的WSL帳號/.local/bin/uv", "--directory", "/home/你的WSL帳號/taiwan-weather-mcp", "run", "server.py"], "env": { "CWA_API_KEY": "你的授權碼", "WSLENV": "CWA_API_KEY/u" } } } }用非登入 shell(
bash -c而非bash -lc)+ uv 絕對路徑:登入 shell 的 profile 若有任何輸出, 會污染 stdout 打斷 MCP 協定。
寫法 B:直接在 Windows 端用 Python/uv 執行
前置:Windows 裝好 uv(見上),repo clone 在 Windows 檔案系統並 uv sync。
{
"mcpServers": {
"taiwan-weather": {
"command": "C:\\Users\\你的帳號\\.local\\bin\\uv.exe",
"args": ["--directory", "C:\\path\\to\\taiwan-weather-mcp", "run", "server.py"],
"env": { "CWA_API_KEY": "你的授權碼" }
}
}
}寫法 B':Windows 端免 clone(uvx 直接從 GitHub 執行)
只要裝好 uv,不需要 clone repo(首次啟動會自動下載,之後走快取):
{
"mcpServers": {
"taiwan-weather": {
"command": "C:\\Users\\你的帳號\\.local\\bin\\uvx.exe",
"args": ["--from", "git+https://github.com/kuotunyu/taiwan-weather-mcp", "taiwan-weather-mcp"],
"env": { "CWA_API_KEY": "你的授權碼" }
}
}
}
command建議填 uv 的完整路徑(Claude Desktop 不一定繼承你的 PATH)。 在 PowerShell 執行(Get-Command uv).Source查詢實際位置 (winget 安裝的路徑會在...\WinGet\Packages\astral-sh.uv_...\uv.exe)。 JSON 內的反斜線要寫成\\。
5. 示範對話
36 小時天氣預報(「台中這兩天天氣怎樣?」)

天氣特報(「現在有什麼天氣警報嗎?」)

近期有感地震(「最近有地震嗎?」)

6. 開發
uv run pytest # 離線測試(fixtures)
uv run ruff check . && uv run ruff format . # lint / 格式化
uv run --env-file .env python scripts/explore_api.py # 實測 CWA API、重錄 fixtures
uv run --env-file .env python scripts/smoke_test.py # stdio 起 server 實呼叫三個 tool專案結構:
server.py # 薄轉接層(讓 uv run server.py 可用)
taiwan_weather/
server.py # MCP server 本體(FastMCP + 3 個 tool、console script 進入點)
api.py # CWA API 呼叫(唯一做網路 I/O 的模組)
cities.py # 縣市名稱模糊對應(純函式)
formatters.py # JSON → 精簡繁中文字(純函式)
errors.py # 錯誤類別與所有使用者訊息
scripts/explore_api.py # 實測 API、錄製 tests/fixtures
scripts/smoke_test.py # stdio 端對端煙霧測試
tests/ # pytest(unit + in-memory 整合測試)貢獻方式見 CONTRIBUTING.md,版本紀錄見 CHANGELOG.md。
資料來源與授權
氣象資料:中央氣象署開放資料平臺,依 政府資料開放授權條款 使用。
程式碼:MIT License。
安全性
授權碼只從環境變數
CWA_API_KEY讀取,程式碼與 repo 中不含任何金鑰。.env已被.gitignore排除;.env.example僅含佔位字串。
Available Tools
3 toolsget_forecastARead-only
查詢台灣某縣市未來 36 小時天氣預報。
回傳三個時段的天氣現象、降雨機率、氣溫區間與舒適度。
縣市名稱接受常見寫法,例如「台中」「臺北市」「高雄」「Taipei」;
「新竹」「嘉義」同時對應市與縣,會一次回傳兩者。
Args:
city: 縣市名稱(台灣 22 縣市,中英文皆可)。
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnly/openWorld annotations, the description discloses useful behavior: the forecast is split into three periods, the response includes specific weather fields, and ambiguous city/county names return both locations. This is meaningful operational context not available from annotations or schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Purpose is front-loaded, the return summary is compact, and the Args line adds direct parameter guidance without padding. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a single-parameter tool with an output schema and safe-read annotations, the description covers scope, input flexibility, return shape, and edge-case behavior. Nothing essential for selecting or invoking the tool is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must fully carry parameter meaning. It does: city is defined as one of Taiwan's 22 cities/counties, accepts Chinese and English common spellings, includes concrete examples, and notes the 新竹/嘉義 dual-match case.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states a specific verb (查詢) and resource (台灣某縣市未來36小時天氣預報), and lists the returned fields. This makes the tool's purpose immediately distinguishable from the warning and earthquake siblings.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Clear intended context is given: querying a Taiwan city forecast for the next 36 hours, with input-writing conventions and the dual-match behavior for 新竹/嘉義. It does not explicitly say 'use get_weather_warnings for warnings' or similar exclusions, but the sibling boundaries are obvious from names and descriptions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_recent_earthquakesARead-only
查詢最近幾筆顯著有感地震報告。
每筆包含發生時間、規模、深度、震央位置與各縣市最大震度摘要。
Args:
limit: 回傳筆數(1–10,預設 5)。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description aligns with the readOnlyHint and openWorldHint annotations by presenting a read-only query that 'includes' certain fields rather than claiming an exhaustive shape. It adds useful detail about returned content—time, magnitude, depth, epicenter, and intensity summary—and documents the limit behavior, exceeding what annotations alone convey.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well-structured: one sentence specifying the purpose, one sentence summarizing response contents, and a brief Args section for the parameter. Every line adds value, and the most important scoping information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only tool with one optional parameter and an output schema, the description covers the purpose, parameter constraints, and return value highlights. Nothing essential is missing for an agent to invoke and interpret the result correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema only lists limit with a default of 5, but the description explicitly defines its meaning (number of returned records), its valid range (1–10), and its default. This fully compensates for the 0% schema description coverage and leaves no ambiguity about how to use the parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear action and resource: '查詢最近幾筆顯著有感地震報告' (query recent notable felt earthquake reports). It is immediately distinguishable from sibling tools like get_forecast and get_weather_warnings because it is specifically about earthquakes, not weather.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The intended context is clear: use this when you need recent felt earthquake reports, with an adjustable limit. It does not explicitly name alternatives or say when not to use it, but the scoping language ('最近幾筆', '顯著有感') provides enough context for an agent to choose this tool appropriately.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_weather_warningsARead-only
查詢目前生效中的天氣特報(颱風、豪雨、大雨、低溫、強風等)。
依特報種類彙整影響縣市與有效時間;若全臺皆無生效中的警特報, 會明確回覆「目前全臺無生效中的天氣警特報」。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnlyHint and openWorldHint annotations, the description discloses key behavior: results are aggregated by warning type with affected counties and valid times, and it specifies the exact fallback message when no warnings are active nationwide. This is concrete behavioral context that helps an agent anticipate output and edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences with no filler. The primary verb and resource are front-loaded in the first sentence, and the second sentence adds behavioral detail about aggregation and the no-warning case. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given zero parameters, an output schema, and read-only annotations, the description fully covers what an agent needs: what the tool does, how results are structured, and the no-warning response. No critical operational details are missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters and the schema contains no properties, so the description carries no parameter documentation burden. The baseline for a zero-parameter tool is 4, and no additional parameter semantics are needed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb and resource: 查詢目前生效中的天氣特報 (query currently active weather advisories). It enumerates the warning types (颱風、豪雨、大雨、低溫、強風等), which distinguishes it from siblings like get_forecast and get_recent_earthquakes by topic and temporal state.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool: whenever currently active weather warnings are needed, with a defined aggregate output. It does not explicitly mention alternative tools or exclusion criteria, but the scope is unambiguous enough that an agent can decide correctly without confusion.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool covers a distinctly separate concern: forecasts, active weather warnings, and recent earthquakes. There is no overlap in purpose or return data, so an agent can select the right tool without ambiguity.
All three tools follow the same get_<noun> pattern with clear, descriptive names. The naming is consistent and predictable.
Three tools is at the lower end of a reasonable range, but each covers a meaningful aspect of Taiwan weather information. The count feels slightly minimal rather than bloated, which is appropriate for a focused weather server.
The server covers forecasts, warnings, and earthquakes, which are the most commonly requested Taiwan weather data. A minor gap is the lack of current observed weather conditions or air quality, but the existing tools cover the core domain well.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Get current weather for any city and create images from your prompts. Streamline planning, reports…
Current weather and forecasts for any coordinates, backed b… — paid per call (x402/credits), 1 tools
Real-time weather conditions and multi-day forecasts via Open-Meteo — free, no API key required
Related MCP Servers
- AlicenseAqualityCmaintenanceA lightweight Node.js server that connects Claude Desktop to Taiwan's Central Weather Administration (CWA) API, allowing users to retrieve weather forecast data for all cities and counties in Taiwan.11MIT
- 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
- AlicenseNot gradedqualityCmaintenanceEnables Claude Desktop to query real-time weather information, forecasts, and history via the OpenWeatherMap API.2199MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/kuotunyu/taiwan-weather-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server