Prepare the server locally
Run this once before adding it to Claude Code.
git clone https://github.com/zhenkai-dev/weather-by-met.git
cd weather-by-met
pip install -r requirements.txtRegister it in Claude Code
claude mcp add -e "DB_HOST=${DB_HOST}" -e "DB_USER=${DB_USER}" -e "DB_PASSWORD=${DB_PASSWORD}" -e "DB_NAME=${DB_NAME}" malaysian-weather -- python /path/to/weather-by-met/server.pyReplace any placeholder paths in the command with the real path on your machine.
DB_HOSTDB_USERDB_PASSWORDDB_NAMEMake your agent remember this setup
malaysian-weather's config, env vars, and the gotchas you hit — recalled in every future Claude Code, Cursor, and Codex session.
npx conare@latestFree · one command · indexes the sessions already on disk. Set up in the browser instead →
What it does
- Real-time weather data updates every 15 minutes
- Access to 7-day weather forecasts
- Multi-location support for states, districts, and towns across Malaysia
- Efficient MySQL storage with automatic data cleanup
- Telegram error notifications for system monitoring
Tools 2
check_weather_todayFetches the current weather conditions for a specified location in Malaysia.check_7day_forecastRetrieves a seven-day weather forecast for a specified location in Malaysia.Environment Variables
DB_HOSTrequiredMySQL database host addressDB_USERrequiredMySQL database usernameDB_PASSWORDrequiredMySQL database passwordDB_NAMErequiredMySQL database nameTry it
Original README from zhenkai-dev/weather-by-met
🌦️ Malaysian Weather MCP Server
A production-ready MCP (Model Context Protocol) server that brings real-time Malaysian weather forecasts to your favorite AI assistant.
This project implements a local MCP server that fetches live weather data from MET Malaysia's API and integrates it seamlessly with any MCP-compatible client (Claude Desktop, Cursor, Cline, etc.). Users can ask their AI assistant about Malaysian weather in natural language, and it will use this server to fetch accurate, up-to-date forecasts.
What is MCP?
Model Context Protocol (MCP) is a standard that allows AI assistants to interact with external tools and services. By integrating this MCP server with your AI assistant, you enable it to:
- Query real-time weather data
- Access current and future forecasts for any Malaysian location
- Provide weather information in natural conversation
- Use weather data to inform responses and recommendations
What This Project Does
- Fetches Weather Data: Automatically updates Malaysian weather forecasts from MET Malaysia every 15 minutes
- Exposes MCP Tools: Provides two tools (
check_weather_today,check_7day_forecast) that your AI assistant can call - Manages Data: Stores forecasts in a local MySQL database with automatic cleanup
- Runs Locally: Everything runs on your machine - no cloud dependencies
- Works with Any MCP Client: Add a simple config to your favorite AI tool and start asking about weather!
Quick Overview
┌─────────────────────────────────────────────────────┐
│ Your Local Machine │
├─────────────────────────────────────────────────────┤
│ Your MCP Client (Claude, Cursor, Cline, etc) │
│ ↓ │
│ MCP Server (weather-by-met) ← This Project │
│ ├─ server.py (MCP server) │
│ ├─ scheduler.py (Updates weather data) │
│ └─ MySQL DB (Stores forecasts) │
│ ↓ │
│ MET Malaysia API (weather data source) │
└─────────────────────────────────────────────────────┘
User: "What's the weather in Kuala Lumpur?"
↓
AI asks MCP Server → MCP queries database → AI responds
🎯 Features
- Real-time Weather Data: Automatically fetches weather forecasts every 15 minutes
- 7-Day Forecasts: Access forecasts for up to 7 days ahead
- Multi-Location Support: Query weather for states, districts, towns, recreation centres, and divisions across Malaysia
- AI-Friendly Format: Returns structured data that works with any AI assistant
- Optimized Database: Efficient MySQL storage with automatic cleanup of old records
- Telegram Alerts: Error notifications sent to your Telegram channel for immediate awareness
- Production-Ready: Comprehensive error handling and logging
🚀 Quick Start
Get up and running in 5 minutes! This will set everything up locally on your machine.
Prerequisites
Before starting, ensure you have:
- Python 3.8+ - Install from python.org
- MySQL 8.0+ - Install from mysql.com (or use Homebrew:
brew install mysql) - An MCP Client - One of: Claude Desktop, Cursor IDE, Cline VSCode extension, or any MCP-compatible client
- Git - For cloning this repository
Installation Steps
Step 1: Clone the Repository
git clone https://github.com/zhenkai-dev/weather-by-met.git
cd weather-by-met
Step 2: Install Python Dependencies
pip install -r requirements.txt
This installs:
fastmcp- MCP server frameworkmysql-connector-python- MySQL database driverpydantic- Input validationrequests- For API calls- And other utilities
Step 3: Set Up MySQL Database
# Create a .env file from the template
cp .env.example .env
Now edit .env with your MySQL credentials:
# macOS/Linux
nano .env
# Windows - use Notepad or your editor
Content of .env:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password_here
DB_NAME=weather_by_met
Then initialize the database:
python init_db.py
This creates the weather_by_met database and weather_forecasts table automatically.
Step 4: Start the Scheduler (Keep Running)
In one terminal, start the scheduler to fetch weather data:
python scheduler.py
You'll see output like:
[2025-11-10 10:30:00] Starting scheduler...
[2025-11-10 10:30:05] ✓ Fetched weather for 38 locations
[2025-11-10 10:30:07] ✓ Scheduler ready - will update every 15 minutes
Keep this terminal running in the background. It will:
- Fetch weather data immediately
- Update every 15 minutes automatically
- Clean old records daily at 12:05 AM (Malaysia Time)
Step 5: Configure Your MCP Client
Choose your MCP client below and follow the configuration steps.
Option A: Claude Desktop
Step 5.1: Open config file
macOS/Linux: ```b