Python MCP Korea Weather Service

Python MCP Korea Weather Service

This is a Korean weather information service using the MCP (Model Control Protocol) server.

How to install

  1. Clone this repository:
git clone https://github.com/jikime/py-mcp-ko-weather.git cd py-mcp-ko-weather
  1. uv installation
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Create a virtual environment using uv and install the necessary packages:
uv venv -p 3.12 source .venv/bin/activate uv pip install -r requirements.txt
  1. Set your Met Office API key in your .env file:
cp env.example .env vi .env KO_WEATHER_API_KEY=your_api_key_here
  1. Migrate data from the weather grid coordinates in Excel to SQLite.
uv run src/migrate.py

How to issue a Meteorological Agency API key

  1. Access the public data portal , register as a member, and log in.
  2. Search for and apply for use of the "Korea Meteorological Administration_Short-term Forecast ((old)_Neighborhood Forecast) Inquiry Service" API.
  3. After approval, set the received API key in the .env file.

Configuring MCP Tools

Open the ~/Library/Application\ Support/Claude/claude_desktop_config.json file and add the weather server.

{ "mcpServers": { "Korea Weather": { "command": "/Users/jikime/Dev/.local/bin/uv", "args": [ "--directory", "/Users/jikime/Dev/py-mcp-ko-weather", "run", "src/server.py" ] } } }

How to run

  • Launch Claude Desktop to make sure it's added to your tools.
  • Try typing "What's the weather like in Yangjae 1-dong, Seocho-gu, Seoul?" in the chat input box.

Function Description

This MCP server provides the following features:

Tools

  1. Get location coordinates ( get_grid_location )
    • Description: Retrieves grid coordinates (nx, ny) used in the Korea Meteorological Administration API. Based on the city/province, district/county, and town/village information entered by the user, it searches the database for and returns the Korea Meteorological Administration grid coordinates for the corresponding area. This tool is essential for obtaining accurate coordinate values required for calling the Korea Meteorological Administration API.
    • Parameters:
      • city : city/province name (e.g. "Seoul")
      • gu : District/county name (e.g. "Seocho-gu")
      • dong : name of a dong/town/village (e.g. "Yangjae 1-dong")
    • Data is retrieved from an embedded SQLite database ( data/weather_grid.db ).
  2. Get weather forecast ( get_forecast )
    • Description: Provides weather forecast information for a specific area by calling the Korea Meteorological Administration's short-term forecast API. It retrieves current weather information based on the user-entered area information and grid coordinates. This tool includes detailed weather information such as temperature, precipitation, sky conditions, humidity, wind direction, and wind speed, and provides short-term forecasts of up to 6 hours.
    • Parameters:
      • city : city/province name (e.g. "Seoul")
      • gu : District/county name (e.g. "Seocho-gu")
      • dong : name of a dong/town/village (e.g. "Yangjae 1-dong")
      • nx : X grid coordinate
      • ny : Y grid coordinate

Resources

Weather Service User Manual ( weather-instructions )

  • URI: weather-instructions
  • Description: A detailed guide explaining how to use the Korea Meteorological Service. This resource provides all the information you need to use the service, including how to use the tool, the workflow, and the response format. It contains structured information to help LLMs effectively utilize the weather tool.

Prompts

Weather information query prompt ( weather-query )

  • Description: A conversational prompt template for querying weather information for the Korean region. This prompt guides a structured conversation between the user and the LLM, suggesting the appropriate tool sequence and response format. It shows how to collect the necessary information from the user and provide a clear weather forecast.

License

Apache License 2.0

-
security - not tested
-
license - not tested
-
quality - not tested

MCP server that provides Korean weather information using grid coordinates and the Korea Meteorological Administration API, allowing users to query current weather conditions and forecasts for specific locations in Korea.

  1. 설치 방법
    1. 기상청 API 키 발급 방법
      1. MCP 도구 구성하기
        1. 실행 방법
          1. 기능 설명
            1. 도구 (Tools)
            2. 리소스 (Resources)
            3. 프롬프트 (Prompts)
          2. 라이센스
            ID: mnve9iamp0