Weather MCP Server

Weather MCP Server

Enables AI assistants to fetch real-time weather data, forecasts up to 10 days, and compare weather conditions between cities using WeatherAPI.com with support for both Celsius and Fahrenheit units.

Category
Visit Server

README

Weather MCP Server ๐ŸŒค๏ธ

A Model Context Protocol (MCP) server that provides weather information tools. This server enables AI assistants like Claude to fetch real-time weather data, forecasts, and compare weather across different cities.

Features

  • Current Weather: Get real-time weather information for any city
  • Weather Forecast: Get weather predictions for up to 10 days (based on API plan)
  • Weather Comparison: Compare weather conditions between two cities
  • Supports both Celsius (metric) and Fahrenheit (imperial) units

Prerequisites

  • Python 3.8 or higher
  • WeatherAPI.com API key (free tier available)

Installation

  1. Clone the repository

    git clone https://github.com/Abhishek3689/Weather_MCP_Server.git
    cd weather-mcp-server
    
  2. Install dependencies

    pip install -r requirements.txt
    
  3. Set up environment variables

    Create a .env file in the project root:

    WEATHER_API_KEY=your_api_key_here
    

    Get your free API key from WeatherAPI.com

Usage

๐Ÿš€ Running The Server (Important!) ๐Ÿ‘‰ If you double-click or run the file, you will NOT see results.

MCP servers do not show output directly.

They wait for Claude to connect to them.

But you can still start the server manually to ensure itโ€™s working:

python weather_server_mcp.py

You would see somthing like this it means server is running correclty

          โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
          โ”‚                                                                              โ”‚
          โ”‚                         โ–„โ–€โ–€ โ–„โ–€โ–ˆ โ–ˆโ–€โ–€ โ–€โ–ˆโ–€ โ–ˆโ–€โ–„โ–€โ–ˆ โ–ˆโ–€โ–€ โ–ˆโ–€โ–ˆ                        โ”‚
          โ”‚                         โ–ˆโ–€  โ–ˆโ–€โ–ˆ โ–„โ–„โ–ˆ  โ–ˆ  โ–ˆ โ–€ โ–ˆ โ–ˆโ–„โ–„ โ–ˆโ–€โ–€                        โ”‚
          โ”‚                                                                              โ”‚
          โ”‚                                FastMCP 2.13.1                                โ”‚
          โ”‚                                                                              โ”‚
          โ”‚                                                                              โ”‚
          โ”‚                    ๐Ÿ–ฅ  Server name: Weather Server                            โ”‚
          โ”‚                                                                              โ”‚
          โ”‚                    ๐Ÿ“ฆ Transport:   STDIO                                     โ”‚
          โ”‚                                                                              โ”‚
          โ”‚                    ๐Ÿ“š Docs:        https://gofastmcp.com                     โ”‚
          โ”‚                    ๐Ÿš€ Hosting:     https://fastmcp.cloud                     โ”‚
          โ”‚                                                                              โ”‚
          โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Integration with Claude Desktop

To use this server with Claude Desktop, add the following to your Claude Desktop configuration:

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

On Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "python",
      "args": [
        "weather_server_mcp.py"
      ],
      "env": {
        "WEATHER_API_KEY": "your_api_key_here"
      }
    }
  }
}

Note : for 'command' write absolute location instead of only "python" by checking using in command prompt

where python

you will see somthing like this

C:\Users\YourName\AppData\Local\Programs\Python\Python312\python.exe

After updating the config, restart Claude Desktop.

Available Tools

1. Get Current Weather

get_current_weather(city: str, units: str = "metric")
  • city: City name (e.g., 'London', 'New York', 'Tokyo')
  • units: 'metric' for Celsius or 'imperial' for Fahrenheit

Example:

get_current_weather("London", "metric")

2. Get Weather Forecast

get_forecast(city: str, days: int = 3, units: str = "metric")
  • city: City name
  • days: Number of forecast days (1-10)
  • units: Temperature units

Example:

get_forecast("Paris", days=5, units="metric")

3. Compare Weather

compare_weather(city1: str, city2: str, units: str = "metric")
  • city1: First city name
  • city2: Second city name
  • units: Temperature units

Example:

compare_weather("Tokyo", "New York", "metric")

Project Structure

weather-mcp-server/
โ”œโ”€โ”€ weather_server_mcp.py   # Main MCP server implementation
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ .env                    # Environment variables (not committed)
โ”œโ”€โ”€ .gitignore             # Git ignore file
โ””โ”€โ”€ README.md              # This file

API Information

This project uses the WeatherAPI.com service:

  • Free tier: 1,000,000 calls/month
  • 3-day forecast on free plan
  • Real-time weather data
  • Historical weather data

Example Output

Current Weather in London, United Kingdom

๐Ÿ“ Location: 51.52, -0.11
๐ŸŒก๏ธ  Temperature: 15ยฐC
๐Ÿค” Feels Like: 14ยฐC
โ˜๏ธ  Condition: Partly cloudy
๐Ÿ’ง Humidity: 72%
๐Ÿ”ฝ Pressure: 1013.0 hPa
๐Ÿ’จ Wind Speed: 15.1 kph
โ˜๏ธ  Cloudiness: 25%
๐Ÿ‘๏ธ  Visibility: 10.0 km

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Troubleshooting

"WEATHER_API_KEY environment variable not set"

  • Make sure you've created a .env file with your API key
  • Or set the environment variable in your system/Claude config

"HTTP Error: 401"

  • Check that your API key is valid
  • Ensure the API key is correctly set in your .env file

"Only X days available"

  • Free tier of WeatherAPI.com provides 3-day forecasts
  • Upgrade to a paid plan for extended forecasts

Support

If you encounter any issues or have questions:

Author

Project Link: https://github.com/Abhishek3689/Weather_MCP_Server

Acknowledgments

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured