Skip to content

kma-mcp

Model Context Protocol (MCP) server for Korea Meteorological Administration API access

Python Version License: MIT

What is kma-mcp?

kma-mcp is a comprehensive MCP (Model Context Protocol) server implementation that provides programmatic access to the Korea Meteorological Administration (KMA) API Hub. It enables developers and researchers to easily access real-time and historical Korean weather data through simple, consistent Python and TypeScript interfaces.

All API implementations are based on the official KMA API Hub specifications and documentation. This ensures compatibility with the official KMA services and provides access to the same comprehensive meteorological data available through the KMA API Hub portal.

Key Features

🌦️ Comprehensive Weather Data Access

  • 21 API clients covering surface observations, marine data, upper-air measurements, radar, satellite imagery, forecasts, warnings, typhoons, earthquakes, aviation weather, and global meteorological data
  • Dual implementations: Python and TypeScript for maximum flexibility
  • 251+ comprehensive tests (198 Python + 53 TypeScript) ensuring reliability

⚑ Multiple Implementation Options

Python Implementation: * Synchronous clients for simple, straightforward operations * Asynchronous clients for high-performance concurrent requests * Context manager support for automatic resource cleanup * 42 total clients (21 sync + 21 async)

TypeScript Implementation: * Type-safe API clients with full TypeScript support * MCP server built with @modelcontextprotocol/sdk * 21 clients with comprehensive type definitions

🌏 Korean Weather Specialization

  • Korean weather code utilities (wind direction, precipitation types, sky conditions)
  • Automatic enhancement of weather data with Korean-language fields
  • Human-readable Korean weather summaries

πŸ“Š Implementation Status

Coverage: 85% of public KMA API Hub categories (11/13)

Implemented Categories:

  • βœ… Surface Observations (지상관츑) - 10 APIs
  • βœ… Marine Observations (ν•΄μ–‘κ΄€μΈ‘) - 1 API
  • βœ… Upper-Air Observations (κ³ μΈ΅κ΄€μΈ‘) - 1 API
  • βœ… Radar (λ ˆμ΄λ”) - 1 API
  • βœ… Satellite (μœ„μ„±) - 1 API
  • βœ… Earthquakes (μ§€μ§„/ν™”μ‚°) - 1 API
  • βœ… Typhoon (νƒœν’) - 1 API
  • βœ… Forecasts & Warnings (예특보) - 2 APIs
  • βœ… Global Meteorology (세계기상) - 1 API
  • βœ… Aviation Meteorology (항곡기상) - 1 API
  • βœ… Integrated Meteorology (μœ΅ν•©κΈ°μƒ) - 1 API

Not Implemented (no public endpoints):

  • ❌ Numerical Models (수치λͺ¨λΈ)
  • ❌ Industry-Specific APIs (μ‚°μ—…νŠΉν™”)

Quick Start

Installation

# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone repository
git clone https://github.com/appleparan/kma-mcp.git
cd kma-mcp

# Install dependencies
uv sync

Get API Key

  1. Visit the KMA API Hub - the official source for all Korean meteorological data
  2. Create an account and navigate to "λ§ˆμ΄νŽ˜μ΄μ§€" (My Page)
  3. Generate an API key from the API management section
  4. Set your API key:
export KMA_API_KEY='your_key_here'
# Or create a .env file with:
# KMA_API_KEY=your_key_here

Note: The API key from KMA API Hub provides access to all weather data services. All APIs in this package correspond directly to the services available on the KMA API Hub portal.

Basic Usage

from kma_mcp.surface.asos_client import ASOSClient

# Get current weather for Seoul (station 108)
with ASOSClient('your_api_key') as client:
    data = client.get_hourly_data(tm='202501011200', stn=108)
    print(data)

Run MCP Server

uv run python scripts/start_mcp_server.py

Project Structure

kma-mcp/
β”œβ”€β”€ python/                      # Python implementation
β”‚   β”œβ”€β”€ src/kma_mcp/
β”‚   β”‚   β”œβ”€β”€ surface/            # Surface observation clients (10 APIs)
β”‚   β”‚   β”œβ”€β”€ marine/             # Marine observation clients (1 API)
β”‚   β”‚   β”œβ”€β”€ upper_air/          # Upper-air observation clients (1 API)
β”‚   β”‚   β”œβ”€β”€ radar/              # Radar clients (1 API)
β”‚   β”‚   β”œβ”€β”€ satellite/          # Satellite clients (1 API)
β”‚   β”‚   β”œβ”€β”€ earthquake/         # Earthquake clients (1 API)
β”‚   β”‚   β”œβ”€β”€ typhoon/            # Typhoon clients (1 API)
β”‚   β”‚   β”œβ”€β”€ forecast/           # Forecast clients (2 APIs)
β”‚   β”‚   β”œβ”€β”€ global_met/         # Global meteorology clients (1 API)
β”‚   β”‚   β”œβ”€β”€ aviation/           # Aviation meteorology clients (1 API)
β”‚   β”‚   β”œβ”€β”€ integrated/         # Integrated meteorology clients (1 API)
β”‚   β”‚   β”œβ”€β”€ utils/              # Utility modules
β”‚   β”‚   └── mcp_server.py       # Main MCP server
β”‚   └── tests/                  # Python test suite (198 tests)
β”œβ”€β”€ typescript/                  # TypeScript implementation
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ clients/            # TypeScript API clients (21 clients)
β”‚   β”‚   β”‚   β”œβ”€β”€ base.ts         # Base client
β”‚   β”‚   β”‚   β”œβ”€β”€ asos.ts         # ASOS client
β”‚   β”‚   β”‚   β”œβ”€β”€ aws.ts          # AWS client
β”‚   β”‚   β”‚   └── ...             # Other clients
β”‚   β”‚   └── index.ts            # MCP server entry point
β”‚   └── tests/                  # TypeScript test suite (53 tests)
β”œβ”€β”€ docs/                        # Documentation (MkDocs)
β”‚   β”œβ”€β”€ reference/              # Python API reference (auto-generated)
β”‚   └── reference-ts/           # TypeScript API reference (auto-generated)
β”œβ”€β”€ scripts/                     # Helper scripts
β”œβ”€β”€ API_STATUS.md                # Detailed API implementation status
β”œβ”€β”€ llms.txt                     # LLM-friendly project documentation
└── README.md                    # Main documentation

Use Cases

  • Weather Research: Access historical and real-time Korean weather data
  • Climate Analysis: Long-term climate statistics and trends
  • Disaster Monitoring: Real-time tracking of typhoons, earthquakes, severe weather
  • Aviation Safety: Airport weather observations and aircraft meteorological data
  • Marine Operations: Ocean buoy data for maritime safety
  • Air Quality: PM10 yellow dust monitoring
  • Public Health: UV index tracking
  • Agricultural Planning: Seasonal observations and phenological data

Resources

Official KMA Resources

This Project

MCP Framework

License

MIT License - See LICENSE file for details.

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.


Built with: - Python: Python 3.13+, FastMCP, httpx, uv - TypeScript: TypeScript 5.7+, Bun, @modelcontextprotocol/sdk, axios