dlyzzt_china_weather_mcp_server

dlyzzt_china_weather_mcp_server

by DLYZZT
An MCP server providing real-time weather data for Chinese cities using the AMap Weather API.

China Weather MCP Server

Overview

The China Weather MCP Server is a Model Context Protocol (MCP) server designed to provide real-time weather information for Chinese cities. It integrates with the AMap (AutoNavi) Weather API, enabling AI assistants to access current weather conditions across China. This server is particularly useful for developers building AI tools that require accurate and up-to-date weather data for Chinese locations.

Features

  • Real-time weather data retrieval: Fetch current weather conditions for any Chinese city.
  • AMap Weather API integration: Leverages the robust AMap Weather API for reliable data.
  • Asynchronous request handling: Efficiently manages multiple requests without blocking.
  • Easy-to-use MCP interface: Simplifies integration with AI assistants like Claude Desktop.

Installation

  1. Prerequisites: Ensure Python 3.12 or higher is installed on your system.
  2. Install uv: Use the following command to install uv, a Python package manager:

shell curl -LsSf https://astral.sh/uv/install.sh | sh

  1. Clone the repository: Download the project files using Git:

shell git clone https://github.com/DLYZZT/china-weather-mcp-server.git cd china-weather-mcp-server

  1. Install dependencies: Use uv to install the required Python packages:

shell uv pip install .

Configuration

  1. Obtain an API key: Register on the AMap Developer Platform to get your API key.
  2. Set the API key: Export the API key as an environment variable:

shell export AMAP_API_KEY="your_api_key_here"

Usage

To integrate the China Weather MCP Server with Claude Desktop, follow these steps:

  1. Locate the configuration file:
  2. Windows: %APPDATA%/Claude/claude_desktop_config.json
  3. MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  4. Add the server configuration:

json { "mcpServers": { "weather": { "command": "uv", "args": [ "--directory", "path/china-weather-mcp-server", "run", "weather.py" ], "env": { "AMAP_API_KEY": "your_api_key_here" } } } }

  1. Use the get_weather tool: The server provides a get_weather(city: str) function to retrieve weather data for a specified Chinese city.

License

This project is licensed under the MIT License. For more details, see the LICENSE file.


中文

简介

中国天气 MCP 服务器 是一个基于模型上下文协议(Model Context Protocol,MCP)的服务器,通过集成高德地图天气 API,提供中国城市的实时天气信息。该服务器使 AI 助手能够访问中国各地的当前天气状况,适用于需要中国城市天气数据的开发者。

特性

  • 实时天气数据获取:获取中国城市的当前天气信息。
  • 高德地图天气 API 集成:使用高德地图 API 提供可靠的数据。
  • 异步请求处理:高效处理多个请求,避免阻塞。
  • 简单易用的 MCP 接口:轻松与 Claude Desktop 等 AI 助手集成。

安装方法

  1. 环境要求:确保系统已安装 Python 3.12 或更高版本。
  2. 安装 uv:使用以下命令安装 uv

shell curl -LsSf https://astral.sh/uv/install.sh | sh

  1. 克隆仓库:使用 Git 下载项目文件:

shell git clone https://github.com/DLYZZT/china-weather-mcp-server.git cd china-weather-mcp-server

  1. 安装依赖:使用 uv 安装所需的 Python 包:

shell uv pip install .

配置

  1. 获取 API 密钥:在 高德开放平台 注册并获取 API 密钥。
  2. 设置 API 密钥:将 API 密钥导出为环境变量:

shell export AMAP_API_KEY="你的API密钥"

使用方法

要在 Claude Desktop 中使用中国天气 MCP 服务器,请按以下步骤操作:

  1. 定位配置文件
  2. Windows系统%APPDATA%/Claude/claude_desktop_config.json
  3. MacOS系统~/Library/Application Support/Claude/claude_desktop_config.json

  4. 添加服务器配置

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

  1. 使用 get_weather 工具:服务器提供 get_weather(city: str) 函数,用于获取指定中国城市的天气信息。

许可证

本项目采用 MIT 许可证。详情请参见 LICENSE 文件。

Features & Capabilities

Categories
mcp_server model_context_protocol python weather api_integration claude

Implementation Details

Stats

0 Views
0 Favorites
1 GitHub Stars

Repository Info

DLYZZT Organization

Similar Servers

continuedev_continue by continuedev
0
0
0