weather-mcp-server-py
天気予報 MCP サービス(Python版)🌤
公式 mcp Python SDK(FastMCP)で実装した天気予報 MCP サービスです。 stdio を介してあらゆる MCP クライアント(Claude Desktop、WorkBuddy など)と通信し、AI アシスタントが指定した都市の現在の天気をリアルタイムに照会できます。
💡 天気データは Open-Meteo から取得します。登録不要、API キー不要です。
✨ 機能特徴
⚡ 純粋な stdio 通信:プラグアンドプレイで、ポートの開放や HTTP サーバーは不要です。
🌍 多言語の都市名:中国語と英語の都市名に対応(
北京、Beijing、Tokyoなど)。🔒 キー不要:データは Open-Meteo から取得し、個人データを収集せず、リクエスト本文も送信しません。
🛡 堅牢なエラーハンドリング:都市が存在しない場合やネットワーク異常時も、クラッシュせずに親切な中国語のメッセージを返します。
🎨 親しみやすい戻り値形式:構造化テキスト+絵文字で、クライアントでそのまま表示できます。
Related MCP server: Weather MCP Tool
🛠 提供ツール
ツール名 | 引数 | 説明 |
|
| その都市の現在の天気を返します:天気 / 気温 / 体感温度 / 湿度 / 風速 / 観測時刻 |
戻り値の例
📍 北京(中国)当前天气
🌤 天气:晴
🌡 温度:27.3°C(体感 28.1°C)
💧 湿度:52%
🍃 风速:12.4 km/h
🕒 观测时间:2026-08-19T13:00📋 環境要件
Python >= 3.10(推奨 3.13、ローカルで検証済み)
外部ネットワークへのアクセスが必要です(Open-Meteo API を呼び出します)
🚀 インストールと実行
git clone https://github.com/<your-name>/weather-mcp-server-py.git
cd weather-mcp-server-py
# 创建虚拟环境(可选但推荐)
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 运行(stdio 模式,通常由 MCP 客户端拉起)
python weather_server.py本サービスは標準入出力(stdio)でクライアントと通信します。
python weather_server.pyはデフォルトで stdio モードで起動します。
🔌 MCP クライアントでの接続
Claude Desktop / WorkBuddy の claude_desktop_config.json / mcp.json を例に、以下の設定を追加します
(python3 はお使いのマシンのインタープリタの絶対パスに置き換えてください。Windows の場合は python.exe を使用します):
{
"mcpServers": {
"weather": {
"command": "python3",
"args": ["/absolute/path/to/weather_server.py"]
}
}
}保存してクライアントを再起動すると、会話で「北京の天気を調べて」とリクエストでき、モデルが自動的に get_weather ツールを呼び出します。
📁 プロジェクト構成
weather-mcp-server-py/
├── weather_server.py # MCP 服务主实现(FastMCP)
├── requirements.txt # 依赖清单
└── README.md # 本说明🧰 技術ポイント
都市 → 緯度経度:Open-Meteo ジオコーディング API を使用;
現在の天気:Open-Meteo Forecast API を使用し、
currentフィールドで気温 / 体感 / 湿度 / 風速 / 天気コードを一度に取得;天気コード → 中国語の説明:WMO 天気コードのマッピングテーブルを内蔵;
実行時にネットワークが利用できない場合や都市が見つからない場合は、親しみやすい中国語のエラーメッセージを返し、ツールが常に文字列を返すことを保証します。
🤝 コントリビューション
Issue と Pull Request を歓迎します。天気指標の追加、クライアント例の拡充、テストの追加など、お気軽にご連絡ください。
📄 ライセンス
MIT © 2026 weather-mcp-server-py contributors
This server cannot be deployed
Maintenance
Related MCP Connectors
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
Weather MCP — wraps Open-Meteo API (free, no auth)
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to retrieve live weather updates for any city via OpenWeatherMap, wrapped in MCP format.1-
- FlicenseBqualityDmaintenanceProvides real-time weather information for cities worldwide using the OpenWeatherMap API, accessible through natural language queries via the MCP protocol.1-
- FlicenseNot gradedqualityCmaintenanceEnables AI applications and MCP clients to look up real-time weather data for any specified city through a callable tool.-
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to retrieve current weather conditions and 3-day forecasts for cities through standardized MCP tools over stdio.-