Weather-MCP-Server
天気MCPサーバー
これは、国立気象局 (NWS) API を使用して天気情報を提供するモデル コンテキスト プロトコル (MCP) サーバーです。
特徴
米国の州の天気予報を取得する
特定の場所の天気予報を取得する(緯度と経度を使用)
Related MCP server: Weather MCP Server
要件
Python 3.10以上
ファストMCP
httpx
インストール
このリポジトリをクローンする
仮想環境をセットアップします。
python -m venv .venv source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`uv を使用して必要なパッケージをインストールします。
uv add "mcp[cli]" httpx
構成
サーバーは、次の設定を含む構成ファイルconfig.pyを使用します。
NWS_API_BASE: National Weather Service API のベース URLUSER_AGENT: NWS API へのリクエスト時に使用するユーザーエージェント文字列LOG_LEVEL: ログレベル(例:「INFO」、「DEBUG」)LOG_FORMAT: ログメッセージのフォーマット文字列REQUEST_TIMEOUT: APIリクエストのタイムアウト(秒)
config.pyファイルでこれらの設定を変更して、サーバーの動作をカスタマイズできます。
使用法
サーバーをスタンドアロンで実行する
サーバーをスタンドアロンで実行するには:
まだアクティブ化されていない場合は、仮想環境をアクティブ化します。
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`サーバーを実行します。
python weather.py
Clineと併用
Weather MCP ServerがClineの設定に追加されました。Cline内で使用するには、以下の手順に従ってください。
Cline が適切にセットアップされ、実行されていることを確認します。
Weather MCP Server は、「weather」という名前のツールとして利用できるようになります。
Cline 内では次のツールを使用できます。
a.
get_alerts(state: str): 米国の州の天気予報を取得します(2文字の州コードを使用します。例:カリフォルニア州の場合は「CA」) b.get_forecast(latitude: float, longitude: float): 特定の場所の天気予報を取得します
Cline での使用例:
# Get alerts for California
result = await mcp.call_tool("weather.get_alerts", state="CA")
print(result)
# Get forecast for San Francisco (approximate coordinates)
result = await mcp.call_tool("weather.get_forecast", latitude=37.7749, longitude=-122.4194)
print(result)注: MCPツールを呼び出すための正確な構文は、Clineの設定によって異なる場合があります。最新の使用方法については、Clineのドキュメントを参照してください。
エラー処理とログ記録
このサーバーでは、APIリクエストとログ記録のエラー処理が改善されています。リクエスト中にエラーが発生した場合、サーバーはエラーをログに記録し、適切なエラーメッセージを返します。ログは、設定されたログレベルと形式でコンソールに出力されます。
テスト
ユニットテスト
ユニット テストを実行するには:
python -m unittest test_weather.pyこれらのテストでは、 get_alertsおよびget_forecastツールの基本機能をカバーします。
手動テスト
サーバーを手動でテストするには、MCPクライアントを使用して提供されているツールを呼び出すことができます。以下にコマンドの例を示します。
# Get alerts for California
result = await mcp.call_tool("get_alerts", state="CA")
print(result)
# Get forecast for San Francisco (approximate coordinates)
result = await mcp.call_tool("get_forecast", latitude=37.7749, longitude=-122.4194)
print(result)貢献
貢献を歓迎します!お気軽にプルリクエストを送信してください。
ライセンス
このプロジェクトはオープンソースであり、 MIT ライセンスの下で利用可能です。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides tools to fetch weather alerts for US states and forecasts based on latitude/longitude coordinates using the US National Weather Service API.2761MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI models to fetch weather alerts and detailed forecasts for US locations using the National Weather Service API.76GPL 3.0
- AlicenseNot gradedqualityDmaintenanceProvides weather forecasts and active alerts for US locations using the National Weather Service API. It supports both local stdio and remote HTTP/SSE transport modes for flexible integration with MCP clients.76GPL 3.0
- FlicenseBqualityDmaintenanceA Model Context Protocol (MCP) server that provides US weather forecasts and active alerts using the National Weather Service API.2
Related MCP Connectors
NOAA and ECMWF weather forecast MCP for discovery, validation, and GribStream OAuth queries.
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/JackKuo666/Weather-MCP-Server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server