Weather query skill for Aliyun Model Context Protocol (MCP)
Project description
Aliyun MCP Weather Skill
A weather query skill for Aliyun Model Context Protocol (MCP), providing simulated weather data for major Chinese cities.
Features
get_weather(city): Get weather information for a city- Returns structured weather data including temperature, condition, humidity, and wind speed
- Supports major Chinese cities: Beijing, Shanghai, Guangzhou, Shenzhen
- Case-insensitive city name matching
Installation
pip install aliyun-mcp-weather-skill-20260130
Usage
Basic Usage
from aliyun_mcp_skill import get_weather
# Get weather for Beijing
weather = get_weather("Beijing")
print(weather)
# Output:
# {
# "city": "Beijing",
# "temperature": 22,
# "condition": "sunny",
# "humidity": 45,
# "wind_speed": 10
# }
# Get weather for Shanghai
shanghai_weather = get_weather("shanghai")
print(shanghai_weather)
Aliyun MCP Integration
To use this skill with Aliyun MCP:
- Install the package in your MCP server environment
- Register the skill as a tool in your MCP server:
from mcp.server.mcpserver import MCPServer
from aliyun_mcp_skill import get_weather
# Create MCP server
mcp = MCPServer("Aliyun Weather Server")
# Register weather tool
@mcp.tool()
def weather(city: str) -> dict:
"""Get weather information for a city"""
return get_weather(city)
# Run server
mcp.run(transport="streamable-http", json_response=True)
- Connect your Aliyun LLM application to the MCP server
Weather Data
The skill provides simulated weather data for the following cities:
| City | Temperature (°C) | Condition | Humidity (%) | Wind Speed (km/h) |
|---|---|---|---|---|
| Beijing | 22 | sunny | 45 | 10 |
| Shanghai | 25 | cloudy | 60 | 8 |
| Guangzhou | 28 | rainy | 75 | 12 |
| Shenzhen | 27 | partly cloudy | 70 | 9 |
Development
Build the package
python -m build
Upload to PyPI
python -m twine upload dist/*
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file aliyun_mcp_weather_skill_20260130-0.1.0.tar.gz.
File metadata
- Download URL: aliyun_mcp_weather_skill_20260130-0.1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c55c5c5f4480d4ca496e09011957c352291c063b8e8e4d611866c4f4fd82757
|
|
| MD5 |
abc68db7ea01316e27bda74297d04922
|
|
| BLAKE2b-256 |
c4294d0253e1f63c0a29c0593d6dcf0c1f211d583c8f3a94401ddc969ba27be0
|