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
- Get a free API key from OpenWeatherMap.
- 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
你想继续哪一步? 😊
Metadata
Release files for weather-mcp-server-beijing-pycoder-2026 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz | 64.1 kB | Without provenance | Details for weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl |
Total release size: 73.5 kB
Release files / weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz
| Download URL | weather_mcp_server_beijing_pycoder_2026-0.1.0.tar.gz |
|---|---|
| Size | 64.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53f0984aafaaf9824806d16e42ec549f780c0d3a9fb947db4bbb286fab2b386b
|
|
BLAKE2b-256 checksum How to use checksums |
fb9575fe3ce6c8b995a615a6fcababd4f00647fbc8189bbd3f1dff1d794739c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl
| Download URL | weather_mcp_server_beijing_pycoder_2026-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a92104c223a6ba17f1fbe2a05ef2b87348533d6f79af1fc81e5006593b055621
|
|
BLAKE2b-256 checksum How to use checksums |
7d6172d546201d8bc7cea81bbe12fc78a99ffdbffa13915d7d29e6392000311a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Security for weather-mcp-server-beijing-pycoder-2026 0.1.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.