Skip to main content

A weather MCP MCP Server powered by OpenWeatherMap

Project description

Weather MCP Server 🌦️

A simple, ready-to-use MCP (Model Context Protocol) Server that provides real-time weather information via the OpenWeatherMap API.

Perfect for AI agents, Claude Desktop, TRAE IDE, and any MCP-compatible client.


✨ Features

  • 🌍 Query current weather by city name
  • 🧠 Designed for LLM tool calling (MCP)
  • ⚡ Fast startup with uvx
  • 🔐 Secure API key handling via environment variables

📦 Installation

Option 1: Run directly (recommended)

uvx weather-mcp-server

Option 2: Install from PyPI

pip install weather-mcp-server
weather-mcp-server

🔑 Setup

  1. Get a free API key from OpenWeatherMap.
  2. Set the environment variable:
export OPENWEATHER_API_KEY="your_api_key_here"

On Windows (PowerShell):

$env:OPENWEATHER_API_KEY="your_api_key_here"

🛠️ Usage with MCP Clients

Example: TRAE IDE / Claude Desktop

Add this to your MCP configuration:

{
  "mcpServers": {
    "weather": {
      "command": "uvx",
      "args": ["weather-mcp-server"],
      "env": {
        "OPENWEATHER_API_KEY": "your_api_key_here"
      }
    }
  }
}

Then ask your assistant:

“What’s the weather in Beijing?”


🧩 Available Tools

query_weather

query_weather(city: str) -> str

Returns a human-readable weather report.

Example output:

Beijing CN 的天气情况:晴,温度:23°C,湿度:45%,风速:3 m/s

🚀 Development

Clone and run locally:

git clone https://github.com/yourusername/weather-mcp-server.git
cd weather-mcp-server
uv sync
uv run weather-mcp-server

📄 License

MIT License — see LICENSE


🙌 Acknowledgements


Made with ☀️ by [Your Name]


📌 **记得修改两处占位符**:
1. `your_api_key_here` → 提醒用户替换(不用真填)
2. `yourusername` → 你的 GitHub 用户名
3. `[Your Name]` → 你的名字

---

## 四、现在你的项目结构长这样 ✅

weather-mcp-server/ ├── pyproject.toml ├── README.md ├── LICENSE ├── .python-version └── src/ └── weather_mcp/ ├── init.py └── server.py


---

## 五、下一步你可以做什么

1. `uv build` → 构建 wheel
2. `uv publish` → 发布到 PyPI
3. 在 TRAE / Claude Desktop 里用 `uvx weather-mcp-server` 体验“一键运行”

如果你愿意,下一步我可以帮你:
- ✅ 检查 `pyproject.toml` 是否 100% 符合 PyPI 要求
- ✅ 帮你写 `.gitignore`
- ✅ 模拟一次“发布前的最终检查清单”
- ✅ 教你如何给 MCP Server 加版本号和 CHANGELOG

你想继续哪一步? 😊

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz.

File metadata

  • Download URL: weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz
  • Upload date:
  • Size: 64.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz
Algorithm Hash digest
SHA256 53f0984aafaaf9824806d16e42ec549f780c0d3a9fb947db4bbb286fab2b386b
MD5 4c96bf24308d2111009de68fd281f400
BLAKE2b-256 fb9575fe3ce6c8b995a615a6fcababd4f00647fbc8189bbd3f1dff1d794739c7

See more details on using hashes here.

File details

Details for the file weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a92104c223a6ba17f1fbe2a05ef2b87348533d6f79af1fc81e5006593b055621
MD5 39838c06f7bb0681e2e5704a0f348b8d
BLAKE2b-256 7d6172d546201d8bc7cea81bbe12fc78a99ffdbffa13915d7d29e6392000311a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page