kma-mcp¶
Model Context Protocol (MCP) server for Korea Meteorological Administration API access
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¶
- Visit the KMA API Hub - the official source for all Korean meteorological data
- Create an account and navigate to "λ§μ΄νμ΄μ§" (My Page)
- Generate an API key from the API management section
- Set your API key:
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¶
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¶
- KMA API Hub: https://apihub.kma.go.kr/ - Official API portal and documentation
- KMA API Documentation: https://apihub.kma.go.kr/api - Complete API specifications
- Note: All APIs in this package are implemented according to official KMA API Hub specifications
This Project¶
- Documentation: https://appleparan.github.io/kma-mcp/
- GitHub: https://github.com/appleparan/kma-mcp
MCP Framework¶
- Model Context Protocol: https://modelcontextprotocol.io/
- FastMCP (Python): https://github.com/jlowin/fastmcp
- TypeScript SDK: https://github.com/modelcontextprotocol/typescript-sdk
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