weather-mcp-server-js
🌤️ Weather MCP Server (Node.js)
Node.js / Express ベースのリモート MCP (Model Context Protocol) サーバーです。
Streamable HTTP transport を介して get_weather ツールを公開し、Claude Code などの MCP クライアントが任意の都市の現在の天気をリアルタイムに取得できるようにします。
天気データは wttr.in から取得します —— 無料、登録不要、API キー不要です。
✨ 機能特性
🛰️ リモート MCP サービス:公式
@modelcontextprotocol/sdkに基づく Streamable HTTP トランスポートを実装し、JSON と SSE の2つのレスポンスモードをサポート🌆 世界中の都市に対応:都市名(例:
Beijing、Tokyo、Paris)を直接渡すだけで現地の天気を取得できます🔌 完全なセッション管理:
Mcp-Session-Idを自動生成/検証し、セッションの確立、再利用、クローズ(DELETE)をサポート🧩 単一ファイルですぐ使える:データベース不要、設定ファイル不要、
server.js1つで起動できます
Related MCP server: MCP Weather Server — Demo
📦 環境要件
Node.js ≥ 18(
fetch内蔵、追加依存不要)
🚀 クイックスタート
# 1. 安装依赖
npm install
# 2. 启动服务(默认端口 3000)
npm start
# 后台运行(日志写入 logs/server.log)
npm run start:bg起動に成功すると、サービスアドレスは次のようになります:
http://localhost:3000/mcpよく使うスクリプト
命令 | 説明 |
| フォアグラウンドでサービスを起動 |
| バックグラウンドで起動し、ログを |
| 開発モード。ファイル変更で自動再起動 |
| 3000 番ポートでサービスが稼働しているか確認 |
| ログをリアルタイムで表示 |
| サービスを停止 |
| サービスを再起動 |
| バックグラウンドで再起動 |
🔌 MCP クライアントの設定
Claude Code または Streamable HTTP をサポートする他の MCP クライアントで、サービスをリモート MCP サーバーとして登録します。
Claude Code
MCP サーバーリストから追加します(/mcp → 追加 → HTTP):
{
"type": "http",
"url": "http://localhost:3000/mcp"
}JSON 設定ファイル方式
{
"mcpServers": {
"weather": {
"type": "http",
"url": "http://localhost:3000/mcp"
}
}
}🧰 提供されるツール
get_weather
指定された都市の現在の天気を取得します。
パラメータ
パラメータ | 型 | 必須 | 説明 |
| string | ✅ | 都市名。例: |
戻り値の例
当前 Beijing 的天气是晴(Sunny),温度 28°C(体感 30°C),湿度 45%,风速 12 km/h。⚙️ 実装の説明
セッション分離:各セッションは独立した
Server+transportインスタンスを保持します(SDK のconnect()は1つの transport のみサポート)。Mcp-Session-Idリクエストヘッダーで関連付けます。新規セッションフロー:
Mcp-Session-Idを含まない POST は初期化リクエストと見なされ、サーバーはセッション ID を生成してMcp-Session-Idレスポンスヘッダーで返します(CORS のexposedHeadersによりブラウザクライアントに明示的に公開されます)。互換性処理:セッション ID のない GET SSE プローブリクエストは、404/400 を返す代わりに開いた SSE ストリームを維持し、Claude Code などのクライアントが POST 初期化フローを続行できるようにします。
信頼性の高いエラー応答:天気 API の呼び出しに失敗した場合、リクエスト全体をクラッシュさせるのではなく、
isError: trueの結果を返します。
🗂️ プロジェクト構造
.
├── server.js # 全部服务逻辑(单文件)
├── package.json # 项目配置与脚本
├── logs/ # 运行时日志(已被 .gitignore 忽略)
└── LICENSE # 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
- FlicenseBqualityDmaintenanceA simple MCP server that provides a tool to fetch current weather information for cities using the Open-Meteo API, communicating through stdin/stdout.12
- Alicense-qualityDmaintenanceDemo MCP server that provides weather data for cities, with tools to get weather and list available cities.MIT
- AlicenseAqualityBmaintenanceMCP server that provides current weather for any city using Open-Meteo APIs. It exposes a single tool 'get_weather' returning temperature, humidity, wind, and other weather data.113MIT
- AlicenseAqualityBmaintenanceA simple MCP server that exposes a get_weather tool to fetch real-time weather for any GPS coordinates using the Open-Meteo API, no API key required.114ISC
Related MCP Connectors
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Remote ChromaDB vector database MCP server with streamable HTTP transport
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/yuxiaosenstar/weather-mcp-server-js'
If you have feedback or need assistance with the MCP directory API, please join our Discord server