Complete Guide: Setting Up WeatherAPI MCP Server in Claude Desktop
The WeatherAPI Model Context Protocol (MCP) server brings real-time weather data directly into your Claude Desktop conversations, enabling seamless weather queries without leaving your AI workspace. This comprehensive guide walks you through the complete setup process, from installation to advanced usage examples.
What is the WeatherAPI MCP Server?
MCP (Model Context Protocol) is Anthropic’s open standard that allows AI assistants like Claude to connect with external data sources and tools. Our WeatherAPI MCP server provides Claude Desktop with direct access to WeatherAPI’s comprehensive weather data, including current conditions, forecasts, historical data, and specialized information like marine conditions and astronomical data.
The server acts as a bridge between Claude and WeatherAPI’s 4M+ location database, giving you instant access to weather information for any location worldwide without manual API calls or code execution.
Prerequisites
Before beginning the setup, ensure you have:
- Claude Desktop installed on your system
- Node.js version 16 or higher
- WeatherAPI account with an active API key (sign up free at weatherapi.com/signup.aspx)
- Basic familiarity with command line operations
Step 1: Install the WeatherAPI MCP Server
The WeatherAPI MCP server can be installed globally using npx, which eliminates the need for local installation and dependency management.
Open your terminal and verify the server is available:
npx weatherapi-mcp --help
This command downloads and runs the latest version of the WeatherAPI MCP server, displaying available options and confirming successful installation.
Step 2: Configure Claude Desktop
Claude Desktop uses a configuration file to manage MCP servers. The configuration 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"
}
}
}
}
Important: Replace your_api_key_here with your actual WeatherAPI key. Never commit this file to version control or share it publicly.
Alternative Configuration Methods
For enhanced security, you can set your API key as a system environment variable instead of including it in the configuration file:
# Set environment variable (macOS/Linux)
export WEATHERAPI_KEY=your_api_key_here
# Windows Command Prompt
set WEATHERAPI_KEY=your_api_key_here
# Windows PowerShell
$env:WEATHERAPI_KEY="your_api_key_here"
Then modify your configuration to omit the env section:
{
"mcpServers": {
"weatherapi": {
"command": "npx",
"args": ["weatherapi-mcp"]
}
}
}
Step 3: Restart Claude Desktop
After saving the configuration file, completely restart Claude Desktop to load the new MCP server. The restart process ensures Claude establishes a fresh connection with the WeatherAPI MCP server.
Upon successful configuration, you should see the WeatherAPI tools become available in your Claude conversation interface, typically indicated by a tools or integrations panel.
Step 4: Verify the Setup
Test your configuration with a simple weather query. Start a new conversation in Claude Desktop and try:
“What’s the current weather in New York City?”
If configured correctly, Claude will use the WeatherAPI MCP server to fetch real-time weather data and provide a comprehensive response including temperature, conditions, humidity, wind speed, and other relevant metrics.
Available WeatherAPI Tools
The WeatherAPI MCP server provides access to multiple specialized tools:
Current Weather Tool
Retrieves real-time weather conditions including temperature, humidity, wind, visibility, UV index, and air quality data.
Weather Forecast Tool
Provides detailed forecasts up to 14 days ahead, including daily summaries and hourly breakdowns for comprehensive weather planning.
Historical Weather Tool
Access historical weather data from January 1, 2010, onwards, perfect for analyzing weather patterns and trends.
Astronomy Tool
Delivers sunrise, sunset, moonrise, moonset times, and moon phase information for any location and date.
Location Search Tool
Provides intelligent location search with autocomplete functionality, helping resolve ambiguous location queries.
Example Prompts and Use Cases
Here are practical examples demonstrating the WeatherAPI MCP server’s capabilities:
Basic Weather Queries
“What’s the weather like in Tokyo right now?”
“Show me the 7-day forecast for London, UK”
“What was the weather like in San Francisco on December 25, 2023?”
Advanced Analysis Requests
“Compare the current temperature and humidity between New York, London, and Sydney”
“What are the sunrise and sunset times for Paris this week?”
“Give me a detailed weather analysis for my outdoor event in Chicago this Saturday, including hourly conditions”
Location Intelligence
“Find weather information for airports near Denver and show current visibility conditions”
“What’s the weather forecast for all major cities in California for the next 3 days?”
Troubleshooting Common Issues
Server Not Responding
If the MCP server isn’t responding, verify your API key is correct and active. Check the WeatherAPI dashboard to ensure you haven’t exceeded your plan limits.
Configuration File Issues
Ensure the configuration file path is correct for your operating system and the JSON syntax is valid. Use a JSON validator to check for syntax errors.
Permission Problems
On Unix-based systems, verify the configuration file has appropriate read permissions for the Claude Desktop application.
Network Connectivity
Test direct API connectivity using curl or your preferred HTTP client:
curl "https://api.weatherapi.com/v1/current.json?key=YOUR_API_KEY&q=London"
Best Practices and Tips
API Key Security
Store your WeatherAPI key securely and never hardcode it in shared files. Consider using environment variables or secure credential management systems.
Efficient Queries
Be specific with location names to avoid ambiguity. Include country codes or states when dealing with common city names.
Rate Limit Management
Monitor your API usage through the WeatherAPI dashboard. The free plan includes 100,000 calls per month, which is generous for most development and personal use cases.
Next Steps and Advanced Usage
With the WeatherAPI MCP server configured, you can explore advanced use cases like:
- Building weather-aware applications using Claude’s analysis capabilities
- Creating comprehensive weather reports for multiple locations
- Analyzing historical weather patterns and trends
- Integrating weather data into project planning and decision-making workflows
The WeatherAPI MCP server transforms Claude Desktop into a powerful weather intelligence tool, providing instant access to comprehensive meteorological data without leaving your AI workspace.
Ready to get started? Sign up for your free WeatherAPI account today and unlock the power of weather data in Claude Desktop. With 100,000 free API calls per month and no credit card required, you can begin integrating weather intelligence into your AI workflows immediately.
