天气查询服务器

一个基于MCP协议的天气信息服务器,提供城市天气查询功能,包括温度和天气状况。

  • by Maggieee030
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 Maggieee030/mcp-weather-server

使用说明

MCP Weather Server

一个基于 MCP(Model Context Protocol)的天气信息服务器,提供城市天气查询功能。

功能特点

  • 支持查询指定城市的天气信息
  • 返回温度和天气状况
  • 简单易用的 API 接口

安装

# 克隆仓库
git clone https://github.com/Maggieee030/mcp-weather-server.git

# 进入项目目录
cd mcp-weather-server

# 安装依赖
npm install

使用方法

  1. 构建项目:
npm run build
  1. 启动服务器:
npm start
  1. 使用 MCP Inspector 测试:
npx @modelcontextprotocol/inspector

API 说明

get_weather

获取指定城市的天气信息。

参数:

  • city: 城市名称(字符串)

示例:

{
  "city": "Beijing"
}

返回:

{
  "city": "Beijing",
  "temperature": 25,
  "condition": "Sunny"
}

许可证

MIT