Skip to main content
Glama
yuxiaosenstar

weather-mcp-server-py

天気予報 MCP サービス(Python版)🌤

公式 mcp Python SDK(FastMCP)で実装した天気予報 MCP サービスです。 stdio を介してあらゆる MCP クライアント(Claude Desktop、WorkBuddy など)と通信し、AI アシスタントが指定した都市の現在の天気をリアルタイムに照会できます。

💡 天気データは Open-Meteo から取得します。登録不要、API キー不要です。

✨ 機能特徴

  • 純粋な stdio 通信:プラグアンドプレイで、ポートの開放や HTTP サーバーは不要です。

  • 🌍 多言語の都市名:中国語と英語の都市名に対応(北京BeijingTokyo など)。

  • 🔒 キー不要:データは Open-Meteo から取得し、個人データを収集せず、リクエスト本文も送信しません。

  • 🛡 堅牢なエラーハンドリング:都市が存在しない場合やネットワーク異常時も、クラッシュせずに親切な中国語のメッセージを返します。

  • 🎨 親しみやすい戻り値形式:構造化テキスト+絵文字で、クライアントでそのまま表示できます。

🛠 提供ツール

ツール名

引数

説明

get_weather

city(都市名、中英対応)

その都市の現在の天気を返します:天気 / 気温 / 体感温度 / 湿度 / 風速 / 観測時刻

戻り値の例

📍 北京(中国)当前天气
🌤  天气:晴
🌡  温度: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

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)

  • WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)

  • Visual Crossing Weather MCP — wraps the Visual Crossing Weather Timeline API

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yuxiaosenstar/weather-mcp-server-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server