Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@AMap Weather MCPwhat's the weather in Shanghai for the next 4 days?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AMap Weather MCP
一个基于高德地图 API 的 MCP(Model Context Protocol)服务器,提供实时天气查询和城市代码搜索功能。
功能特性
🌤️ 实时天气查询 - 支持按城市名称或城市代码查询天气信息
📍 城市搜索 - 支持精确匹配和模糊搜索中国所有城市
📊 4日天气预报 - 获取详细的天气预报数据
🔄 多种查询方式:
按城市名称查询(如:杭州市、北京市)
按行政代码(adcode)查询
列出所有可用城市
按 adcode 获取城市信息
系统需求
Python 3.8+
高德地图 API 密钥(申请教程)
安装
1. 克隆或下载项目
2. 安装依赖
使用 uv 包管理器(推荐):
或使用 pip:
配置
环境变量
需要配置以下环境变量:
环境变量 | 说明 | 必需 |
| 高德地图 API 密钥 | ✅ 必需 |
使用 Claude Desktop 集成(或者使用其他方式)
将以下配置添加到 Claude Desktop 的 claude_desktop_config.json:
使用方式
可用工具
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
返回: 城市列表,包括总数量
项目结构
依赖包
httpx- 异步 HTTP 客户端requests- HTTP 库mcp- Model Context Protocol 实现
开发说明
项目特点
使用 Python
asyncio实现异步操作集成 MCP 标准,支持与 Claude AI 无缝集成
高效的城市代码索引,支持快速查询
完善的错误处理和日志记录
日志
程序使用 Python 的 logging 模块记录信息,日志级别为 INFO。
许可证
MIT License
支持
如有问题或建议,欢迎提交 Issue 或 Pull Request。