Malaysian Weather MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/zhenkai-dev/weather-by-met.git
cd weather-by-met
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
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 "<FULL_PATH_TO_WEATHER_BY_MET>/dist/index.js"

Replace <FULL_PATH_TO_WEATHER_BY_MET>/dist/index.js with the actual folder you prepared in step 1.

Required:DB_HOSTDB_USERDB_PASSWORDDB_NAME
README.md

Real-time weather forecasts for locations across Malaysia from MET Malaysia

šŸŒ¦ļø 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

  1. Fetches Weather Data: Automatically updates Malaysian weather forecasts from MET Malaysia every 15 minutes
  2. Exposes MCP Tools: Provides two tools (check_weather_today, check_7day_forecast) that your AI assistant can call
  3. Manages Data: Stores forecasts in a local MySQL database with automatic cleanup
  4. Runs Locally: Everything runs on your machine - no cloud dependencies
  5. 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 framework
  • mysql-connector-python - MySQL database driver
  • pydantic - Input validation
  • requests - 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

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 address
DB_USERrequiredMySQL database username
DB_PASSWORDrequiredMySQL database password
DB_NAMErequiredMySQL database name

Configuration

claude_desktop_config.json
{"mcpServers": {"weather-by-met": {"command": "python", "args": ["/path/to/weather-by-met/server.py"]}}}

Try it

→What is the weather like in Kuala Lumpur today?
→Can you give me the 7-day weather forecast for Penang?
→Is it going to rain in Johor Bahru this week?
→Check the current weather conditions for Kuching.

Frequently Asked Questions

What are the key features of Malaysian Weather MCP Server?

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.

What can I use Malaysian Weather MCP Server for?

Planning outdoor activities in Malaysia based on accurate 7-day forecasts. Integrating local weather data into AI-driven travel planning assistants. Automating weather status reports for Malaysian regional operations. Providing quick, natural language weather updates to users in Malaysia.

How do I install Malaysian Weather MCP Server?

Install Malaysian Weather MCP Server by running: git clone https://github.com/zhenkai-dev/weather-by-met.git && cd weather-by-met && pip install -r requirements.txt

What MCP clients work with Malaysian Weather MCP Server?

Malaysian Weather MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Malaysian Weather MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare