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のバージョン
Related Servers
News Fact-Checker
Automated fact-checking of news headlines using web search and Google Gemini AI.
Java Conferences MCP Server
Provides information about Java conferences worldwide by parsing data from the javaconferences.github.io repository.
Pollinations Think
Strategic thinking and real-time web search using the Pollinations AI API with DeepSeek and SearchGPT models.
ArXiv-MCP
Search and retrieve academic papers from arXiv based on keywords.
Wikimedia Image Search
MCP server that enables AI assistants to search Wikimedia Commons images with metadata and visual thumbnails.
WolframAlpha LLM
Answer math and other queries using the WolframAlpha LLM API.
Medical Research MCP Suite
An AI-powered API for medical research, unifying ClinicalTrials.gov, PubMed, and FDA databases with intelligent analysis.
NRTSearch
Exposes Lucene-based search indexes to AI assistants through the NRTSearch MCP server.
Unreal Engine Knowledge Graph
Search concept relationships in the Unreal Engine official documentation using a Neo4j-powered knowledge graph.
PubTator MCP Server
A server for biomedical literature annotation and relationship mining, based on PubTator3.