天气MCP服务器
一个提供来自国家气象局API天气数据的MCP服务器。
这个项目是为了学习目的而创建的,旨在了解MCP(模型上下文协议)的工作原理。
安装
npm install -g weather-mcp设置
在您的MCP客户端配置中添加:
{
"mcpServers": {
"weather": {
"command": "weather-mcp"
}
}
}工具
获取天气预报
获取美国任何地点的天气预报。
latitude(数字)longitude(数字)
获取警报
获取美国某州的天气警报。
state(字符串):两个字母的州代码,如“CA”或“NY”
发展
git clone https://github.com/omrigrossman/weather-mcp.git
cd weather-mcp
npm install
npm run build
npx node build/index.js 注释
- 仅限美国地区(受NWS API限制)
- 免费使用,无需API密钥
