Skip to main content

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:

  1. Install the package in your MCP server environment
  2. 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)
  1. 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


Download files

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

Source Distribution

aliyun_mcp_weather_skill_20260130-0.1.0.tar.gz (3.8 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for aliyun_mcp_weather_skill_20260130-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9c55c5c5f4480d4ca496e09011957c352291c063b8e8e4d611866c4f4fd82757
MD5 abc68db7ea01316e27bda74297d04922
BLAKE2b-256 c4294d0253e1f63c0a29c0593d6dcf0c1f211d583c8f3a94401ddc969ba27be0

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