Files
higress/plugins/wasm-go/mcp-servers/mcp-openweather/mcp-server.yaml
2025-04-17 13:46:31 +08:00

86 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server:
name: weather-server
config:
apiKey: ""
tools:
- name: get_weather
description: "获取指定城市的实时天气信息"
args:
- name: city
description: "城市名称支持中文或英文苏州、suzhou"
type: string
required: true
- name: units
description: "温度单位 (metric: 摄氏度, imperial: 华氏度)"
type: string
required: false
default: "metric"
- name: lang
description: "返回语言 (zh_cn: 中文, en: 英文)"
type: string
required: false
default: "zh_cn"
requestTemplate:
url: "http://api.openweathermap.org/data/2.5/weather"
method: GET
argsToUrlParam: true
headers:
- key: x-api-key
value: "{{.config.apiKey}}"
responseTemplate:
body: |
{
"description": "{{ (index .weather 0).description}}",
"temperature": {{.main.temp}},
"humidity": {{.main.humidity}},
"wind_speed": {{.wind.speed}},
"city": "{{.args.city}}"
}
- name: get_weather_forecast
description: "获取指定城市的天气预报信息"
args:
- name: city
description: "城市名称支持中文或英文苏州、suzhou"
type: string
required: true
- name: days
description: "预报天数最多5天"
type: integer
required: false
default: 5
- name: units
description: "温度单位 (metric: 摄氏度, imperial: 华氏度)"
type: string
required: false
default: "metric"
- name: lang
description: "返回语言 (zh_cn: 中文, en: 英文)"
type: string
required: false
default: "zh_cn"
requestTemplate:
url: "http://api.openweathermap.org/data/2.5/forecast"
method: GET
argsToUrlParam: true
headers:
- key: x-api-key
value: "{{.config.apiKey}}"
responseTemplate:
body: |
{
"forecasts":
{{- range $index, $item := .list }}
{
"date": "{{$item.dt_txt}}",
"description": "{{ (index $item.weather0).description}}",
"temp_min": {{$item.main.temp_min}},
"temp_max": {{$item.main.temp_max}},
"humidity": {{$item.main.humidity}},
"wind_speed": {{$item.wind.speed}},
"city": "{{$.args.city}}"
}{{if not $index.last}},{{end}}
{{- end }}
}