天气查询工具

一款简约的天气查询工具,支持自然语言查询全球天气,完美集成于Cursor编辑器。

  • by MrCare
  • Python
  • 本地部署
  • 26 星标
  • 更新于
在 GitHub 查看 MrCare/mcp_tool

使用说明

Weather MCP Tool

A minimalist weather query tool that lets you check global weather with just one sentence, perfectly integrated with Cursor editor.

英语 | 中文

Watch how easy it is to query weather with natural language

✨ 特性

  • 💡 极简主义者:单行天气查询
  • 🤖 聪明的:中文/英文自然语言支持
  • 🌏 全球:支持所有主要城市
  • 🔌 即插即用:完美的光标集成
  • 🚀 高性能:异步处理,快速响应
  • 🎨 美丽的:清晰直观的天气显示

🚀 快速开始

1.获取API密钥

🔑 在开始之前,请 获取OpenWeather API密钥

2.一键安装(推荐)

使用Smithery在一个命令中安装和配置:

npx -y @smithery/cli@latest install @MrCare/mcp_tool --client cursor --config "{\"openweathermapApiKey\":\"your_api_key_here\",\"port\":8000}"

有关WindSurf和Cine的安装,请访问我们的 Smithery存储库.

3.手动安装

3.1克隆和安装

git clone https://github.com/yourusername/weather-server.git && cd weather-server && pip install -e .

3.2配置API密钥

方法1:使用配置文件(推荐)

复制示例配置文件并对其进行修改:

cp env.example .env

然后编辑 .env 文件,替换 your_api_key_here 使用您的API密钥。

方法2:使用环境变量

macOS/Linux:

export OPENWEATHERMAP_API_KEY="your_api_key"

窗户:

set OPENWEATHERMAP_API_KEY=your_api_key

3.3启用工具

编辑 ~/.cursor/mcp.json (Windows: %USERPROFILE%\.cursor\mcp.json):

{
    "weather_fastmcp": {
        "command": "python",
        "args": ["-m", "weather_server.server"]
    }
}

重新启动Cursor,您就可以开始了!

📝 使用示例

只需键入Cursor:

Show me the weather in Tokyo
What's the forecast for London?
How's the weather in New York?
Will it rain tomorrow in Paris?

就是这样!

⚙️ 参数

对于更精确的查询,您可以指定以下参数:

参数 说明 默认值
城市 城市名称(中/英文) 必填
天数 预测天数(1-5) 5
单位 温度单位(公制:摄氏度,英制:华氏度) 公制
lang 响应语言(zh_cn:中文,en:英文) zh_cn

❓ 常见问题解答

  1. 不工作?

    • 确保正确设置了API密钥
    • 重新启动游标
    • 检查Python环境
  2. 找不到城市?

    • 尝试使用英文名称
    • 检查拼写
    • 使用完整的城市名称

👨‍💻 作者

  • 卡尔先生
  • 电子邮件:534192336car@gmail.com

🙏 致谢

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 详细信息文件