
qweather-mcp-go
io.github.overstarry/qweather-mcp-go
QWeather forecasts, current conditions, alerts, air quality and daily life indices.
Documentation
qweather-mcp-go
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 tool | Optional parameter | QWeather API |
|---|---|---|
get-weather-now | — | Current weather |
get-weather-forecast | days accepts 3d (default), 7d, or 10d | Daily forecast |
get-hourly-forecast | hours accepts 24h (default), 72h, or 168h | Hourly 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:
- stdio mode: Communicate with clients through standard input and output
- 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: Usehttps://your-api-host, replacingyour-api-hostwith the API Host from your QWeather console. Omit the trailing slash and endpoint path.QWEATHER_API_KEY: QWeather API key
Windows Running Method
- Copy
.env.exampleto.envand set both variables - Double-click to run the
run.batfile or runrun.batin the command line
Linux/Mac Running Method
- Copy
.env.exampleto.envand set both variables - 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:
-tor--transport: Specify the transport type, options arestdioorsse(default issse)-por--port: Specify the port for the SSE server to listen on (default is8080)
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
https://github.com/overstarry/qweather-mcp-go/releases/download/v2.0.0/qweather-mcp-go.mcpb# mcpb: https://github.com/overstarry/qweather-mcp-go/releases/download/v2.0.0/qweather-mcp-go.mcpb