Skip to main content
Glama
kaisumi
by kaisumi

天气 MCP

使用模型上下文协议 (MCP) 的天气预报应用程序

概述

该应用程序是一个 MCP 服务器,使用 Open-Meteo API 来检索和显示天气预报数据。可以通过 MCP 协议从 LLM 应用程序访问天气信息。

Related MCP server: OpenWeatherMap MCP Server

功能

  • 显示当前天气信息

  • 查看3天天气预报

  • 获取基于位置的天气信息

  • 通过 MCP 协议访问

设置

  1. 安装依赖项:

pip install -e .
  1. 设置环境变量:创建.env文件,设置所需的环境变量。

MCP_API_KEY=your_api_key_here
MCP_BASE_URL=http://localhost:8000
  1. 启动 MCP 服务器:

python -m app.server
  1. 运行客户端:

python -m app.client

MCP 工具

获取天气

获取特定城市的当前天气信息和 3 天预报。

参数:

  • city :要获取天气信息的城市名称(例如东京、纽约)

响应示例:

{
  "location": {
    "name": "東京",
    "country": "日本",
    "latitude": 35.6895,
    "longitude": 139.6917,
    "timezone": "Asia/Tokyo"
  },
  "current": {
    "temperature": 22.5,
    "feels_like": 23.1,
    "humidity": 65,
    "wind_speed": 3.2,
    "wind_direction": 180,
    "precipitation": 0,
    "condition": "晴れ",
    "weather_code": 1
  },
  "forecast": [
    {
      "date": "2023-04-10",
      "max_temp": 24.5,
      "min_temp": 15.2,
      "precipitation": 0,
      "condition": "晴れ",
      "sunrise": "05:30",
      "sunset": "18:15"
    },
    ...
  ]
}

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kaisumi/weather-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server