MCP-Based Weather Information System
Provides current weather information for any location and generates AI-powered responses using Google Gemini through FastMCP.
README
MCP-Based Weather Information System
A Python-based project that provides weather information using MCP tools and includes a simple web dashboard for viewing weather details. The project integrates WeatherAPI for live weather data and Google Gemini API for AI-powered responses through FastMCP.
Features
-
MCP Server
-
Retrieves current weather information for any location.
-
Generates AI-powered responses using Google Gemini.
-
Weather Dashboard
-
Provides an interactive and user-friendly interface.
-
Displays weather details for the selected city instantly.
Project Structure
MCP/
├── my_mcp_server.py # MCP and HTTP server
├── weather_dashboard.py # Weather dashboard UI
├── weather.html # Legacy static page
├── .env # API keys and setup
└── venv/ # Virtual environment
Requirements
- Python 3.10 or higher
- WeatherAPI API key
- Google Gemini API key
Installation
1. Create a Virtual Environment
python -m venv venv
.\venv\Scripts\Activate.ps1
2. Install Dependencies
pip install mcp python-dotenv requests google-genai
3. Create a .env File
GOOGLE_API_KEY=your_google_api_key
WEATHER_API_KEY=your_weather_api_key
WEATHER_API_BASE_URL=https://api.weatherapi.com/v1
MCP_SERVER_PORT=8001
HTTP_SERVER_PORT=8002
WEATHER_DASHBOARD_PORT=8080
Running the Weather Dashboard
Start the dashboard:
python weather_dashboard.py
Open:
http://localhost:8080
Steps
- Enter a location (e.g., Delhi).
- Click the Get Weather button.
- View weather details instantly.
Running the MCP Server
Start the server:
python my_mcp_server.py
Health Check
curl http://localhost:8002/health
Example Tool Request
curl -X POST http://localhost:8002/ `
-H "Content-Type: application/json" `
-d '{"tool":"get_current_weather","args":{"location":"London"}}'
Available MCP Tools
| Tool | Description |
|---|---|
get_current_weather |
Returns current weather information for a location. |
generate_gemini_response |
Generates AI-powered responses using Google Gemini. |
Notes
- Use accurate city names for better results.
- Keep the .env file secure and private.
Technologies Used
- Python – Core programming language used for developing the application.
- FastMCP – Framework used to create and manage MCP tools and services.
- Requests – Python library used for making HTTP requests to external APIs.
- Python Dotenv – Used to load environment variables from a .env file.
- Google Gemini API – Used to generate AI-powered text responses.
- WeatherAPI – Provides real-time weather data for different locations.
- HTML, CSS, and JavaScript – Used to create an interactive web interface.
Project Results
Image 1: Weather Dashboard Home Interface
<p align="center"> <img width="492" height="382" src="https://github.com/user-attachments/assets/fda6c3a6-8592-41e6-9ef4-e2faa5ac4517" alt="Image"> </p>
Image 2: Real-Time Weather Information Interface
<p align="center"> <img width="492" height="382" src="https://github.com/user-attachments/assets/0c0dccf4-2883-4533-8772-32f3ad549974" alt="Image"> </p>
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.