MCP 天气服务器
该项目是模型上下文协议 (MCP) 服务器的演示实现,该服务器提供与天气相关的工具。该服务器公开两个工具:
- get-alerts :获取特定美国州的有效天气警报。
- get-forecast :根据纬度和经度提供特定位置的天气预报。
特征
- 使用 Node.js 构建。
- 实施 MCP 工具来检索天气数据。
- 使用美国国家气象局 API 获取准确和最新的天气信息。
先决条件
- 您的系统上安装了 Node.js。
- 熟悉 MCP 概念和工具。
设置
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 mcp-server-learn:
npx -y @smithery/cli install @adarshem/mcp-server-learn --client claude
手动安装
- 克隆存储库:
git clone <repository-url>
cd weather
- 使用
pnpm
安装依赖项(如项目中配置的那样): - 构建项目:
配置
更新 VSCode 的settings.json
文件以添加此 MCP 服务器
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather/build/index.js"
]
}
}
}
资源