- Home
- MCP servers
- Weather
Weather
- 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.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"liuketong713-weather_mcp": {
"command": "python",
"args": [
"server.py"
],
"env": {
"MODEL": "gpt-3.5-turbo",
"BASE_URL": "https://api.openai.com/v1",
"OPENAI_API_KEY": "your_openai_api_key_here",
"WEATHER_API_KEY": "your_openweather_api_key_here"
}
}
}
}Weather MCP is a weather query service that uses the Model Context Protocol to provide global, real-time weather information by integrating the OpenWeather API. It supports Chinese natural language interactions, automatically invoking weather queries and returning nicely formatted results for you to read and share.
How to use
Use Weather MCP with an MCP client to ask for weather information in natural language. You can query any city in the world in Chinese, and the system will interpret your request, call the weather tool, and return a readable weather report. For example, you can say: 你: 查询北京的天气 and you will receive a formatted weather update including location, temperature, humidity, wind, and overall conditions.
How to install
Prerequisites you need before installing this server: Python 3.8+ and a working internet connection. You should also have access to OpenAI API keys and a OpenWeather API key.
- Install Python dependencies using a Python-centric workflow.
# Using uv to install Python dependencies (recommended for this setup)
uv sync
# Or install via pip from the requirements file
pip install -r requirements.txt
- Prepare environment variables. Create a file named
.envand populate the required keys shown below.
OPENAI_API_KEY=your_openai_api_key_here
BASE_URL=https://api.openai.com/v1
MODEL=gpt-3.5-turbo
WEATHER_API_KEY=your_openweather_api_key_here
- Start the MCP server using the provided startup command.
python server.py
- In a separate terminal, run the client to interact with the server.
python client.py server.py
Additional configuration and notes
Server-side configuration is expressed through a standard MCP config snippet. The server is identified as Weather MCP and runs as a stdio MCP server with these settings.
{
"mcpServers": {
"weather_mcp": {
"args": [
"server.py"
],
"command": "python",
"env": {
"OPENAI_API_KEY": "your_openai_api_key_here",
"BASE_URL": "your_model_base_url",
"MODEL": "YOUR_Model_Name",
"WEATHER_API_KEY": "your_openweather_api_key_here"
}
}
}
}
Environment variables you may want to set and reference in your deployment are OPENAI_API_KEY, BASE_URL, MODEL, WEATHER_API_KEY. Ensure these match your keys and the model you intend to use.
Notes on usage patterns
-
You can query any city by name; ensure the city is written in a way your OpenWeather API can understand (usually English city names in API calls). The system will translate your intent into a call to the weather tool and present a formatted summary.
-
The output includes location, temperature (Celsius by default), humidity, wind speed, and a brief weather description to help you plan your activities.
Available tools
query_weather
Fetches weather information for a specified city and returns a formatted weather summary