- Home
- MCP servers
- Weather
Weather
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 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": {
"emanmanco-mcppythonweather": {
"command": "uv",
"args": [
"run",
"[...]",
"/[PATH_TO_PROJECT]/src/mcp_weather.py"
],
"env": {
"DRIVE_FOLDER_ID": "XXX",
"OPENWEATHER_API_KEY": "your_api_key_here",
"SERVICE_ACCOUNT_PATH": "[/path/to]/keys/service-account-xxx.json"
}
}
}
}You can expose a weather data tool to AI agents through an MCP server. This setup lets an AI agent request current weather for a given location, using a real external weather data source. It enables you to test, chain, and reuse weather queries in prompts and tool-assisted workflows.
How to use
You access the weather tool via an MCP client. The tool is named get_weather and it returns the current weather for a specified location. Use it to let an AI agent ask for weather in cities, regions, or locations you specify. You will provide the location as input, and the server will fetch real-time data from the OpenWeatherMap API. Ensure your client propagates the location to the tool so the agent can obtain up-to-date weather information during conversations.
How to install
Prerequisites: you need a working environment for running Python and the MCP tooling that drives the server. Ensure you have a shell with access to the uv tooling used to manage the MCP server.
uv venv
source .venv/bin/activate
uv sync
Set up your API key for the weather data source. Obtain an API key from OpenWeatherMap and export it to your environment.
export OPENWEATHER_API_KEY=your_api_key_here
Run the MCP server in development mode to test the weather tool. The following starts the server and loads the weather function. After starting, open the inspector in your browser to test with a pre-filled token.
mcp dev src/mcp_weather.py
Configuration and example MCP client settings
You can declare the MCP server in a client config so your AI agent can discover and use the weather tool. The example below shows how to expose the server as a local, stdio-based tool that runs via uv and points at the weather script.
{
"mcpServers": {
"weather": {
"command": "uv",
"args": ["run", "[...]", "/[PATH_TO_PROJECT]/src/mcp_weather.py"],
"env": {
"OPENWEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Additional MCP server options and third-party examples
You can integrate additional MCP servers to extend capabilities. For example, you can configure a Google Sheets MCP server to enable data creation and modification in Sheets from prompts. The following shows how a Google Sheets MCP server can be declared for a tool available to your agent.
{
"google-sheets": {
"command": "uvx",
"args": ["mcp-google-sheets@latest"],
"env": {
"SERVICE_ACCOUNT_PATH": "[/path/to]/keys/service-account-xxx.json",
"DRIVE_FOLDER_ID": "XXX"
}
}
}
Setting up and troubleshooting uv and uvx
If your system cannot find uv or uvx, you may need to create a symbolic link to the binaries so they are in your PATH.
sudo ln -s ~/.local/bin/uv /usr/local/bin/uv
sudo ln -s ~/.local/bin/uvx /usr/local/bin/uvx
Notes and tips
The weather tool uses the OpenWeatherMap API, so keep your API key secure and do not expose it in public prompts or logs. When testing, you can validate the tool by supplying a location such as a city name and verifying that the returned data reflects current weather conditions.
Available tools
get_weather
Get current weather for a location using the OpenWeatherMap API