Skip to main content
Glama
Weather MCP Server

Weather MCP Server

by Amann001

Weather MCP Server

A mini project demonstrating how to build and use a Model Context Protocol (MCP) server with Python.

Features

  • Weather Alerts Tool

  • Weather Forecast Tool

  • SSE Transport

  • STDIO Transport

  • MCP Client Integration

  • Docker Support

  • Async Python Implementation

Related MCP server: Weather MCP Server

Project Structure

mcpcrashcourse/
│
├── server/
│   └── mcpserver/
│       ├── server.py
│       ├── client-sse.py
│       ├── client-stdio.py
│       ├── Dockerfile
│       └── requirements.txt
│
├── weather.py
├── weather.json
├── client.py
├── README.md
├── pyproject.toml
└── uv.lock

Tools

get_alerts

Returns active weather alerts for a US state.

Example:

get_alerts("CA")

get_forecast

Returns forecast information based on latitude and longitude.

Example:

get_forecast(
    latitude=37.7749,
    longitude=-122.4194
)

Transports

STDIO

Used for local MCP communication.

SSE

Used for remote communication through HTTP.

Running the Server

STDIO

uv run server/mcpserver/server.py

SSE

Configure transport as:

mcp.run(transport="sse")

Then:

uv run server/mcpserver/server.py

Running Clients

SSE Client

uv run server/mcpserver/client-sse.py

STDIO Client

uv run server/mcpserver/client-stdio.py

Docker

Build:

docker build -t weather-mcp .

Run:

docker run weather-mcp

Technologies Used

  • Python

  • MCP

  • FastMCP

  • HTTPX

  • AsyncIO

  • Docker

  • SSE

  • STDIO

Learning Outcomes

  • Building MCP tools

  • Creating MCP servers

  • Working with MCP clients

  • Using SSE transport

  • Using STDIO transport

  • Tool invocation

  • Agent-tool communication

  • Dockerizing MCP applications

Available Tools

2 tools
get_alertsA

Get weather alerts for a US state.

Args: state: Two-letter US state code (e.g. CA, NY)

Inputs: state (required). Returns: result

get_forecastC

Get weather forecast for a location.

Args: latitude: Latitude of the location longitude: Longitude of the location

Inputs: latitude (required), longitude (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: one retrieves alerts by state, the other provides forecasts by coordinates. There is no functional overlap or ambiguity.

    Naming Consistency5/5

    Both tools follow a consistent 'get_noun' pattern with snake_case, making the names predictable and easy to understand.

    Tool Count4/5

    With only two tools, the server is minimal but still covers two core weather functionalities. It feels slightly thin but is acceptable for a focused server.

    Completeness3/5

    The server covers alerts and forecasts but lacks current conditions, historical data, or other common weather endpoints. Notable gaps exist, but the core stated purpose is partially met.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides weather information tools based on the National Weather Service APIs through an SSE-based MCP server that can run as a standalone process or Docker container.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides weather forecasts and active alerts for US locations using the National Weather Service API. It supports both local stdio and remote HTTP/SSE transport modes for flexible integration with MCP clients.
      104 npm
      GPL 3.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      MCP server that provides tools to retrieve weather information from a weather API, supporting both local stdio and remote Streamable HTTP transports.
      511 npm
      1
      MIT