- 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": {
"olsigjecii-mcp-server-weather": {
"command": "mcp",
"args": [
"dev",
"server.py"
]
}
}
}You will build a lightweight MCP Server in Python that exposes real-time weather data from the Open-Meteo API as a tool. This lets language models request current weather data for a location and receive structured results that they can incorporate into conversations or workflows.
How to use
Use an MCP client to connect to the weather MCP server and call the get_current_weather tool with a latitude and longitude. The tool retrieves current weather data for the specified location and returns the raw data for the model to interpret or further process. You can extend the server later with additional tools like get_forecast for forecasts or get_location for geocoding to improve location accuracy.
How to install
Prerequisites you need before building the server are:
- A code editor (for example, VS Code)
- uv a Rust-based Python package manager
- Python (for running the MCP server and dependencies)
- A code editor to review and customize the code
- A tool to run commands in your terminal (like zsh, bash, or PowerShell)
Install uv on your system:
- macOS: open a terminal and run
brew install uv - Windows: open a terminal and run
winget install --id=astral-sh.uv -e
Create and prepare your project folder:
- Create a new folder
mkdir mcp-server-weather - Navigate into the folder
cd mcp-server-weather - Initialize a new uv project
uv init - Create a virtual environment
uv venv - Activate the virtual environment
source .venv/bin/activate(on Windows use.envin o_activateequivalent) - Install the Python MCP SDK with CLI extension and dependencies
uv add "mcp[cli]" httpx
Create the server scaffold. In your project folder create a file named server.py (or reuse main.py if you prefer). Add the following scaffold to initialize and run the server with stdio transport:
from typing import Any
import httpx
from mcp.server.fastmcp import FastMCP
# Initialize FastMCP server
mcp = FastMCP("weather")
### The rest of your code goes between here...
### ... and here.
if __name__ == "__main__":
# Initialize and run the server
mcp.run(transport='stdio')
Run the MCP server in development mode
To run the server in development mode and start the MCP Inspector for testing, use the following command:
mcp dev server.py
Available tools
get_current_weather
A tool that fetches current weather data for a given latitude and longitude using the Open-Meteo API. It returns the full data payload for the model to process.