Skip to main content
Glama
JackKuo666

Weather-MCP-Server

by JackKuo666

天気MCPサーバー

これは、国立気象局 (NWS) API を使用して天気情報を提供するモデル コンテキスト プロトコル (MCP) サーバーです。

特徴

  • 米国の州の天気予報を取得する

  • 特定の場所の天気予報を取得する(緯度と経度を使用)

Related MCP server: Weather MCP Server

要件

  • Python 3.10以上

  • ファストMCP

  • httpx

インストール

  1. このリポジトリをクローンする

  2. 仮想環境をセットアップします。

    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  3. uv を使用して必要なパッケージをインストールします。

    uv add "mcp[cli]" httpx

構成

サーバーは、次の設定を含む構成ファイルconfig.pyを使用します。

  • NWS_API_BASE : National Weather Service API のベース URL

  • USER_AGENT : NWS API へのリクエスト時に使用するユーザーエージェント文字列

  • LOG_LEVEL : ログレベル(例:「INFO」、「DEBUG」)

  • LOG_FORMAT : ログメッセージのフォーマット文字列

  • REQUEST_TIMEOUT : APIリクエストのタイムアウト(秒)

config.pyファイルでこれらの設定を変更して、サーバーの動作をカスタマイズできます。

使用法

サーバーをスタンドアロンで実行する

サーバーをスタンドアロンで実行するには:

  1. まだアクティブ化されていない場合は、仮想環境をアクティブ化します。

    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
  2. サーバーを実行します。

    python weather.py

Clineと併用

Weather MCP ServerがClineの設定に追加されました。Cline内で使用するには、以下の手順に従ってください。

  1. Cline が適切にセットアップされ、実行されていることを確認します。

  2. Weather MCP Server は、「weather」という名前のツールとして利用できるようになります。

  3. 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 ライセンスの下で利用可能です。

F
license - not found
Not graded
quality - not tested
D
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 Servers

  • A
    license
    B
    quality
    D
    maintenance
    A 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.
    2
    76
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI models to fetch weather alerts and detailed forecasts for US locations using the National Weather Service API.
    76
    GPL 3.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides 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.
    76
    GPL 3.0

View all related MCP servers

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)

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/JackKuo666/Weather-MCP-Server'

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