返回市场
中国天气MCP服务器

中国天气MCP服务器

作者:DLYZZT2 星标更新:2025-03-16

项目介绍

技术文档摘要

中文

简介

中国天气MCP服务器是一个基于模型上下文协议(MCP)的服务器,它使用高德地图天气API提供中国城市的实时天气信息。此服务器使AI助手能够访问中国的当前天气状况。

特性

  • 获取中国城市的实时天气数据
  • 集成高德地图天气API
  • 异步请求处理
  • 简单易用的MCP接口

安装方法

  1. 确保已安装Python 3.12或更高版本
  2. 安装UV:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 克隆此仓库:
git clone https://github.com/DLYZZT/china-weather-mcp-server.git
cd china-weather-mcp-server
  1. 使用UV安装依赖项:
uv pip install .

配置

  1. 高德开放平台获取API密钥
  2. 设置API密钥环境变量:
export AMAP_API_KEY="你的API密钥"

使用说明

要在Claude Desktop中使用,请在Claude Desktop配置文件中添加以下配置:

Windows系统:%APPDATA%/Claude/claude_desktop_config.json MacOS系统:~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "weather": {
      "command": "uv",
      "args": [
        "--directory",
        "path/china-weather-mcp-server",
        "run",
        "weather.py"
      ],
      "env": {
        "AMAP_API_KEY": "你的API密钥"
      }
    }
  }
}

该服务器提供以下工具:

  • get_weather(city: str): 获取指定中国城市的当前天气信息

许可证

本项目采用MIT许可 - 详情请参阅LICENSE文档。