Weather Query MCP
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Used for managing environment variables, particularly for storing the OpenWeatherMap API key required for the weather service to function
Mentioned as part of the deployment process to Render.com, which connects to the GitHub repository for continuous deployment
Provides a way to expose the locally running MCP server to the internet for development and testing purposes
天气查询 MCP 服务
这是一个简单的天气查询MCP(Model Completion Plugin)服务,可以让你通过Cursor AI助手查询全球城市的天气状况。
准备工作
- 注册并获取OpenWeatherMap API密钥:
- 访问 OpenWeatherMap 网站
- 注册一个免费账户
- 获取API密钥
- 配置环境变量:
- 在项目根目录中找到
.env
文件 - 将你的API密钥填入
OPENWEATHER_API_KEY=your_api_key_here
- 在项目根目录中找到
本地运行
- 安装依赖:
- 启动服务:
或者使用开发模式(自动重启):
- 服务将在 http://localhost:3001 上运行
部署到公网
为了让Cursor能够使用这个MCP服务,你需要将其部署到公网可访问的地址。以下是几种简单的方法:
使用ngrok进行临时公开(开发测试用)
- 安装ngrok:
- 访问 ngrok.com 注册并下载
- 按照官方指南设置ngrok
- 在本地启动你的服务:
- 在另一个终端窗口启动ngrok:
- ngrok会提供一个公开URL(例如
https://abc123.ngrok.io
)- 使用这个URL来配置Cursor中的MCP服务
部署到Render.com(免费方案)
- 注册 Render.com 账户
- 创建新的Web服务:
- 连接你的GitHub仓库
- 设置构建命令:
npm install
- 设置启动命令:
npm start
- 添加环境变量:
OPENWEATHER_API_KEY
- 部署完成后,Render会提供一个类似于
https://your-service-name.onrender.com
的URL- 使用这个URL来配置Cursor中的MCP服务
在Cursor中配置MCP服务
- 打开Cursor编辑器
- 点击设置图标
- 选择"MCP服务"
- 点击"添加MCP服务"
- 输入你的MCP清单URL(例如
https://your-service.onrender.com/mcp-manifest.json
) - 保存设置
现在你可以通过Cursor AI助手查询天气了,例如:
- "北京今天的天气怎么样?"
- "查询上海的气温"
- "纽约现在的天气状况"
API使用
如果你想直接调用API,可以使用以下端点:
示例响应:
许可证
MIT
This server cannot be installed
A simple MCP service that allows users to query weather conditions for cities worldwide through the Cursor AI assistant.