Skip to main content
Glama

met-mcp

一个用于获取挪威气象局(MET Norway,Yr)天气预报的 MCP 服务器,作为学习项目而构建。

可通过三种方式使用:

  • npm:met-mcp — 通过 stdio 在本地运行

  • 远程:https://met-mcp.met-mcp-worker.workers.dev/mcp — 基于 Cloudflare Workers 的 Streamable HTTP,可将其添加为 claude.ai 连接器

  • MCP 注册表:io.github.trondbjoroy/met-mcp

工具

  • geocode_location(name, count) — 查找地名的坐标。使用免费的 Open-Meteo 地理编码器,因为 MET 没有地理编码 API。

  • get_forecast(latitude, longitude, hours) — 来自 MET Locationforecast 2.0 的逐小时预报。适用于全球,北欧效果最佳。

  • get_nowcast(latitude, longitude) — 基于雷达的未来 2 小时降水预报。仅限北欧。

  • get_weather_alerts(latitude?, longitude?) — 挪威官方危险警告(MetAlerts)。省略坐标可获取全挪威的警告。

  • get_sun_events(latitude, longitude, date, utc_offset) — 日出、日落和正午太阳高度。全球可用。

  • get_ocean_forecast(latitude, longitude, hours) — 挪威海岸沿线的浪高和海温。

  • find_weather_stations(latitude, longitude, count) — 最近的官方气象站(Frost)。

  • get_historical_weather(station_id, from, to, elements) — 来自 Frost 档案的每日历史观测数据;部分站点可追溯 100 多年。

这两个 Frost 工具需要从 https://frost.met.no/auth/requestCredentials.html 获取免费的客户端 ID,并设置为 FROST_CLIENT_ID 环境变量(或作为 worker 的 Cloudflare 密钥)。其他工具则无需任何配置。

工具定义位于 src/tools.ts 中,由 stdio 服务器和 worker 共享。

Related MCP server: OpenWeatherMap MCP Server

构建和测试

npm install
npm run build
npm test

测试通过 stdio 启动服务器,并针对实时 API 调用这两个工具。

与 Claude Code 一起使用

claude mcp add met-weather -- node C:\Users\trond\met-mcp\dist\index.js

然后询问 Claude:“明天卑尔根的天气怎么样?”

MET 服务条款

  • 发送带有联系信息的可识别 User-Agent。设置 MET_USER_AGENT 环境变量,例如 met-mcp/0.1.0 you@example.com。

  • 坐标最多保留 4 位小数。服务器会为您四舍五入。

  • 数据许可:NLOD / CC BY 4.0。展示数据时请注明来源为挪威气象局(MET Norway)。

远程版本

worker/ 目录包含 Cloudflare Workers 部署:通过 createMcpHandler(MCP SDK v2)在 MCP Streamable HTTP 上提供相同的两个工具。使用 npm run dev 开发,使用 npm run deploy 部署(均在 worker/ 目录下执行)。

工作原理

  • src/index.ts 就是整个服务器。它通过 stdio 使用 MCP 协议:在 stdin/stdout 上进行 JSON-RPC 通信。

  • 每个工具都使用 Zod 声明输入模式。MCP 客户端(Claude)读取该模式并验证参数。

  • 工具结果以 content 块的形式返回。此服务器以文本形式返回 JSON,并精简为 LLM 所需的内容——MET 原始响应包含约 90 个时间步,字段要多得多。

  • 切勿使用 console.log 写入 stdout。这会破坏协议流。请使用 stderr 记录日志。

Available Tools

8 tools
find_weather_stationsFind weather stationsAInspect

Find the nearest official weather stations (Frost). Use the station id (e.g. SN50540) with get_historical_weather.

Inputs: latitude (required), longitude (required), count.

geocode_locationGeocode a place nameCInspect

Find latitude and longitude for a place name. Use the coordinates with the other tools.

Inputs: name (required), count.

get_forecastGet weather forecastAInspect

Get an hourly weather forecast from MET Norway (Yr) for a coordinate. Works worldwide, best coverage in the Nordics.

Inputs: latitude (required), longitude (required), hours.

get_historical_weatherGet historical weatherAInspect

Daily historical observations from a weather station (Frost archive, some stations go back over 100 years). Find station ids with find_weather_stations.

Inputs: to (required), from (required), station_id (required), elements.

get_nowcastGet precipitation nowcastAInspect

Minute-by-minute precipitation for the next 2 hours, radar-based. Nordic region only. Answers 'do I need an umbrella right now?'

Inputs: latitude (required), longitude (required).

get_ocean_forecastGet ocean forecastCInspect

Wave height, wave direction, and sea temperature. Covers the Norwegian coast and nearby seas.

Inputs: latitude (required), longitude (required), hours.

get_sun_eventsGet sunrise and sunsetBInspect

Sunrise, sunset, and solar noon for a coordinate and date. Works worldwide.

Inputs: date (required), latitude (required), longitude (required), utc_offset.

get_weather_alertsGet weather alertsAInspect

Official danger warnings (wind, flood, ice, forest fire...) from MET Norway. Covers Norway and its waters. Omit coordinates to get all current alerts. Alert text is in Norwegian.

Inputs: latitude, longitude.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct weather data need: geocoding, hourly forecasts, nowcasting, alerts, solar events, ocean conditions, station lookup, and historical observations. The only potentially overlapping pair (get_forecast vs get_nowcast) is clearly separated by forecast horizon and description.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern, with get_ as the dominant prefix and find_/geocode_ as clear exceptions that still follow the same grammatical structure. This makes the tool surface highly predictable.

    Tool Count5/5

    Eight tools is well-scoped for a weather data server: each tool handles a specific data type or lookup step without redundancy. The count is large enough to cover the domain but small enough to avoid overwhelming an agent.

    Completeness5/5

    The tool set covers the full observation-to-forecast lifecycle: geocoding to obtain coordinates, station discovery for historical data, current conditions, short-term nowcast, forecast, alerts, ocean conditions, and solar events. No critical gaps are apparent for the stated weather domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides LLM-friendly weather tools and Norwegian place name resolution via MCP, enabling weather forecasts, air quality, marine conditions, and activity planning.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides weather data including current conditions, forecasts, and summaries via Open-Meteo with no API key required, enabling natural language queries through an MCP interface.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables access to MET Norway weather data including global forecasts, Nordic nowcast, sunrise/sunset times, air quality, and ocean forecasts via natural language queries.
      59 npm
      MIT