AMap Weather MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
AMap Weather MCP
一个基于高德地图 API 的 MCP(Model Context Protocol)服务器,提供实时天气查询和城市代码搜索功能。
功能特性
🌤️ 实时天气查询 - 支持按城市名称或城市代码查询天气信息
📍 城市搜索 - 支持精确匹配和模糊搜索中国所有城市
📊 4日天气预报 - 获取详细的天气预报数据
🔄 多种查询方式:
按城市名称查询(如:杭州市、北京市)
按行政代码(adcode)查询
列出所有可用城市
按 adcode 获取城市信息
Related MCP server: Weather MCP Server
系统需求
Python 3.8+
高德地图 API 密钥(申请教程)
安装
1. 克隆或下载项目
git clone <repository-url>
cd amap-weather-mcp2. 安装依赖
使用 uv 包管理器(推荐):
uv pip install -r requirements.txt或使用 pip:
pip install -r requirements.txt配置
环境变量
需要配置以下环境变量:
环境变量 | 说明 | 必需 |
| 高德地图 API 密钥 | ✅ 必需 |
使用 Claude Desktop 集成(或者使用其他方式)
将以下配置添加到 Claude Desktop 的 claude_desktop_config.json:
{
"mcpServers": {
"amap-weather-mcp": {
"name": "amap-weather-mcp",
"type": "stdio",
"isActive": true,
"command": "uv",
"args": [
"--directory",
"/path/to/amap-weather-mcp",
"run",
"main.py"
],
"env": {
"AMAP_API_KEY": "your-api-key-here"
}
}
}
}使用方式
可用工具
1. get_weather_by_city_name
按城市名称获取天气信息
参数:
city_name(string): 城市名称,如 "杭州市"、"北京市"
返回: 实时天气和 4 天预报数据
2. get_weather_by_city_code
按城市行政代码获取天气信息
参数:
city_code(string): 城市行政代码,如 "110100"(北京市朝阳区)
返回: 实时天气和 4 天预报数据
3. search_city
搜索城市(支持精确和模糊匹配)
参数:
city_name(string): 要搜索的城市名称
返回: 匹配的城市列表及其代码
4. get_city_by_adcode
按 adcode 获取城市信息
参数:
adcode(string): 行政代码,如 "110000"(北京市)
返回: 城市信息对象
5. list_all_cities
列出所有可用城市
参数:
limit(integer): 返回结果数量限制,默认 50,最大 200
返回: 城市列表,包括总数量
项目结构
amap-weather-mcp/
├── main.py # 主程序文件
├── city_codes.json # 城市代码数据库
├── requirements.txt # 项目依赖
├── .gitignore # Git 忽略规则
└── README.md # 本文件依赖包
httpx- 异步 HTTP 客户端requests- HTTP 库mcp- Model Context Protocol 实现
开发说明
项目特点
使用 Python
asyncio实现异步操作集成 MCP 标准,支持与 Claude AI 无缝集成
高效的城市代码索引,支持快速查询
完善的错误处理和日志记录
日志
程序使用 Python 的 logging 模块记录信息,日志级别为 INFO。
许可证
MIT License
支持
如有问题或建议,欢迎提交 Issue 或 Pull Request。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for China weather: current conditions and multi-day forecast by city name or adcode.
MCP server for current weather and multi-day forecasts worldwide, Chinese city names and output.
MCP server for weather with reasoning — umbrella advice, outdoor checks, city comparisons.
An MCP server for weather information by @kulybaba
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides real-time weather data, hourly forecasts, and daily summaries using the free Open-Meteo API with no API key required. It enables users to search for weather conditions by specific coordinates or city names across multiple measurement units.2MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server integrated with the QWeather API that provides real-time weather forecasts and meteorological warnings for AI assistants. It enables users to query current conditions and disaster alerts for specific cities or coordinates.-
- FlicenseCqualityDmaintenanceAn MCP server that provides access to current weather data and 5-day forecasts via the Open Weather13 API. It enables users to retrieve weather information using city names or geographic coordinates across various languages.3-
- AlicenseNot gradedqualityDmaintenance基于高德地图API的MCP天气预报服务器,提供中国城市的实时天气和天气预报查询功能。4MIT