- Home
- MCP servers
- Weather CLI
Weather CLI
- python
1
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can run Weather CLI as a standalone command-line app or expose it as an MCP server to be queried by MCP clients. Using MCP lets you access real-time weather data from anywhere without embedding API keys, while maintaining a clean, standardized interface for integration with other systems.
How to use
You can interact with Weather CLI in two ways: as a local command-line utility or as an MCP server that you query from another process. In MCP mode, you run the server once and then issue requests from an MCP client to fetch forecasts for any location. You’ll always get a structured response that includes city, weather conditions, temperatures, humidity, wind, visibility, cloud cover, and precipitation.
How to install
Prerequisites: Python 3.13 or newer. A working internet connection for fetching weather data.
Clone the project repository to your workspace.
Install the local package with uvx (recommended) or with pip.
# Clone the repository
git clone https://github.com/liye71023326/weather-cli.git
cd weather-cli
# Install via uvx (recommended)
uv pip install -e .
# Or install via pip
pip install -e .
Server usage notes
Two MCP server startup options are provided. Choose the one that fits your environment. The server remains available to MCP clients until you stop it.
# Start the server directly with Python
python run_server.py
# Or start the MCP server via the MCP CLI
mcp run weather
Querying weather via MCP client
From another terminal, use an MCP client to request weather data. If you want Beijing’s weather (default location), you can request the default forecast. You can also specify latitude and longitude to query other cities.
# Query Beijing weather (default) using the weather MCP service
mcp call weather get_forecast
# Query a specific location (Shanghai)
mcp call weather get_forecast --latitude 31.2304 --longitude 121.4737
Notes on city coordinates and defaults
Default coordinates correspond to Beijing: latitude 39.9042, longitude 116.4074. Common cities and their coordinates are documented so you can query any location you need.
Troubleshooting and tips
If you encounter issues starting the server, ensure you are using a Python 3.13+ runtime and that you have network access to fetch weather data. If the MCP client cannot reach the server, verify that the server process is running and that you are issuing requests to the correct MCP instance.
Available tools
get_forecast
Fetches the current forecast for a specified location using latitude and longitude parameters. Returns a detailed weather string including city, conditions, temperatures, humidity, wind, visibility, cloud cover, and precipitation.
get_alerts
Retrieves weather alert information for a specified region. This feature is marked as not implemented in the current scope.