amap-weather-mcp-server
Click on "Deploy 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-mcp-server北京市今天天气怎么样?"
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.
中国城市天气查询 MCP 服务
基于高德地图 API 的中国城市天气查询 Model Context Protocol (MCP) 服务。该服务允许用户通过简单的请求获取中国各城市的实时天气状况和未来几天的天气预报。
功能特点
使用高德地图天气 API 获取精确的中国城市天气数据
支持查询实时天气状况
支持查询未来 3-4 天的天气预报
支持智能城市名称识别,包括城市、区县级别的查询
支持城市名称搜索功能
实现为标准 MCP 服务,易于集成到 AI 应用中
Related MCP server: AMap Weather MCP
安装说明
前提条件
高德地图开发者 API 密钥(需通过环境变量配置)
安装步骤
克隆或下载本仓库
进入项目目录
使用 uv 安装依赖:
uv venv
source .venv/bin/activate
uv add "mcp[cli]" httpx使用方法
启动 MCP 服务
如果你需要自行创建客户端测试该 MCP 服务,请手动启动。 在终端中执行以下命令启动 MCP 服务:
uv run weather.py使用集成的 MCP 服务
在 Claude Desktop 中使用
如果想在 Claude Desktop 中使用,请添加服务器配置:
请在文本编辑器中打开 Claude for Desktop App 配置,路径参考如下 ~/Library/Application Support/Claude/claude_desktop_config.json
如果文件不存在,请确保创建该文件。
{
"mcpServers": {
"amap-weather-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
"run",
"weather.py"
],
"env": {
"AMAP_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}在 Cherry Studio 中使用
如下图所示配置即可:

调用服务
MCP 服务提供了三个主要工具函数用于天气查询:
get_current_weather: 获取城市当前天气状况get_weather_forecast: 获取未来几天的天气预报search_city: 搜索城市名称
使用 MCP 客户端调用示例:
from mcp.client import Client
# 连接到服务
client = Client("amap-weather-mcp-server")
# 查询实时天气
current_weather = await client.get_current_weather("北京市")
print(current_weather)
# 查询天气预报
forecast = await client.get_weather_forecast("上海市")
print(forecast)
# 搜索城市名称
cities = await client.search_city("广州")
print(cities)API 参考
get_current_weather
获取指定城市的实时天气数据。
参数:
city: 中国城市名称,需要包含省/市/县等行政区划标识,如"北京市"、"上海市"、"海珠区"等
返回: 格式化的城市实时天气信息字符串,包括:
城市名称
天气状况
温度
风向
风力
湿度
发布时间
get_weather_forecast
获取指定城市的天气预报(未来3-4天)。
参数:
city: 中国城市名称,需要包含省/市/县等行政区划标识,如"北京市"、"上海市"、"浙江省杭州市"等
返回: 格式化的城市天气预报信息字符串,包括:
城市名称
未来几天的日期
白天和夜间天气状况
白天和夜间温度
白天和夜间风向、风力
search_city
根据关键词搜索匹配的城市名称。
参数:
keyword: 城市名称关键词,建议包含省/市/县等行政区划标识,如"广州市"、"海珠区"等
返回: 包含匹配城市名称列表的字符串。
数据来源
本服务使用高德地图开放平台提供的天气数据 API:
实时天气数据 API: https://restapi.amap.com/v3/weather/weatherInfo
城市编码数据: AMap_adcode_citycode.csv
注意事项
该服务仅支持中国大陆地区的城市天气查询
高德地图 API 可能有请求频率限制
城市名称识别支持直接输入城市名称或区县名称(建议带上行政区划标识如"市"、"县"、"区"等)
环境变量必须正确配置,否则API请求将失败
许可证
Available Tools
3 toolsget_current_weatherB
获取指定城市的实时天气
Args: city: 中国城市名称,如"北京市"、"上海市"、"广州市"等
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description bears full responsibility. It only states the tool 'gets' weather, implying a read operation, but fails to disclose potential behaviors such as rate limits, authentication needs, or error handling. Essential transparency is missing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise, with two clear lines for purpose and parameters. The args section is structured. However, the purpose could be more tightly integrated with the parameter description to reduce redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite low complexity (single parameter, no nested objects), the description lacks information about the output format (e.g., temperature, conditions) and does not specify any edge cases or behavior when the city is not found. This omission hinders the agent's ability to fully understand the tool's capabilities.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
With 0% schema description coverage, the description compensates by explaining the 'city' parameter as '中国城市名称' (Chinese city name) and providing examples. This adds useful meaning beyond the schema, though it does not specify format constraints or acceptable input variations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states '获取指定城市的实时天气' (get real-time weather for specified city), clearly indicating the verb and resource. However, it does not differentiate from the sibling tool 'get_weather_forecast', as 'current' is only implied by the tool name.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides context that the tool is for current weather of a city, but it does not explicitly advise when to use this tool versus 'get_weather_forecast' or 'search_city'. Usage is implied but not explicitly guided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_weather_forecastA
获取指定城市的天气预报(未来3-4天)
Args: city: 中国城市名称,如"北京市"、"上海市"、"广州市"等
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It states the forecast covers 3-4 days but lacks details on data source, update frequency, or any limitations. The description is too minimal for full transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: one line in Chinese stating the purpose, followed by a clear parameter description in English. No wasted words; information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (one parameter, no output schema, no annotations), the description covers the essential aspects. It could mention that the forecast is not current weather, but overall it is adequate for the complexity level.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, but the description adds example values ('北京市', '上海市', '广州市') which clarify the expected format beyond the schema's plain 'string' type. However, it could specify required format (e.g., city name must include '市').
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves a weather forecast for a specified city, covering 3-4 days. It uses specific verb ('get') and resource ('weather forecast'), and distinguishes from siblings like 'get_current_weather' (current vs forecast) and 'search_city' (search vs forecast).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides an example of city format (e.g., '北京市'), but does not explicitly state when to use this tool versus its siblings 'get_current_weather' or 'search_city'. Usage context is implied but not spelled out.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_cityC
根据关键词搜索匹配的城市
Args: keyword: 城市名称关键词
| Name | Required | Description | Default |
|---|---|---|---|
| keyword | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations exist, and the description does not disclose behaviors such as whether multiple cities are returned, ordering, or pagination. The agent lacks insight into what to expect.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very short and concise, but lacks structure. It mixes Chinese and English informally, and the args section is simplistic. Could be more clearly formatted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a search tool with no output schema and low schema description coverage, the description is insufficient. It does not explain what data is returned or how results are structured.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description only repeats the parameter name 'keyword' without adding meaning. Schema description coverage is 0%, and the description fails to compensate by explaining the parameter's purpose or format.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'search for matching cities by keyword', which is a specific verb and resource. It distinguishes itself from weather-related sibling tools.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. While siblings are weather tools, no explicit usage context or exclusions are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
get_current_weather - First observed
get_weather_forecast - First observed
search_city
TDQS
Scored across 3 tools
Each tool serves a clearly distinct purpose: real-time current weather, multi-day forecast, and city lookup by keyword. There is no functional overlap or ambiguity.
All tool names follow a consistent verb_noun pattern using snake_case (get_current_weather, get_weather_forecast, search_city). The naming is predictable and clear.
With exactly three tools covering current weather, forecast, and city search, the server is tightly scoped for its weather information purpose. This count is minimal but sufficient and well within the 3-15 ideal range.
The server covers the core weather workflow: search for a city, get current conditions, and get a multi-day forecast. There are no obvious gaps for a general weather query service; all essential operations are present.
Maintenance
Related MCP Connectors
MCP server for current weather and multi-day forecasts worldwide, Chinese city names and output.
Hosted MCP server for Xweather weather data: conditions, forecasts, alerts, and more.
WeatherAPI.com MCP — wraps WeatherAPI.com (api.weatherapi.com)
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides weather forecast data for locations in China using the HeFeng Weather API, with real-time, hourly, or daily forecasts and location-based queries.124 npm9ISC
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides real-time weather information, 4-day forecasts, and city search functionality for Chinese cities via the AMap API. It enables users to query weather data using city names or administrative codes through natural language interactions.1MIT
- AlicenseNot gradedqualityDmaintenance基于高德地图API的MCP天气预报服务器,提供中国城市的实时天气和天气预报查询功能。10 npm4MIT
- AlicenseNot gradedqualityDmaintenance基于HelloAgents框架的天气查询MCP服务器,支持12个中国主要城市实时天气查询,使用wttr.in API无需密钥。MIT