
weather mcp sandbox
使用OpenWeatherMap API提供符合MCP协议的天气数据。
Repository Info
About This Server
使用OpenWeatherMap API提供符合MCP协议的天气数据。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Weather MCP Server
このプロジェクトは OpenWeatherMap の天気情報APIを使用し、MCP (Model Context Protocol) に準拠した形式で天気データを提供する Node.js / TypeScript 製の MCPサーバーです。
📦 必要要件
- Node.js v18以降
- npm または yarn
- OpenWeatherMap APIキー(無料で取得可能)
📁 セットアップ手順
1. リポジトリのクローンまたはZIP展開
git clone https://example.com/weather-mcp-sandbox.git
cd weather-mcp-sandbox
あるいは ZIP を展開してそのディレクトリに移動してください。
2. 依存のインストール
npm install
3. .env ファイルの作成
プロジェクトルートに .env を作成し、以下を記述します:
WEATHER_API_KEY=あなたのOpenWeatherMapのAPIキー
OpenWeatherMap APIキーの取得手順
- OpenWeatherMap にアクセス
- 無料アカウントを作成(メール認証が必要)
- ログイン後、API Keys に移動
Create keyボタンを押してAPIキーを生成- 生成されたAPIキーをコピーして
.envファイルに設定
🚀 実行方法
▶️ 開発時:ts-nodeで直接実行
npx ts-node src/index.ts
📆 本番時:ビルドして実行
npx tsc
node dist/index.js
TypeScriptで dist/index.js を生成してから実行します。
🧪 Cline/Claude でのMCP連携
1. MCPツールとして起動
node dist/index.js
2. Clineからツールを呼び出す例
cline --tool ./tool.json --stdio ./dist/index.js
※ tool.json には get_weather ツールのスキーマ定義を記述してください。
🛠 利用可能なツール
このMCPサーバーでは以下のツールが利用できます:
1. getTokyoWeather
- 機能: 東京の現在の天気情報を取得
- パラメータ: なし
- 出力: 東京の天気データ(気温、天気、湿度、風速)
2. getWeatherByCoordinates
- 機能: 指定した緯度・経度の天気情報を取得
- パラメータ:
lat(number): 緯度lon(number): 経度
- 出力: 指定地点の天気データ(都市名、気温、天気、湿度、風速)
使用例
# 東京の天気を取得
getTokyoWeather
# 札幌の天気を取得(緯度: 43.06, 経度: 141.35)
getWeatherByCoordinates(lat: 43.06, lon: 141.35)
💠 使用技術
- TypeScript
- OpenWeatherMap API
- @modelcontextprotocol/sdk
- dotenv
- axios
📄 ライセンス
MIT License
Quick Start
Clone the repository
git clone https://github.com/hfujikawa77/weather-mcp-sandboxInstall dependencies
cd weather-mcp-sandbox
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.