home / mcp / weather mcp server

Weather MCP Server

A working pattern for SSE-based MCP clients and servers

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "sidharthrajaram-mcp-sse": {
      "url": "http://0.0.0.0:8080/sse",
      "headers": {
        "ANTHROPIC_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

You can run an SSE-based MCP server that exposes weather-related tools and connect to it with an MCP client. This pattern lets you decouple the server from the client, so you can deploy, scale, and reuse the server independently while your client interacts with it over a stable HTTP SSE endpoint.

How to use

You start the server as a standalone process and then connect a client to its SSE endpoint to invoke tools. The server exposes tools like getting alerts and forecasts, which the client can call by name. You supply your API key as an environment variable so tools requiring authentication can operate.

Usage flow you can follow:

  • Start the SSE-based MCP server with its default settings: uv run weather.py
  • Optionally customize the host and port: uv run weather.py --host <your host> --port <your port>
  • In a separate terminal, start the MCP client and point it at the server's SSE endpoint: uv run client.py http://0.0.0.0:8080/sse
  • Interact with the client by typing questions, for example: whats the weather like in Spokane?

How to install

# Prerequisites: Node.js/yarn for Smithery, Python tooling for the server, and a valid API key
# Install the SSE-based MCP server and client using Smithery
npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claude

Install and run the server and client using the commands shown below. The server runs by default on 0.0.0.0:8080, and you can override the host/port if needed.

uv run weather.py

uv run client.py http://0.0.0.0:8080/sse
```

```bash
# Optional: customize host and port for the server
uv run weather.py --host <your host> --port <your port>
```

```bash
# Connect the client to the server SSE endpoint
uv run client.py http://0.0.0.0:8080/sse

Additional notes

Environment variable required: ANTHROPIC_API_KEY must be available in your environment or defined in a .env file before starting the server and client.

Available tools

get_alerts

Fetch current weather alerts from supported sources and return a structured list of alerts.

get_forecast

Retrieve weather forecast data for a given latitude and longitude, returning the forecast details for the requested location.