臺灣氣象 - 中央氣象署 MCP Server (非官方)

臺灣氣象 - 中央氣象署 MCP Server (非官方)

site icon
2025.03.27 4
TypeScript天气服务数据接口位置服务
臺灣氣象 - 中央氣象署 MCP Server (非官方) 是一个用于获取台湾中央气象署API数据的Model Context Protocol (MCP) Server。它通过标准化方式为大型语言模型 (LLMs) 提供上下文,类似于AI应用的标准接口。
View on GitHub

Overview

基本能力

产品定位

臺灣氣象 - 中央氣象署 MCP Server (非官方) 是一个用于获取台湾中央气象署API数据的MCP服务,为AI应用提供标准化的天气数据接口。

核心功能

  • 取得臺灣各縣市天氣預報資料 - 今明 36 小時天氣預報

适用场景

  • 需要获取台湾各县市天气数据的AI应用
  • 需要集成台湾气象数据的开发项目

工具列表

  1. get_taiwan_weather_forecast
  2. 功能:取得臺灣各縣市天氣預報資料 - 今明 36 小時天氣預報
  3. 输入参数:locationName (string): 臺灣縣市名稱
  4. 返回值:中央氣象署 API F-C0032-001 資料 Json (key records)

常见问题解答

  • Windows npx 問題:如果在 Windows 上使用 npx 執行 MCP Server 時無法執行,可以改用 cmd 執行 npx 或改用 node 執行。

使用教程

使用依赖

  1. 取得臺灣中央氣象署 API 授權碼:
  2. 前往 https://opendata.cwa.gov.tw/user/authkey (需登入帳號,沒有的話請註冊)
  3. 點擊 "取得授權碼" 按鈕
  4. 複製授權碼

安装教程

  1. 在 Claude Desktop 中使用,將以下內容添加到您的 claude_desktop_config.json
{
  "mcpServers": {
    "taiwan-weather": {
      "command": "npx",
      "args": [
        "-y",
        "@gonetone/mcp-server-taiwan-weather"
      ],
      "env": {
        "CWA_API_KEY": "<您的中央氣象署 API 授權碼>"
      }
    }
  }
}
  1. 如果在 Windows 上使用 npx 執行 MCP Server 時無法執行,可以改用以下其中一個方法嘗試:

  2. 使用 cmd 執行 npx:

{
  "mcpServers": {
    "taiwan-weather": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@gonetone/mcp-server-taiwan-weather"
      ],
      "env": {
        "CWA_API_KEY": "<您的中央氣象署 API 授權碼>"
      }
    }
  }
}
  • 改用 node 執行:
npm install -g @gonetone/mcp-server-taiwan-weather
{
  "mcpServers": {
    "taiwan-weather": {
      "command": "node",
      "args": [
        "<your-path>/node_modules/@gonetone/mcp-server-taiwan-weather"
      ],
      "env": {
        "CWA_API_KEY": "<您的中央氣象署 API 授權碼>"
      }
    }
  }
}

调试方式

可以使用 MCP Inspector 來測試 MCP Server:

npx -y @modelcontextprotocol/inspector -e CWA_API_KEY={您的中央氣象署 API 授權碼} node .

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。