WeatherAPI MCP Server: Claude AI Weather Integration Guide

WeatherAPI MCP Server: Claude AI Weather Integration Guide

Artificial intelligence assistants are becoming increasingly sophisticated, but they often lack real-time contextual data that could make their responses more accurate and actionable. The Model Context Protocol (MCP) bridges this gap by allowing AI models like Claude to access live data sources during conversations. WeatherAPI.com has developed a dedicated MCP server that enables Claude to fetch real-time weather data, forecasts, and historical information directly within chat sessions.

This comprehensive guide will walk you through setting up and using WeatherAPI’s MCP server with Claude, transforming your AI assistant into a weather-aware powerhouse capable of providing location-specific meteorological insights in real-time.

Understanding the Model Context Protocol

The Model Context Protocol is an open standard that enables AI models to securely connect with external data sources and tools. Unlike traditional API integrations that require custom code for each service, MCP provides a standardized way for AI assistants to interact with various data providers.

WeatherAPI’s MCP server implementation offers several key advantages:

  • Real-time data access: Claude can fetch current weather conditions without leaving the conversation
  • Contextual responses: Weather data is integrated seamlessly into Claude’s responses
  • No custom coding: Setup requires minimal configuration rather than API integration code
  • Secure authentication: Your WeatherAPI key remains protected within the MCP server

Prerequisites and Setup Requirements

Before implementing the WeatherAPI MCP server, ensure you have the following components ready:

  • Claude Desktop Application: Download and install Claude Desktop from Anthropic
  • WeatherAPI Account: Sign up for a free WeatherAPI account to obtain your API key
  • Node.js: Version 16 or higher installed on your system
  • NPM/NPX: Package manager for installing the MCP server

Installing WeatherAPI MCP Server

WeatherAPI provides a pre-built MCP server package that can be installed and configured with minimal setup. The server runs locally on your machine and communicates with both Claude Desktop and the WeatherAPI service.

Quick Installation

The fastest way to get started is using NPX, which downloads and runs the MCP server without permanent installation:

npx weatherapi-mcp

For permanent installation, use NPM to install the package globally:

npm install -g @weatherapi/mcp-server

Configuring Claude Desktop

Claude Desktop uses a configuration file to manage MCP server connections. The configuration file location varies by operating system:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Create or edit this configuration file with the following structure:

{
  "mcpServers": {
    "weatherapi": {
      "command": "npx",
      "args": ["weatherapi-mcp"],
      "env": {
        "WEATHERAPI_KEY": "your_api_key_here"
      }
    }
  }
}

Replace your_api_key_here with your actual WeatherAPI key from your account dashboard. If you installed the package globally, you can alternatively use:

{
  "mcpServers": {
    "weatherapi": {
      "command": "weatherapi-mcp",
      "env": {
        "WEATHERAPI_KEY": "your_api_key_here"
      }
    }
  }
}

Available MCP Tools and Functions

The WeatherAPI MCP server exposes several tools that Claude can use to fetch weather information. Each tool corresponds to specific WeatherAPI endpoints and provides different types of meteorological data.

Current Weather Tool

The current weather tool fetches real-time conditions for any location worldwide:

  • Temperature: Current, feels-like, and heat index values
  • Atmospheric conditions: Humidity, pressure, visibility
  • Wind data: Speed, direction, and gust information
  • Precipitation: Current rainfall or snowfall rates
  • Air quality: AQI index and pollutant levels
  • UV index: Current ultraviolet radiation levels

Forecast Tool

The forecast tool provides detailed weather predictions up to 14 days ahead:

  • Daily forecasts: High/low temperatures, conditions, precipitation probability
  • Hourly breakdown: Temperature, humidity, wind, and precipitation by hour
  • Extended outlook: Multi-day trend analysis and severe weather alerts

Historical Weather Tool

Access historical weather data dating back to January 1, 2010:

  • Past conditions: Temperature, precipitation, and weather patterns
  • Climate analysis: Long-term trends and anomalies
  • Comparative data: Year-over-year weather comparisons

Marine Weather Tool

Specialized marine conditions for coastal and offshore locations:

  • Wave data: Height, period, and swell information
  • Water conditions: Temperature and visibility
  • Tide information: High/low tide times and heights

Practical Use Cases and Examples

Once configured, Claude can seamlessly integrate weather data into conversations. Here are practical examples of how the MCP server enhances AI interactions:

Travel Planning Assistant

