Repository avatar
AI Tools
v2.0.0
active

qweather-mcp-go

io.github.overstarry/qweather-mcp-go

QWeather forecasts, current conditions, alerts, air quality and daily life indices.

Documentation

qweather-mcp-go

smithery badge

MCP (Model Context Protocol) tool implementation for QWeather API.

Features

This project provides a series of QWeather API tools, including:

  • Real-time weather query
  • Daily and hourly forecasts, minute-level precipitation and official weather alerts
  • Air quality query
  • Life indices query

Weather tools

All four tools accept cityName. The server resolves the city with GeoAPI and sends latitude and longitude to QWeather. Times use the location's local time. Reports include the units and attribution supplied by QWeather.

MCP toolOptional parameterQWeather API
get-weather-now—Current weather
get-weather-forecastdays accepts 3d (default), 7d, or 10dDaily forecast
get-hourly-forecasthours accepts 24h (default), 72h, or 168hHourly forecast
get-weather-warning—Current alerts

Migration note — Daily forecasts now cover at most 10 days. Requests for 15d and 30d return a validation error. Update saved requests to use a supported duration. MCP tool names and output keys are unchanged. Go callers of the four client methods must pass latitude and longitude in place of the location ID and use the v1 response models.

Running Methods

Building from source requires Go 1.26 or later.

This project supports two running modes:

  1. stdio mode: Communicate with clients through standard input and output
  2. SSE mode: Provide API on HTTP server through Server-Sent Events (default mode)

Environment Variables Setup

The following environment variables need to be set before running:

  • QWEATHER_API_BASE: Use https://your-api-host, replacing your-api-host with the API Host from your QWeather console. Omit the trailing slash and endpoint path.
  • QWEATHER_API_KEY: QWeather API key

Windows Running Method

  1. Copy .env.example to .env and set both variables
  2. Double-click to run the run.bat file or run run.bat in the command line

Linux/Mac Running Method

  1. Copy .env.example to .env and set both variables
  2. Run the following commands:
chmod +x run.sh
./run.sh

Command Line Arguments

You can use the following command line arguments to control the program's behavior:

  • -t or --transport: Specify the transport type, options are stdio or sse (default is sse)
  • -p or --port: Specify the port for the SSE server to listen on (default is 8080)

For example:

go run main.go -t stdio  # Run in stdio mode
go run main.go -p 3000   # Run in SSE mode, listening on port 3000

Usage

SSE Mode

When running in SSE mode, the server will provide HTTP API on the specified port. You can connect to this server using a client that supports the MCP protocol.

By default, the server address is: http://localhost:8080

stdio Mode

When running in stdio mode, the server will communicate with clients through standard input and output. This mode is suitable for integration with AI assistants (such as Claude) that support the MCP protocol.

Installing via Smithery

To install qweather-mcp-go for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @overstarry/qweather-mcp-go --client claude
MCPB
https://github.com/overstarry/qweather-mcp-go/releases/download/v2.0.0/qweather-mcp-go.mcpb
Install Command
# mcpb: https://github.com/overstarry/qweather-mcp-go/releases/download/v2.0.0/qweather-mcp-go.mcpb