weather-mcp

weather-mcp
OpenWeatherMapをバックエンドとする天気ツールを公開するTypeScript製MCPサーバーです。
ツール
ツール | 説明 |
| 都市名または緯度/経度による現在の天気 |
| 緯度/経度による5日間/3時間ごとの予報 |
トランスポート
モード | 環境変数 | 使用場面 |
|
| ローカルのCursor / Claude Desktop |
Streamable HTTP |
| デプロイ(Renderなど)/ リモートURL |
公式MCPドキュメント:https://modelcontextprotocol.io/docs/
ライブリモート(Render)
Renderの無料枠にデプロイされています:
ベースURL | |
MCPエンドポイント | |
ヘルスチェック |
Cursor設定(リモート)
これを設定 → MCPまたは~/.cursor/mcp.jsonに追加してください:
{
"mcpServers": {
"weather": {
"url": "https://weather-mcp-ts.onrender.com/mcp"
}
}
}CursorでのローカルビルドやAPIキーは不要です。キーはRenderの環境変数にあります。
Renderの無料枠: サービスは非アクティブ状態が約15分続くとシャットダウンします。次のリクエストはコールドスタートとなり、MCPが応答するまで最大約50秒かかることがあります。Cursorツールが起動中に固まっているように見える場合は、
/healthに一度アクセスしてください。
Related MCP server: mcp-weatherapi
前提条件(ローカルのみ)
Node.js 20+
pnpm(またはnpm/yarn)
OpenWeatherMap APIキー(こちらから取得)
セットアップ(ローカル)
pnpm install
cp .env.example .env.envを編集してキーを設定してください:
OPEN_WEATHER_MAP_API_KEY=your_key_here
TRANSPORT=stdioサーバーをビルドします:
pnpm run buildこれにより、実行可能なエントリーポイントがdist/index.jsに書き込まれます。
Cursorへの追加(ローカルstdio)
Cursorはデフォルトではプロジェクトルートからこのプロセスを起動しないため、envファイルが読み込まれません。Node.jsの--env-fileフラグを使用してenvファイルを絶対パスで指定してください。
Cursorの設定 → MCPを開くか、
~/.cursor/mcp.jsonを編集します。mcpServersの下にweatherエントリを追加します:
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"--env-file",
"/ABSOLUTE/PATH/TO/weather-mcp/.env",
"/ABSOLUTE/PATH/TO/weather-mcp/dist/index.js"
]
}
}
}/ABSOLUTE/PATH/TO/weather-mcpを実際のプロジェクトパスに置き換えてください(例:リポジトリのルートでpwdを実行)。.envではTRANSPORT=stdioのまま(または未設定のまま)にしてください。
別の方法:envのインライン指定
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"/ABSOLUTE/PATH/TO/weather-mcp/dist/index.js"
],
"env": {
"OPEN_WEATHER_MAP_API_KEY": "your_key_here",
"TRANSPORT": "stdio"
}
}
}
}キーがmcp.jsonに含まれないようにするため、.env + --env-fileの使用を推奨します。
保存してから、設定 → MCPでサーバーをオフ/オンに切り替えてください(またはCursorを再起動)。
サーバーが接続済みと表示され、
get_current_weatherとget_forecastが一覧に表示されることを確認してください。
コード変更後
pnpm run buildその後、CursorでMCPサーバーをリロードしてください。
Streamable HTTP(ローカル)
HTTPモードでは、MCPをPOST/GET /mcp(設定可能)で提供し、さらにGET /healthも提供します。Streamable HTTPは公式SDKのcreateMcpHandler + toNodeHandlerを介して設定されます。
pnpm run build
TRANSPORT=http PORT=3000 pnpm run start
# or
pnpm run start:http次のような表示が確認できるはずです:
Weather MCP Server running on http://0.0.0.0:3000/mcp (Streamable HTTP)Renderへのデプロイ
このリポジトリ(プロジェクトのルート)からWeb Serviceを作成します。
ビルド:
pnpm install && pnpm run build(またはnpm相当のコマンド)起動:
node dist/index.js(またはpnpm run start)環境変数:
TRANSPORT=httpOPEN_WEATHER_MAP_API_KEY=...PORTはRenderが自動的に設定します
MCP URL:
https://<your-service>.onrender.com/mcp
このデプロイ:https://weather-mcp-ts.onrender.com/mcp
HTTPエンドポイントは認証なしです。URLを知っている人は誰でもツールを呼び出せます。広く共有する前に認証を追加してください。
手動スモークテスト(OpenWeatherMap)
.envが設定されていれば:
node --env-file=.env -e "
import { getApiKey, buildCurrentWeatherUrl, makeOWMRequest, formatCurrentWeather } from './dist/utils.js';
const apiKey = getApiKey();
const data = await makeOWMRequest(buildCurrentWeatherUrl({ apiKey, city: 'Yaounde,CM', units: 'metric' }));
console.log(data ? formatCurrentWeather(data, 'metric') : 'failed');
"リモートのヘルスチェック:
curl -s https://weather-mcp-ts.onrender.com/healthリポジトリ構成
weather-mcp/
├── README.md
├── package.json
├── tsconfig.json
├── .env.example
└── src/
├── index.ts # stdio + Streamable HTTP entry
├── server.ts # tool registration
├── types.ts
└── utils.ts注意事項
.envは絶対にコミットしないでください(gitignoreされています)。StdioサーバーはMCP JSON-RPC以外をstdoutに書き出してはいけません。ログはstderr(
console.error)に出力します。OpenWeatherMapの無料プランには、ここで使用している現在の天気と5日間/3時間ごとの予報が含まれています。
ライセンス
ISC
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
- AlicenseNot gradedqualityCmaintenanceWraps the OpenWeatherMap API to provide weather data through MCP, enabling AI agents to query current conditions, forecasts, and other weather information via natural language.10MIT
- AlicenseNot gradedqualityCmaintenanceProvides weather data from WeatherAPI.com through MCP, enabling AI agents to query current conditions and forecasts via natural language.11MIT
- FlicenseNot gradedqualityDmaintenanceEnables MCP clients like Kiro and Claude to access current weather conditions and forecasts for any location using the OpenWeatherMap API.
- AlicenseNot gradedqualityDmaintenanceIntegrates OpenWeatherMap API with MCP to provide weather data, forecasts, air quality, maps, alerts, and geocoding via natural language.10MIT
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
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/RashJrEdmund/Weather-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server