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
arXiv Search
A server for searching academic papers and preprints on arXiv.org.
SearchAPI Agent
An MCP agent that integrates various search tools using the SearchAPI service. Requires SearchAPI and Google API keys.
Reexpress
Enable Similarity-Distance-Magnitude statistical verification for your search, software, and data science workflows
RAG Documentation MCP Server
Retrieve and process documentation using vector search to provide relevant context for AI assistants.
展会大数据服务
Query comprehensive exhibition information, including enterprise participation records, venue details, and exhibition search.
NCBI Literature Search
Search NCBI databases, including PubMed, for scientific literature. Tailored for researchers in life sciences, evolutionary biology, and computational biology.
Serper Search
Provides Google search results and AI-powered deep research using the Serper API.
Tavily
A comprehensive search API for real-time web search, data extraction, and crawling, requiring a Tavily API key.
Panda3D Docs
Search and retrieve documentation for the Panda3D game engine.
Related Identity MCP Server
Discover related blockchain addresses and domain names for web3 identities across different platforms.