Weather MCP
A weather server providing weather information for locations within the United States.
MCPサーバーを作ってみよう
参考資料
2025/6/13やったこと
- 記事通りに構築
- 一旦記事通り構築できたはす記述しているsrcのモジュールがうまく読み込めていないので、また確認
2025/6/28 エラー解消と解決方法
🔍 発生した問題
- 不要なコードとインポート:
src/index.tsに記事にない追加のコードが混入 - Node.jsバージョン: v14では動作せず、v20が必要
- CursorのMCP設定: Node.jsの正確なパスが必要
- 不要な依存関係: 記事で使用されていない
axiosがpackage.jsonに含まれている
✅ 解決方法
1. src/index.tsの修正
- 不要なインポート
import { getWeather } from './weather.js';を削除 - 記事にない
get-city-weatherツールを削除 - メイン関数を記事通りのMCPサーバー起動処理に修正
2. Node.jsバージョン変更
nvm use 20
nvm alias default 20
3. package.json修正
- 不要な依存関係
axiosを削除 - 記事通りの構成に統一
4. 不要ファイル削除
- 使用されていない
src/weather.tsを削除
5. CursorのMCP設定
{
"mcpServers": {
"weather": {
"command": "/Users/r273-2576/.nvm/versions/node/v20.18.0/bin/node",
"args": ["/Users/r273-2576/Documents/AI-mokumoku/weather-mcp/build/index.js"]
}
}
}
🎯 動作確認
- MCPサーバーのビルド成功 (
npm run build) - CursorでMCP設定が緑色のインジケーター表示
- 「サンフランシスコの天気を教えて」で正常に天気情報取得可能
📝 注意点
- NWS APIはアメリカ国内の天気情報のみ対応
- 東京などの海外都市は非対応
- Cursor設定変更後は必ず完全再起動が必要
Weather MCP Server構築
-
どんなものを作ったか
- アメリア国内の天気情報を取得できる
-
検証結果
-
記事通りにはいかなかった点
- Nodeのバージョン
- 案件の影響でv14を使用していた。実行するバージョンがv20系からになっており、nvmでv20系を設定していてもチャットで実行してもらうときには、グローバルのパスがv14系になっていたので実行できなかった。
- Nodeのバージョン
Похожие серверы
中指房产估值MCP
MCP服务器,提供房产小区评级和评估功能
CoolPC MCP Server
Query computer component prices from Taiwan's CoolPC website to generate AI-assisted price quotes.
Google Web Search (Gemini)
Provides Google Web Search functionality using the Gemini API. Requires a Google API Key or OAuth credentials.
WikiJS
Search and retrieve content from a WikiJS knowledge base.
ArtistLens
Access the Spotify Web API to search and retrieve information about tracks, albums, artists, and playlists.
Scholarly
Search for academic articles using scholarly vendors.
Research Task
An AI-powered research assistant that can investigate any topic using an interactive configuration wizard.
Medical Research MCP Suite
An AI-powered API for medical research, unifying ClinicalTrials.gov, PubMed, and FDA databases with intelligent analysis.
SearXNG
A privacy-respecting metasearch engine powered by a self-hosted SearXNG instance.
Pollinations Think
Strategic thinking and real-time web search using the Pollinations AI API with DeepSeek and SearchGPT models.