Skip to main content

Weather MCP Tool

English | 中文

Weather MCP Tool

一个极简的天气查询 MCP 工具,只需一句话即可查询全球天气。完美集成 Cursor 编辑器,支持中英文自然语言交互。

特性

  • 💡 极简使用:一句话查询天气
  • 🤖 智能交互:支持中英文自然语言
  • 🌏 全球天气:支持所有主要城市
  • 🔌 即插即用:完美集成 Cursor

三步上手

1. 安装

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

2. 配置

🔑 获取 OpenWeather API Key

方法一:快速配置(推荐)

复制示例配置文件并修改:

cp env.example .env

然后编辑 .env 文件,将 your_api_key_here 替换为您的 API Key。

方法二:环境变量

macOS/Linux:

export OPENWEATHERMAP_API_KEY="your_api_key"

Windows:

set OPENWEATHERMAP_API_KEY=your_api_key

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?

就是这么简单!

参数说明

如果需要更精确的查询,可以指定以下参数:

参数 说明 默认值
city 城市名称(中/英文) 必填
days 预报天数(1-5天) 5
units 温度单位 (metric/imperial) metric
lang 返回语言 (zh_cn/en) zh_cn

常见问题

  1. 无法使用?

    • 确保 API Key 已正确设置
    • 重启 Cursor
    • 检查 Python 环境
  2. 找不到城市?

    • 尝试使用英文名
    • 检查拼写是否正确
    • 使用完整城市名

Weather MCP Tool

A minimalist weather query MCP tool that allows you to check global weather with just one sentence. Perfectly integrated with Cursor editor, supporting both Chinese and English natural language interaction.

Features

  • 💡 Minimalist: One-line weather query
  • 🤖 Smart: Natural language support in Chinese/English
  • 🌏 Global: Support for all major cities
  • 🔌 Plug & Play: Perfect Cursor integration

Quick Start

1. Installation

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

2. Configuration

🔑 Get OpenWeather API Key

Method 1: Quick Setup (Recommended)

Copy the example configuration file and modify it:

cp env.example .env

Then edit the .env file, replace your_api_key_here with your API Key.

Method 2: Environment Variables

macOS/Linux:

export OPENWEATHERMAP_API_KEY="your_api_key"

Windows:

set OPENWEATHERMAP_API_KEY=your_api_key

3. Enable Tool

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

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

Restart Cursor and you're ready to go!

Usage Examples

Simply type in Cursor:

查询苏州天气
北京明天会下雨吗?
Show me the weather in Tokyo
What's the forecast for London?

That's it!

Parameters

For more precise queries, you can specify these parameters:

Parameter Description Default
city City name (Chinese/English) Required
days Forecast days (1-5) 5
units Temperature unit (metric/imperial) metric
lang Response language (zh_cn/en) zh_cn

FAQ

  1. Not Working?

    • Ensure API Key is set correctly
    • Restart Cursor
    • Check Python environment
  2. City Not Found?

    • Try using English name
    • Check spelling
    • Use complete city name

Author

Acknowledgments

Metadata

Release files for weather-server 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weather-server 1.0.0
File Size Uploaded Provenance Actions
weather_server-1.0.0.tar.gz 7.6 kB Without provenance Details for weather_server-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for weather-server 1.0.0
File Interpreter ABI Platform Actions
weather_server-1.0.0-py3-none-any.whl Python 3 none any Details for weather_server-1.0.0-py3-none-any.whl

Total release size: 14.0 kB

Release files / weather_server-1.0.0.tar.gz

Download URL weather_server-1.0.0.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4aae17f39145e39425e5fa4b85e09d84e049ca2bf0c9f8d1f7924fae65918c38
BLAKE2b-256 checksum
How to use checksums
55c2caf3a0d5fdde8518768b647285a0d6494c4d82c9b8c54b92cd7f0ef306b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Release files / weather_server-1.0.0-py3-none-any.whl

Download URL weather_server-1.0.0-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
edbb3c4bd96c53cc4149c423fd17027cde6aff37954aaa4169546cd141cb3a0a
BLAKE2b-256 checksum
How to use checksums
0a951429f3252bdec886f87a87594a4b52e962d9bed1b623ed5ca45bb961e9b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.0

Security for weather-server 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page