- Home
- MCP servers
- Weather
Weather
- typescript
31
GitHub Stars
typescript
Language
4 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You use the MCP Weather Server to fetch real-time hourly and daily forecasts from AccuWeather for use with language models and other MCP-compatible clients. It exposes hourly data for the next 12 hours and daily forecasts for up to 15 days, with both metric and imperial units available. This enables your models to ask for weather information and get precise, up-to-date responses.
How to use
Once the MCP Weather Server is running, you can access two main capabilities through your MCP client: the hourly forecast tool and the daily forecast tool. Use the hourly tool to retrieve forecasts for the next 12 hours for a given location, and use the daily tool to get multi-day forecasts up to 15 days. You can switch between metric and imperial units to display temperatures in Celsius or Fahrenheit as needed.
How to install
Prerequisites: you need Node.js version 18 or newer and an AccuWeather API key.
- Clone the project repository.
git clone https://github.com/TimLukaHorstmann/mcp-weather.git
cd mcp-weather
- Install dependencies.
npm install
-
Obtain an AccuWeather API key by registering for the API and creating an app.
-
Create a .env file and add your API key.
ACCUWEATHER_API_KEY=your_api_key_here
- Build the project.
npm run build
- Start the MCP Weather Server directly.
npx -y @timlukahorstmann/mcp-weather
- If you want HTTP/REST access via a gateway, run the gateway with the MCP server wired in.
npx -y supergateway --stdio "npx -y @timlukahorstmann/mcp-weather" \
--port 4004 \
--baseUrl http://127.0.0.1:4004 \
--ssePath /messages \
--messagePath /message \
--cors "*" \
--env ACCUWEATHER_API_KEY="$ACCUWEATHER_API_KEY"
Config examples for MCP clients
{
"mcpServers": {
"weather": {
"type": "http",
"name": "weather_http",
"url": "http://127.0.0.1:4004/mcp",
"args": []
},
"weather_stdio": {
"type": "stdio",
"name": "weather_stdio",
"command": "npx",
"args": ["-y", "@timlukahorstmann/mcp-weather"],
"env": {
"ACCUWEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Claude Desktop integration
If you want to use Claude Desktop with the MCP Weather Server, configure Claude Desktop to launch the MCP server as a tool. Create or edit your Claude Desktop config to include an entry for the weather server that runs via npm and passes your API key.
Example Claude Desktop configuration snippet:
{
"mcpServers": {
"weather": {
"command": "npx",
"args": ["-y", "@timlukahorstmann/mcp-weather"],
"env": {
"ACCUWEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Usage notes and capabilities
You will have access to two tools from the MCP Weather Server within your MCP client: the hourly forecast tool and the daily forecast tool.
Hourly tool: weather-get_hourly — provides hourly forecasts for the next 12 hours. Required parameter: location. Optional: units (metric or imperial).
Daily tool: weather-get_daily — provides daily forecasts for up to 15 days. Required parameter: location. Optional: days (1, 5, 10, 15) and units (metric or imperial).
Development
Install development dependencies, lint, build, run tests, and start in development mode as needed.
npm install
npm run lint
npm run build
npm test
npm run dev
Notes on configuration and usage
Environment variables are required for the AccuWeather API key and must be supplied in the environment where the MCP Weather Server runs.
The HTTP gateway example uses a local port (4004) and base URL. You can access the MCP via the provided base URL and path mappings.
Troubleshooting
If you encounter API key errors, double-check that ACCUWEATHER_API_KEY is correctly set in your environment or in the .env file that you created.
If the gateway cannot reach the MCP Weather Server, ensure the server is running and that the port and base URL match the gateway configuration.
Changelog
0.4.0 removes the sessionId requirement from all tools to simplify integrations.
License
This project is licensed under the MIT License.
Available tools
weather-get_hourly
Provides hourly forecasts for the next 12 hours. Parameters: location (required), units (optional: metric or imperial).
weather-get_daily
Provides daily forecasts for up to 15 days. Parameters: location (required), days (optional: 1, 5, 10, 15), units (optional: metric or imperial).