Weather MCP Server
Enables real-time weather queries for cities worldwide using Open-Meteo API. Provides 7-day forecasts with detailed information including temperature, wind, humidity, precipitation, and comfort level assessments in both Chinese and English.
README
Weather MCP Server
基于 Open-Meteo API 的 MCP (Model Context Protocol) 天气服务器,为 LLM 大模型提供实时天气查询功能。
功能特性
- 支持中英文城市名称查询
- 自动地理编码(城市名→坐标)
- 获取7天天气预报
- 详细的天气信息包括:
- 温度: 最高/最低温度、体感温度
- 风力: 风速、阵风、风向
- 舒适度: 基于温度和湿度的舒适度评估
- 天气状况: 晴、雨、雪等详细描述
- 降水信息: 降水量、降雨量、降雪量
- 其他: 日出日落时间、湿度等
安装
npm install
使用方法
1. 配置 MCP 客户端
在 Claude Desktop 或其他 MCP 客户端的配置文件中添加:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"weather": {
"command": "node",
"args": ["/Users/wanli/.config/mcp/weather-mcp-metro/index.js"]
}
}
}
2. 启动服务器
npm start
3. 在 LLM 中使用
服务器提供了一个工具 get_weather,可以通过以下方式调用:
请帮我查询北京的天气
或
What's the weather like in Shanghai?
API 说明
get_weather
获取指定城市的天气预报信息。
参数:
city(string, 必需): 城市名称,支持中英文
返回示例:
{
"城市信息": {
"名称": "Beijing",
"国家": "China",
"坐标": "39.9075, 116.39723",
"时区": "Asia/Shanghai"
},
"当前天气": {
"时间": "2025-10-17T10:00",
"温度": "18°C",
"体感温度": "16°C",
"湿度": "65%",
"天气状况": "部分多云",
"风速": "12 km/h",
"风向": "东北",
"舒适度": "舒适"
},
"七天预报": [
{
"日期": "2025-10-17",
"最高温度": "22°C",
"最低温度": "14°C",
"天气状况": "部分多云",
"降水量": "0mm",
"降雨量": "0mm",
"降雪量": "0cm",
"最大风速": "15 km/h",
"最大阵风": "25 km/h",
"主导风向": "东",
"日出": "2025-10-17T06:30",
"日落": "2025-10-17T18:15",
"舒适度": "舒适"
}
// ... 其余6天
]
}
技术细节
数据来源
- 地理编码 API:
https://geocoding-api.open-meteo.com/v1/search - 天气数据 API:
https://api.open-meteo.com/v1/forecast
天气参数
temperature_2m_max/min: 最高/最低温度weathercode: 天气代码(自动转换为中文描述)precipitation_sum: 总降水量rain_sum: 降雨量snowfall_sum: 降雪量windspeed_10m_max: 最大风速windgusts_10m_max: 最大阵风winddirection_10m_dominant: 主导风向sunrise/sunset: 日出日落时间relative_humidity_2m: 相对湿度apparent_temperature: 体感温度
舒适度评级
基于体感温度和湿度计算:
- 非常寒冷 (< 0°C)
- 寒冷 (0-10°C)
- 凉爽 (10-16°C)
- 舒适 (16-24°C)
- 温暖 (24-28°C)
- 炎热 (28-32°C)
- 酷热 (> 32°C)
同时考虑湿度影响(高湿度/干燥提示)
依赖项
@modelcontextprotocol/sdk: MCP SDK
许可证
MIT
注意事项
- Open-Meteo API 是免费开源的,无需 API 密钥
- 数据更新频率取决于 Open-Meteo 服务
- 建议合理使用,避免过于频繁的请求
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.