home / mcp / weather mcp server

Weather MCP Server

Provides weather data from the National Weather Service via HTTP or local stdio access, including forecasts and alerts.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "ajayamal-mcp-server": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "PORT": "3000",
        "TRANSPORT": "http"
      }
    }
  }
}

You run a weather-focused MCP server that serves forecasts and alerts via local stdio or remote HTTP/SSE access. It’s useful for integrating weather data into your MCP workflow, automating sessions, and receiving timely forecast and alert information for US locations.

How to use

You can run the server in two ways: locally for MCP clients on your machine, or remotely over HTTP for client applications. In local mode, you start a single server process that communicates through standard input and output. In remote mode, you start an HTTP server that clients connect to via an MCP endpoint and receive data through server-sent events when supported.

How to install

Prerequisites: install Node.js and npm on your system.

1) Install dependencies and build the project.

npm install
npm run build

Configuration and usage examples

Local mode (stdio transport) runs the server in a single process that communicates through stdin and stdout. You can run it with the default configuration or explicitly force stdio mode.

node build/index.js
```

```
TRANSPORT=stdio node build/index.js

Remote mode (HTTP/SSE transport)

In remote mode, the server starts an HTTP endpoint that clients connect to. You can run on the default port or specify a custom port.

TRANSPORT=http node build/index.js
```

```
TRANSPORT=http PORT=8080 node build/index.js

Client access and session management (high level)

When running remotely, you obtain a session and use it for subsequent requests. The server provides mechanisms to initialize a session, fetch forecasts by coordinates, retrieve active alerts for a state, and open an SSE stream for real-time updates. Use the session to perform actions such as getting forecasts and alerts.

Open a remote stream and terminate a session

Open an SSE stream to receive server-initiated messages, then terminate the session when finished.

Available commands and endpoints (high level)

The server exposes tools to fetch a forecast for a location and to get active alerts for a US state. Use the appropriate tool by name with the required arguments.

Available tools

get_forecast

Retrieve weather forecast for a given geographic location using US coordinates.

get_alerts

Fetch active weather alerts for a specified US state.

Weather MCP Server - ajayamal/mcp-server