Skip to main content
Glama
Python MCP Korea Weather Service

Python MCP Korea Weather Service

by jikime

韩国天气 MCP 服务器

铁匠徽章 版本执照

该 MCP(多平台通信协议)服务器提供对韩国气象局 (KMA) API 的访问,允许 AI 代理检索韩国各地的天气预报信息。

概述

  • 检索韩国行政区域的精确网格坐标

  • 获取韩国任何地点的详细短期天气预报

  • 支持韩国所有行政区划(市、区、街道)

  • 针对 LLM 使用进行了优化的结构化文本响应

  • 综合天气数据,包括温度、降水、天空状况、湿度、风向和风速

Related MCP server: MCP Weather Server

目录

设置

先决条件

  • Python 3.12+

  • 韩国气象局 API 凭证

  • 您可以通过在公共数据门户注册并请求访问“기상청_단기예보 ((구)_동네예보) 조회서비스”API 来获取 API 凭据。

安装

  1. 克隆存储库:

git clone https://github.com/jikime/py-mcp-ko-weather.git
cd py-mcp-ko-weather
  1. 紫外线安装

curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 创建虚拟环境并安装依赖项:

uv venv -p 3.12
source .venv/bin/activate
uv pip install -r requirements.txt
  1. 使用您的 KMA API 凭据创建一个.env文件:

cp env.example .env
vi .env

KO_WEATHER_API_KEY=your_api_key_here
  1. 将网格坐标数据从 Excel 迁移到 SQLite:

uv run src/migrate.py

使用 Docker

  1. 构建 Docker 镜像:

docker build -t py-mcp-ko-weather .
  1. 运行容器:

docker run py-mcp-ko-weather

使用本地

  1. 运行服务器:

mcp run src/server.py

配置 MCP 设置

将服务器配置添加到您的 MCP 设置文件:

克劳德桌面应用程序

  1. 要通过Smithery自动安装:

npx -y @smithery/cli install @jikime/py-mcp-ko-weather --client claude
  1. 要手动安装,请打开~/Library/Application Support/Claude/claude_desktop_config.json

将其添加到mcpServers对象:

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "/path/to/bin/uv",
      "args": [
        "--directory",
        "/path/to/py-mcp-ko-weather",
        "run",
        "src/server.py"
      ]
    }
  }
}

游标 IDE

打开~/.cursor/mcp.json

将其添加到mcpServers对象:

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "/path/to/bin/uv",
      "args": [
        "--directory",
        "/path/to/py-mcp-ko-weather",
        "run",
        "src/server.py"
      ]
    }
  }
}

对于 Docker

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "py-mcp-ko-weather"
      ]
    }
  }
}

与 Claude 一起使用

配置完成后,您可以向 Claude 询问以下问题:

  • “서울특별시 서초구 양재1동의 날씨는?”

  • “부산광역시 해운대구 우동의 날씨 예보를 알려줘”

  • “경기도 성남시 분당구의 현재 기온은?”

API 参考

工具

获取网格位置

get_grid_location(city: str, gu: str, dong: str) -> dict

检索韩国气象局 API 针对指定位置使用的网格坐标 (nx, ny)。此工具会根据市/道、区/县以及街区/城镇信息,在数据库中搜索精确坐标。

获取预测

get_forecast(city: str, gu: str, dong: str, nx: int, ny: int) -> str

调用韩国气象局的超短期预报 API,提供特定地点的天气预报信息。返回包括温度、降水量、天空状况、湿度、风向和风速在内的综合天气数据。

资源

天气说明

GET http://localhost:8000/weather-instructions

提供有关如何使用韩国天气 MCP 服务器的详细文档,包括工具工作流程和响应格式。

提示

天气查询

该服务器包含一个结构化的提示模板,用于引导有关天气查询的对话,确保高效的信息收集和清晰的预报数据呈现。

响应格式

天气预报响应以结构化文本格式提供,针对 LLM 处理进行了优化:

Weather forecast for 서울특별시 서초구 양재1동 (coordinates: nx=61, ny=125)
Date: 2025-05-01
Time: 15:00

Current conditions:
Temperature: 22.3°C
Sky condition: Mostly clear
Precipitation type: None
Precipitation probability: 0%
Humidity: 45%
Wind direction: Northwest
Wind speed: 2.3 m/s

Hourly forecast:
16:00 - Temperature: 21.8°C, Sky: Clear, Precipitation: None
17:00 - Temperature: 20.5°C, Sky: Clear, Precipitation: None
18:00 - Temperature: 19.2°C, Sky: Clear, Precipitation: None
...

致谢

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。

Available Tools

2 tools
get_forecastC

한국 기상청의 초단기예보 API를 호출하여 특정 지역의 날씨 예보 정보를 제공합니다. 사용자가 입력한 지역 정보와 격자 좌표를 바탕으로 현재 시점에서의 기상 정보를 조회합니다. 이 도구는 온도, 강수량, 하늘상태, 습도, 풍향, 풍속 등 상세한 기상 정보를 포함하며, 6시간 이내의 단기 예보를 제공합니다.

Inputs: city (required), gu (required), dong (required), nx (required), +1 more. Returns: result

get_grid_locationA

한국 기상청 API에 사용되는 격자 좌표(nx, ny)를 조회합니다. 사용자가 입력한 시/도, 구/군, 동/읍/면 정보를 바탕으로 해당 지역의 기상청 격자 좌표를 데이터베이스에서 검색하여 반환합니다. 이 도구는 기상청 API 호출에 필요한 정확한 좌표값을 얻기 위해 필수적으로 사용됩니다.

Inputs: city (required), gu (required), dong (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct purposes: get_forecast retrieves weather forecast data, while get_grid_location provides grid coordinates needed for API calls. There is no overlap in functionality, and an agent can easily tell them apart based on their descriptions.

    Naming Consistency5/5

    Both tools follow a consistent verb_noun naming pattern (get_forecast, get_grid_location). The naming is predictable and readable, with no deviations or mixed conventions.

    Tool Count2/5

    With only two tools, the server feels thin for a weather service domain. While the tools cover forecast retrieval and coordinate lookup, there are likely gaps in functionality (e.g., historical data, alerts, or broader regional coverage) that could limit agent workflows.

    Completeness2/5

    The tool set is severely incomplete for a weather service. It lacks essential operations such as historical weather data, severe weather alerts, multi-day forecasts, or location search beyond grid coordinates. Agents will face dead ends when trying to perform common weather-related tasks.

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      C
      quality
      D
      maintenance
      An MCP server that provides access to current weather data and 5-day forecasts via the Open Weather13 API. It enables users to retrieve weather information using city names or geographic coordinates across various languages.
      3
      -
    • F
      license
      A
      quality
      D
      maintenance
      An MCP server that provides Korean weather information from the Korea Meteorological Administration's short-term forecast API, enabling natural language queries about weather conditions such as current weather, rain forecasts, and suitability for outdoor activities.
      3
      12
      -