Weather MCP Server
by KezaTeta
README.md
# Weather MCP Server
An MCP server that exposes two tools — `get_current_weather` and
`get_forecast` — backed by the free [Open-Meteo](https://open-meteo.com) API
(no API key required). Built to be added to a Microsoft Copilot Studio agent
as an MCP tool.
## Files
- `server.py` — the MCP server (FastMCP, Streamable HTTP transport)
- `requirements.txt` — Python dependencies
- `Dockerfile` — container image for deployment
## 1. Run it locally
```bash
pip install -r requirements.txt
python server.py
```
This starts a Streamable HTTP MCP server on `http://0.0.0.0:8000/mcp`
(FastMCP's default path/port).
To sanity-check it without Copilot Studio, use the MCP Inspector:
```bash
npx @modelcontextprotocol/inspector
```
Point the Inspector at `http://localhost:8000/mcp` with transport
"Streamable HTTP", then try calling `get_current_weather` with
`{"city": "Kigali"}`.
> Note: Copilot Studio's MCP connector needs a server reachable over the
> **public internet** via HTTPS, not `localhost`. Local runs are just for
> testing the tool logic before you deploy.
## 2. Deploy it somewhere public
Any host that can run a container and give you an HTTPS URL works. Azure
Container Apps is a natural fit since you're already in the Microsoft
ecosystem:
```bash
# from this folder
az login
az group create -n weather-mcp-rg -l eastus
az containerapp up \
--name weather-mcp \
--resource-group weather-mcp-rg \
--location eastus \
--source . \
--target-port 8000 \
--ingress external
```
`az containerapp up` builds the image from the Dockerfile, pushes it, and
gives you back a public HTTPS URL, e.g.
`https://weather-mcp.<random>.eastus.azurecontainerapps.io`.
Your MCP endpoint will be that URL + `/mcp`, e.g.:
```
https://weather-mcp.<random>.eastus.azurecontainerapps.io/mcp
```
(Any other host — Fly.io, Render, a VM, App Service — works the same way;
you just need the container listening on port 8000 and reachable over
HTTPS.)
## 3. Connect it to Copilot Studio
1. In Copilot Studio, open your agent → **Tools** page → **Add a tool**.
2. Choose **Model Context Protocol**.
3. Give it a name (e.g. "Weather MCP") and description, and paste in your
server's URL (the `/mcp` endpoint from step 2).
4. Save. Copilot Studio will connect and list `get_current_weather` and
`get_forecast` under that tool's Tools/Resources section.
5. Go to **Topics**, create a topic (e.g. "Get weather") with trigger
phrases like "what's the weather in X", add a node → **Add a tool**,
and select the MCP tool.
6. Test in the chat pane: "what's the weather in Kigali right now?"
## Notes
- `get_forecast` takes an optional `days` parameter (1–7, default 3).
- The geocoding step means users can type natural city names ("Rome",
"Kigali", "Rome, Italy") rather than coordinates.
- If you want more detail (hourly data, weather alerts, historical data),
Open-Meteo supports all of that — the `get_forecast` function is a good
place to extend.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues