Weather MCP Server
by riishiiiii
README.md
# MCP Test Weather Server
This project is a small Python MCP server that exposes a `get_weather` tool.
The tool accepts a city name, calls the OpenWeatherMap API, and returns current
temperature, weather description, and humidity.
## What It Contains
- `mcp_server.py`: Defines the MCP server, registers the `get_weather` tool, and
serves it over Streamable HTTP using Starlette/Uvicorn.
- `agent.py`: Defines a LangGraph workflow that fetches weather data with
`httpx`.
- `requirements.txt`: Python dependencies for the server.
## Requirements
- Python 3.13 or newer
- An OpenWeatherMap API key
## Setup
Create and activate a virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate
```
Install dependencies:
```bash
pip install -r requirements.txt
```
## Configure Weather API
The weather client in `agent.py` currently uses an OpenWeatherMap API key in the
`API_KEY` constant. For local development, replace it with your own key before
running the server.
## Run The Server
Start the MCP server:
```bash
python mcp_server.py
```
The server listens on:
```text
http://0.0.0.0:7070
```
## Available MCP Tool
### `get_weather`
Gets current weather information for a city.
Input schema:
```json
{
"city": "Ahmedabad"
}
```
Example response text:
```text
Ahmedabad: 31.2°C, clear sky, humidity 42%
```
If no city is provided, the agent defaults to `Ahmedabad`.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues