Back to MCP directory
publicPublicdnsLocal runtime

china-weather-mcp-server

中国天气MCP服务器通过高德API提供国内城市实时天气数据

article

README

🚀 中国天气 MCP 服务器

中国天气 MCP 服务器基于模型上下文协议(MCP)构建,借助高德地图天气 API,为 AI 助手提供中国城市的实时天气信息,助力其了解各地当前天气状况。

🚀 快速开始

中国天气 MCP 服务器是一个强大的工具,能让 AI 助手轻松获取中国城市的实时天气信息。以下是使用该服务器的详细步骤。

✨ 主要特性

  • 实时数据获取:可获取中国城市的实时天气数据。
  • API 集成:集成了高德地图天气 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 文件。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client