Claude can provide comprehensive travel weather advice by combining current conditions with forecast data:

User: “I’m traveling to London next week. Should I pack an umbrella?”

Claude with WeatherAPI MCP: “Let me check the forecast for London next week. Based on the 7-day forecast, there’s a 70% chance of rain on Tuesday and Wednesday, with light showers expected. I’d definitely recommend packing an umbrella, and also consider bringing a light waterproof jacket as temperatures will be around 12°C with moderate winds.”

Agricultural Decision Support

Farmers and agricultural professionals can receive weather-informed recommendations:

User: “Is today suitable for spraying pesticides in Iowa?”

Claude with WeatherAPI MCP: “Checking current conditions in Iowa… Today shows winds at 8 mph with gusts up to 12 mph, humidity at 65%, and no precipitation expected for the next 6 hours. These conditions are borderline for pesticide application. The wind speed is acceptable, but I’d recommend waiting until later this afternoon when wind speeds are forecast to decrease to 5 mph for more precise application.”

Event Planning Intelligence

Event organizers can make informed decisions about outdoor activities:

User: “We’re planning an outdoor wedding in Phoenix this Saturday. What should we prepare for?”

Claude with WeatherAPI MCP: “The forecast for Phoenix this Saturday shows sunny skies with a high of 28°C and low humidity. However, UV index will be very high at level 9, so consider providing shade structures for guests. Evening temperatures will drop to a comfortable 19°C with light winds, making it perfect for an outdoor reception. No precipitation expected.”

Advanced Configuration Options

The WeatherAPI MCP server supports several configuration options for customizing behavior and performance:

Custom Configuration File

Create a dedicated configuration file for more complex setups:

{
  "mcpServers": {
    "weatherapi": {
      "command": "npx",
      "args": ["weatherapi-mcp", "--config", "/path/to/config.json"],
      "env": {
        "WEATHERAPI_KEY": "your_api_key_here",
        "CACHE_DURATION": "300",
        "DEFAULT_UNITS": "metric",
        "MAX_FORECAST_DAYS": "10"
      }
    }
  }
}

Environment Variables

The MCP server recognizes several environment variables for customization:

  • WEATHERAPI_KEY: Your WeatherAPI authentication key (required)
  • CACHE_DURATION: Response cache duration in seconds (default: 300)
  • DEFAULT_UNITS: Temperature units – metric, imperial, or auto (default: metric)
  • MAX_FORECAST_DAYS: Maximum forecast period (default: 14)
  • DEBUG_MODE: Enable detailed logging (default: false)

Troubleshooting Common Issues

While the WeatherAPI MCP server is designed for seamless operation, here are solutions to common setup problems:

Connection Issues

If Claude cannot connect to the MCP server:

  • Verify your WeatherAPI key is correctly set in the environment variables
  • Ensure Node.js is installed and accessible from the command line
  • Check that the configuration file path is correct for your operating system
  • Restart Claude Desktop after making configuration changes

API Key Validation

To verify your WeatherAPI key is working, test it directly:

curl "https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London"

Replace YOUR_API_KEY with your actual key. A successful response indicates your key is valid and active.

Performance Optimization

For optimal performance, consider these configuration adjustments:

  • Cache duration: Increase cache time for frequently requested locations
  • Request limiting: Be mindful of your plan’s rate limits
  • Location specificity: Use precise location queries to avoid ambiguity

Security and Best Practices

When deploying the WeatherAPI MCP server, follow these security best practices:

  • API key protection: Store your WeatherAPI key securely in environment variables
  • Local execution: The MCP server runs locally, keeping your data secure
  • Regular updates: Keep the MCP server package updated for security patches
  • Monitor usage: Track API usage through your WeatherAPI dashboard

Getting Started Today

The WeatherAPI MCP server transforms Claude into a weather-intelligent assistant capable of providing real-time meteorological context for any conversation. Whether you’re building decision support systems, travel applications, or agricultural tools, this integration provides immediate access to comprehensive weather data.

Ready to enhance your AI assistant with real-time weather capabilities? Sign up for your free WeatherAPI account today and start building weather-aware AI applications. With 100,000 free API calls per month and no credit card required, you can experiment with the MCP server integration and explore the full potential of weather-enhanced AI interactions.

The combination of Claude’s conversational AI and WeatherAPI’s comprehensive meteorological data opens new possibilities for intelligent, context-aware applications that understand and respond to real-world weather conditions.

Scroll to Top