weather
mcp-weather-ts
TypeScript MCP サーバーで、National Weather Service API の米国気象情報を Cursor などのホストに公開します。
ホストは node build/index.js を起動し、stdio を介して JSON-RPC で通信します。モデルは NWS 自体を呼び出すのではなく、このサーバーのツールを呼び出します(リソースを読み取ったり、プロンプトを使用したりすることもできます)。
MCP の仕組み(ツール、リソース、プロンプト、トランスポート): docs/create-mcp.readme.md。
要件
Node.js 22+ (このリポジトリは ESM と
fetchを使用)npm
https://api.weather.govへのネットワークアクセス(米国内のみ)
Related MCP server: weather
セットアップ
npm install
npm run buildtsc は JavaScript を build/ に書き出します。Cursor は ビルド済み ファイルを実行する必要があり、src/index.ts ではありません。
スクリプト
コマンド | 説明 |
|
|
| NWS をスモークテスト: |
Cursor でのマウント
ビルド(
npm run build)。このプロジェクトに
.cursor/mcp.jsonを追加:
{
"mcpServers": {
"weather": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/build/index.js"]
}
}
}すべての Cursor プロジェクトでは、%USERPROFILE%\.cursor\mcp.json を使用し、${workspaceFolder} の代わりに build\index.js への絶対パスを指定します。
Customize → MCP(または Cursor Settings → MCP)を開き、weather を有効にします。
src/を変更したら、npm run buildをもう一度実行し、サーバーをオフ/オンに切り替えて Cursor にプロセスを再起動させます。
サーバー接続後は console.log を使用しないでください。stdout は MCP の通信路です。ログには console.error を使用してください。
呼び出せるもの
ツール
モデル(または Agent チャットで依頼したあなた)は、tools/call でこれらを呼び出します。
名前 | 入力 | 説明 |
|
| その州のアクティブな警報 |
|
| 12時間予報 (NWS |
|
| 練習: |
チャット例:
「CA の天気警報はありますか?」
「39.7456, -97.0892 の予報」
引数例:
{ "state": "CA" }{ "latitude": 39.7456, "longitude": -97.0892 }リソース
名前 | URI | 説明 |
|
| ツールと NWS 参照フローに関する短い静的メモ |
エージェントに weather://nws-guide を読むよう依頼するか、クライアントで resources/read を使用してください。
プロンプト
名前 | 引数 | 説明 |
|
|
|
Cursor では、Check weather プロンプトを選択し、place に入力します。
プロジェクト構成
src/index.ts Create McpServer, register, connect stdio
src/tools.ts get_alerts, get_forecast, test_tool
src/resources.ts weather://nws-guide
src/prompts.ts check_weather
src/weather-api-call.ts NWS fetch + types + alert formatting
src/createTransport.ts StdioServerTransport + connect
tests/weather-api-call.test.ts
docs/create-mcp.readme.md How to design MCP serverssrc/index.ts の起動順序:
new McpServer({ name: "weather", version: "1.0.0" })registerWeatherTools/registerWeatherResources/registerWeatherPromptsconnectStdioTransport(server)
NWS のメモ
予報は
/points/{lat},{lon}/forecastには ありません。/points/{lat},{lon}(小数第4位まで)を読み込み、その後properties.forecastまたはproperties.forecastHourlyを参照してください。NWS は
User-Agentヘッダーを要求します(weather-api-call.tsで設定)。対象は米国(および一部の準州)です。それ以外の座標は多くの場合失敗します。
トラブルシューティング
症状 | 対処法 |
サーバーが赤 / ツールがない | 再ビルドし、 |
ハンドシェイクが失敗する |
|
予報が空または失敗する | 米国の緯度/経度のみ; MCP ログを確認 |
| ネットワーク / NWS の障害 |
Cursor: Output → MCP Logs。
ライセンス
ISC
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes tools for retrieving weather forecasts and alerts using the National Weather Service API.
- FlicenseCqualityCmaintenanceExposes US weather data as MCP tools, resources, and prompts via the National Weather Service API, enabling clients like Claude Desktop to get alerts, forecasts, and weather briefings.21
- FlicenseNot gradedqualityCmaintenanceThis MCP server provides tools to get current weather, forecasts, and weather alerts from the US National Weather Service via REST APIs, enabling AI agents to query live weather data.1
- FlicenseNot gradedqualityCmaintenanceEnables natural-language weather queries for U.S. states and coordinates, returning real-time alerts and forecasts from the National Weather Service API via MCP tools.
Related MCP Connectors
US weather, alerts, earthquakes and elevation for AI agents, from NWS/NOAA and USGS. No API keys.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Get US weather forecasts, active alerts, and current observations.
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/kingshuknandy2016/weather-mcp-ts'
If you have feedback or need assistance with the MCP directory API, please join our Discord server