Token导航 LogoToken导航TokenDH.com
Weather MCP App logo
地图位置未说明官方级别未说明来源级核验

Weather MCP App

MCP Server

一个基于Model Context Protocol (MCP) 的天气数据服务,提供实时天气、24小时预报、7天预报和空气质量数据,支持Claude Desktop和ChatGPT等MCP兼容客户端。

工具数

1

提示词数

0

GitHub Stars

0

资源数

0
位置天气TypeScriptClaude实时天气Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

amrahman90

提供方

amrahman90

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

天气MCP应用程序

一个模型上下文协议(MCP)服务器,具有用于获取天气数据的交互式React UI。适用于Claude Desktop、ChatGPT和任何兼容MCP的客户端。

特性

  • 当前天气 -实时温度、感觉、湿度、风速/风向
  • 逐时预报 -带天气图标的24小时预报
  • 7天预测 -每日高温/低温和条件
  • 空气质量 -美国空气质量指数、PM2.5、PM10和臭氧水平
  • 单位切换 -在摄氏度和华氏度之间切换
  • 双重运输 -支持stdio(克劳德桌面)和HTTP(ChatGPT)
  • 速率限制 -100/小时,1000/天,30000/月

安装

# Clone the repository
git clone 
cd weather-mcp-app

# Install dependencies
npm install

# Build the project
npm run build

快速开始

克劳德桌面(Stdio)

# Run with stdio transport
npm run start:stdio

ChatGPT(HTTP)

# Run HTTP server (listens on http://localhost:3001/mcp)
npm run start

# Or in development with hot reload
npm run dev

配置

克劳德桌面版

添加到您的Claude桌面设置(~/Library/Application Support/Claude/settings.json):

{
  "mcpServers": {
    "weather-mcp-app": {
      "command": "npx",
      "args": ["-y", "weather-mcp-app", "--stdio"]
    }
  }
}

或者,如果在本地运行:

{
  "mcpServers": {
    "weather-mcp-app": {
      "command": "node",
      "args": ["path/to/weather-mcp-app/dist/main.js", "--stdio"]
    }
  }
}

ChatGPT

使用HTTP端点: http://localhost:3001/mcp

用法

工具: get_weather

name: get_weather
description: Get current weather, hourly forecast, 7-day forecast, and air quality for a city name or zip code.

输入参数

参数类型必填说明
locationstring城市名称(例如“伦敦”)或邮政编码(例如“10001,美国”)
unitstring"celsius""fahrenheit" (默认值: "celsius")

示例请求

{
  "name": "get_weather",
  "arguments": {
    "location": "San Francisco, CA",
    "unit": "celsius"
  }
}

示例响应

{
  "content": [
    {
      "type": "text",
      "text": "Weather in San Francisco:\nMainly clear, 18°C\nFeels like 17°C\nHumidity: 65%\nWind: WNW 15 km/h\nAir Quality: Good (AQI: 35)\n\nHourly Forecast:\nNow: 18°C ☀️\n1PM: 19°C 🌤️\n...\n\n7-Day Forecast:\nToday: 15° - 20°, Mainly clear\nTue: 14° - 19°, Partly cloudy\n..."
    }
  ],
  "structuredContent": {
    "current": { ... },
    "hourly": [ ... ],
    "daily": [ ... ],
    "location": { ... },
    "airQuality": { ... }
  }
}

项目结构

weather-mcp-app/
├── src/
│   ├── api/
│   │   └── weather-client.ts      # Open-Meteo API client
│   ├── constants/
│   │   └── weather.ts             # Weather codes & utilities
│   ├── handlers/
│   │   └── weather-handler.ts    # MCP tool handler
│   ├── services/
│   │   └── weather-formatter.ts   # Text formatting
│   ├── types/
│   │   └── weather.ts             # Zod schemas & types
│   ├── errors/
│   │   └── index.ts              # Custom errors
│   ├── utils/
│   │   └── logger.ts             # Logging utilities
│   ├── components/ui/            # shadcn/ui components
│   ├── App.tsx                   # Main React UI
│   ├── server.ts                  # MCP server setup
│   ├── main.ts                    # Entry point
│   └── config.ts                  # Configuration
├── dist/                          # Built output
│   ├── main.js                    # Compiled server
│   └── mcp-app.html              # Compiled UI
├── package.json
├── tsconfig.json
├── vite.config.ts
└── README.md

环境变量

变量描述默认值
PORTHTTP服务器端口3001
NODE_ENV环境模式development
ALLOWED_ORIGINSCORS起源(生产)-

开发命令

# Build the project
npm run build

# Build server only
npm run build:server

# Run with stdio transport
npm run start:stdio

# Run with HTTP server
npm run start

# Development mode with watch
npm run dev

# Type checking
npm run typecheck

# Run tests
npm run test

# Run unit tests
npm run test:unit

# Run e2e tests
npm run test:e2e

API 参考

使用免费的Open-Meteo API(不需要API密钥):

  • 地理编码: https://geocoding-api.open-meteo.com/v1/search
  • 天气: https://api.open-meteo.com/v1/forecast
  • 空气质量: https://air-quality-api.open-meteo.com/v1/air-quality

安全

  • HSTS标头在生产中启用
  • CORS在开发中仅限于本地主机
  • 请求体限制:10KB
  • 使用Zod模式进行输入验证
  • 所有请求的速率限制
  • 使用Pino进行结构化日志记录

更新日志

更改日志.md 详细更改。

致谢

许可证

麻省理工学院

目录标签

目录标签

位置天气TypeScriptClaude实时天气天气数据本地部署天气预报空气质量MCP协议

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP