mcp-weather-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-weather-serverwhat's the weather in Seattle?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Weather MCP Server π€οΈ written in TypeScript
A Model Context Protocol (MCP) server that provides real-time weather information, forecasts, and alerts using the National Weather Service API and WeatherAPI.com.
Features
π€οΈ Current Weather - Get real-time weather conditions for any location worldwide
π 5-Day Forecasts - Detailed weather forecasts with temperature, wind, and conditions
β οΈ Weather Alerts - Active weather alerts and warnings for US states
π Global Support - Location search via geocoding (city names, landmarks, etc.)
π Type-Safe - Built with TypeScript for reliability
Related MCP server: Weather Alerts MCP Server
Prerequisites
Node.js 18+
npm or yarn
A free API key from WeatherAPI.com
Installation
# Clone the repository
git clone https://github.com/YOUR_USERNAME/weather-mcp-server.git
cd weather-mcp-server
# Install dependencies
npm install
# Create environment file
cp .env.example .env
Configuration
Sign up for a free API key at WeatherAPI.com
Edit .env and add your API key:
env
WEATHER_API_KEY=your_api_key_here
Usage
Development Mode (TypeScript)
bash
npm run dev
Production Build
bash
# Build the project
npm run build
# Run the built version
npm start
Testing with MCP Inspector
bash
# Test with TypeScript source
npm run inspect
# Test with built JavaScript
npm run inspect-built
Integration
Cline (VS Code Extension)
Add to %APPDATA%\Code\User\globalStorage\cline.cline\settings\cline_mcp_settings.json:
json
{
"mcpServers": {
"weather-server": {
"command": "node",
"args": [
"C:\\path\\to\\weather-server\\build\\index.js"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json:
json
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"C:\\path\\to\\weather-server\\build\\index.js"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here"
}
}
}
}
Available Tools
get_current_weather
Get current weather conditions for any location.
Input:
json{
"name": "London"
}
Output:
json
{
"location": "London",
"coordinates": { "lat": 51.5074, "lon": -0.1278 },
"temperature": 72,
"temperatureUnit": "F",
"windSpeed": "10 mph",
"windDirection": "SW",
"shortForecast": "Partly Cloudy",
"detailedForecast": "Partly cloudy with a high near 72..."
}
get_forecast
Get 5-day weather forecast for any location.
Input:
json
{
"name": "New York"
}
Output:
json
{
"location": "New York",
"coordinates": { "lat": 40.7128, "lon": -74.0060 },
"forecast": [
{
"name": "Tonight",
"temperature": 45,
"temperatureUnit": "F",
"windSpeed": "5 mph",
"windDirection": "N",
"shortForecast": "Clear",
"detailedForecast": "Clear skies with low around 45..."
}
// ... more periods
]
}
get-alerts
Get active weather alerts for US states.
Input:
json
{
"state": "CA"
}
Output:
json
{
"state": "CA",
"alerts": [
{
"event": "Heat Advisory",
"headline": "Heat Advisory issued June 15...",
"severity": "Moderate",
"urgency": "Expected",
"certainty": "Likely",
"areaDesc": "Los Angeles County"
}
]
}
Development
Project Structure
weather-server/
βββ src/
β βββ index.ts # TypeScript source code
βββ build/
β βββ index.js # Compiled JavaScript (generated)
βββ .env # Environment variables (not in git)
βββ .env.example # Example environment file
βββ .gitignore # Git ignore rules
βββ package.json # Dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
Scripts
bash
npm run dev # Run in development mode with tsx
npm run build # Build TypeScript to JavaScript
npm start # Run built JavaScript version
npm run inspect # Test with MCP Inspector (TypeScript)
npm run inspect-built # Test with MCP Inspector (JavaScript)
APIs Used
- National Weather Service API - Free US weather data
- WeatherAPI.com - Global geocoding and location search
Limitations
- Weather alerts (get-alerts) only work for US locations (NWS limitation)
- Current weather and forecasts are US-focused but work globally via geocoding
- Rate limits apply based on your WeatherAPI.com plan (free tier: 1M calls/month)
Troubleshooting
"WEATHER_API_KEY environment variable is required"
- Make sure .env file exists with valid API key
- Check that the key is not expired
"This location might not be supported by the NWS API"
- NWS only covers US locations for detailed forecasts
- Try a US city or use the geocoding to verify location
Type errors in development
- Run npm install to ensure all dependencies are installed
- Check that TypeScript version is 5.7+ with npx tsc --version
## Cline/Claude Desktop Integration
### Cline (VS Code Extension)
**Config Location (depends on Cline version):**
- **Newer versions:** `%APPDATA%\Code\User\globalStorage\cline.cline\settings\cline_mcp_settings.json`
- **Older versions:** `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`
**Configuration:**
```json
{
"mcpServers": {
"weather-server": {
"command": "node",
"args": [
"C:\\path\\to\\weather-server\\build\\index.js"
],
"env": {
"WEATHER_API_KEY": "your_api_key_here"
},
"autoApprove": [
"get_current_weather",
"get_forecast",
"get-alerts"
]
}
}
}
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (git checkout -b feature/AmazingFeature)
- Commit your changes (git commit -m 'Add some AmazingFeature')
- Push to the branch (git push origin feature/AmazingFeature)
- Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Herman Adu
Acknowledgments
- Model Context Protocol by Anthropic
- National Weather Service API
- WeatherAPI.com
Support
If you have questions or need help:
- Open an issue on GitHub
- Check the MCP Documentation
Built with β€οΈ using the Model Context Protocol
---This server cannot be deployed
Maintenance
Related MCP Connectors
Provide real-time and forecast weather information for locations in the United States using naturaβ¦
Get US weather forecasts, active alerts, and current observations.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
US weather & geo for AI agents: forecasts, alerts, earthquakes, elevation, geocoding. No keys.
Related MCP Servers
- FlicenseBqualityDmaintenanceProvides real-time weather forecasts and alerts for US locations using the National Weather Service API. Supports querying forecasts by coordinates and retrieving active weather alerts by state.2-
- FlicenseAqualityDmaintenanceProvides real-time weather alerts for US states using the National Weather Service API, enabling users to fetch and view active weather warnings through natural language queries.11-
- FlicenseNot gradedqualityDmaintenanceEnables users to get weather forecasts and alerts for any US city and state through natural language queries using the National Weather Service API.-
- FlicenseNot gradedqualityNot gradedmaintenanceProvides real-time weather forecasts and active weather alerts for US locations using the National Weather Service API. It enables users to retrieve detailed local forecasts via coordinates and monitor state-specific weather warnings.98 npm-