Weather Query
STDIOMCP service for querying global city weather conditions through Cursor AI assistant.
MCP service for querying global city weather conditions through Cursor AI assistant.
这是一个简单的天气查询MCP(Model Completion Plugin)服务,可以让你通过Cursor AI助手查询全球城市的天气状况。
注册并获取OpenWeatherMap API密钥:
配置环境变量:
.env
文件OPENWEATHER_API_KEY=your_api_key_here
npm install
npm start
或者使用开发模式(自动重启):
npm run dev
为了让Cursor能够使用这个MCP服务,你需要将其部署到公网可访问的地址。以下是几种简单的方法:
安装ngrok:
在本地启动你的服务:
npm start
ngrok http 3001
https://abc123.ngrok.io
)
注册 Render.com 账户
创建新的Web服务:
npm install
npm start
OPENWEATHER_API_KEY
部署完成后,Render会提供一个类似于 https://your-service-name.onrender.com
的URL
https://your-service.onrender.com/mcp-manifest.json
)现在你可以通过Cursor AI助手查询天气了,例如:
如果你想直接调用API,可以使用以下端点:
GET /weather?city={城市名}
示例响应:
{ "city": "北京", "temperature": 25.6, "description": "晴", "humidity": 45, "wind_speed": 5.7 }
MIT