MCP Weather Server
This repository provides a simple Model Context Protocol (MCP) server written in Python that exposes weather data as tools. It is packaged so it can be published to GitHub and (optionally) to PyPI.
The server is built on the official mcp Python SDK and uses the free Open‑Meteo APIs (no API key required).
Features
- MCP-compliant server using
FastMCP - Two tools:
get_current_weather– current conditions for a cityget_daily_forecast– daily forecast for a city for the next N days
- Runs locally in Python (stdio transport by default)
Installation
From the project root:
pip install -e .
Or, using uv:
uv sync
Running the MCP server locally
You can run the server directly via the console script:
python -m mcp_weather_server.server
Or, if installed as a package:
mcp-weather-server
By default it uses the stdio transport, which works with MCP-compatible clients (e.g. IDE integrations or LLM apps that support MCP).
Connecting with MCP Inspector (optional)
To experiment via HTTP instead of stdio, you can set the transport to streamable-http inside server.py and then run:
uv run --with mcp python -m mcp_weather_server.server
Then start the MCP Inspector:
npx -y @modelcontextprotocol/inspector
and connect to http://localhost:8000/mcp.
Git conventions
- Commit messages must follow Conventional Commits (e.g.
feat: add daily forecast tool,fix(server): handle API errors). - A Cursor rule at
.cursor/rules/git-conventional-commits.mdcdocuments the allowed types and format.