MCP Weather Server
Provides real-time weather information and forecasts using the OpenWeatherMap API.
MCP Weather Server
這是一個基於Model Context Protocol (MCP)的天氣資訊服務器,使用OpenWeatherMap API提供即時天氣資訊和天氣預報功能。
功能特點
- 獲取城市當前天氣資訊
- 獲取城市5天天氣預報
- 支持中英文城市名稱查詢
- 完整的錯誤處理機制
- 豐富的天氣資訊顯示(溫度、濕度、風速等)
系統要求
- Python >= 3.10
- OpenWeatherMap API金鑰
安裝
- 確保您已安裝 Python 3.10 或更高版本
- 使用以下命令安裝依賴套件:
uv venv
uv pip install -r requirements.txt
配置
在 mcp.json 中配置您的OpenWeatherMap API金鑰:
{
"mcpServers": {
"weather": {
"command": "uv",
"args": ["--directory", ".", "run", "main.py"],
"description": "天氣資訊伺服器 - 取得當前天氣和天氣預報",
"env": {
"OPENWEATHER_API_KEY": "your_api_key_here"
}
}
}
}
使用方法
作為MCP服務器運行
python main.py
使用客戶端
python client.py
API參考
獲取當前天氣
get_current_weather(city: str) -> str
- 參數:
- city: 城市名稱(支持中英文)
- 返回:格式化的當前天氣資訊
獲取天氣預報
get_weather_forecast(city: str, days: int = 5) -> str
- 參數:
- city: 城市名稱(支持中英文)
- days: 預報天數(1-5天,預設5天)
- 返回:格式化的天氣預報資訊
資源端點
weather://current/{city}- 獲取指定城市的當前天氣資源weather://forecast/{city}- 獲取指定城市的天氣預報資源weather://api-status- 獲取API狀態資訊
授權
MIT License
貢獻
歡迎提交問題和拉取請求!
致謝
- OpenWeatherMap - 天氣數據提供
- Model Context Protocol - MCP協議支持
部署
關於部署的詳細信息,請參考 部署指南。
支持的部署方式:
- 直接部署(Python 環境)
- Docker 部署
- Docker Compose 部署
- 系統服務部署(Linux)
Related Servers
CryptoMinute
AI-powered crypto news intelligence MCP server with 8 tools: news search, narrative analytics, AI-clustered stories, Reddit sentiment, YouTube engagement, historical prices, token metadata, and Telegram flash posts.
CYAN ARROW Trading System
A high-performance trading system for Claude Desktop, providing real-time market data via Tiingo and optional Telegram alerts.
Crypto Fear & Greed Index
Provides real-time and historical Crypto Fear & Greed Index data from the Alternative.me API.
Atris MCP for Audius
Access the Audius music platform via LLMs, with 105 tools covering most of the Audius Protocol API.
SO-ARM100 Robot Control with MCP
Control SO-ARM100 and LeKiwi robot arms using LLM-based AI agents.
Pokemon MCP
An MCP server for Pokemon-related functionality.
CHeema-Text-to-Voice-MCP-Server
AI-powered text-to-speech MCP server with instant voice cloning. Generate speech from Claude Desktop, Claude Code, or n8n using 5 built-in voices (English, German, French, Spanish) or clone any voice from a short audio sample. Runs fully local, no API keys, no cloud. Supports stdio, SSE, and HTTP transports.
Scholar Sidekick MCP
Resolve, format, and export academic citations from any AI assistant
Control4 MCP Server
A safe-by-default MCP server that exposes your Control4 home automation (lights, scenes, locks, thermostats, and media) as structured tools over HTTP and Claude Desktop STDIO for reliable AI-powered control on your local network.
YouTube Playlist Generator MCP Server
A Model Context Protocol (MCP) server that enables AI applications to search for YouTube music videos and manage playlists using the official YouTube Data API v3.