使用说明
澳大利亚天气MCP服务器
一个MCP(模型上下文协议)服务器,提供来自澳大利亚气象局(BOM)的澳大利亚天气数据访问服务。该服务器允许AI助手和其他MCP客户端搜索地点,并获取澳大利亚各地的天气预报和当前观测数据。
特点/特性
此MCP服务器提供以下工具:
- 搜索位置通过郊区名称或邮政编码搜索澳大利亚地点
- 获取每日天气预报获取某地的多日天气预报
- 获取每三小时的天气预报获取详细的每3小时预报数据
- 获取观测数据获取当前天气观测数据
- 获取指定地点的天气信息获取全面的天气信息(便捷工具,集搜索+预报+观测于一体)
安装
使用 pip
pip install -e /path/to/au-weather-mcp
使用紫外线(推荐)
uv pip install -e /path/to/au-weather-mcp
使用 Docker Desktop
如果你更倾向于使用 Docker,你可以在容器中构建并运行服务器:
# Clone the repository
git clone git@github.com:craigles75/au-weather-mcp.git
cd au-weather-mcp
# Build the Docker image
docker build -t au-weather-mcp .
# Or use docker compose
docker compose build
配置
Claude Desktop(可译为“Claude桌面版”或保持原样,根据上下文决定是否需要具体翻译)
将此添加到您的Claude桌面配置文件中:
MacOS(苹果电脑操作系统): ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"au-weather": {
"command": "python",
"args": ["/path/to/au-weather-mcp/server.py"]
}
}
}
或者如果你在使用uv:
{
"mcpServers": {
"au-weather": {
"command": "uv",
"args": ["--directory", "/path/to/au-weather-mcp", "run", "server.py"]
}
}
}
或者,如果你正在使用 Docker:
{
"mcpServers": {
"au-weather": {
"command": "docker",
"args": ["run", "-i", "--rm", "au-weather-mcp"]
}
}
}
注当使用 Docker 时,请确保首先已使用以下命令构建镜像: docker build -t au-weather-mcp . 或者 docker compose build。
其他MCP客户端
对于其他MCP客户端,请将其配置为运行:
python
python /path/to/au-weather-mcp/server.py
Docker:
docker run -i --rm au-weather-mcp
服务器通过标准输入/输出(stdio)进行通信。
使用示例
配置完成后,您可以通过您的MCP客户端(如Claude Desktop)使用这些工具:
搜索地点
Use the search_location tool to find "Melbourne"
这返回了一个包含与“墨尔本”匹配的位置及其地理哈希标识符的列表。
获取某地的天气信息
Use the get_weather_for_location tool for "Sydney"
这个搜索功能可以查找悉尼,并返回每日天气预报以及当前的天气观测数据。
获取详细预报
First search for "Parkdale 3195", then use the geohash to get the daily forecast
这样,在有多个匹配项时,您可以更精确地控制想要选择的具体位置。
工具参考
搜索位置
通过郊区名称或邮政编码搜索澳大利亚地点。
参数:
query(字符串,必填):郊区名称(例如,“Parkdale”,“Sydney”)或邮政编码(例如,“3195”,“2000”)
返回值: 带有地理哈希标识符的匹配位置列表
获取每日预报
获取某地每日天气预报。
参数:
geohash(字符串,必填):地理位置geohash标识符(从search_location获取)
返回值: 多日天气预报,包括温度、天气状况和降雨预测
获取每三小时天气预报
获取详细的每三小时天气预报。
参数:
geohash(字符串,必填):地理位置geohash标识符(从search_location获取)
返回值: 详细的每三小时预报数据
获取观测值
获取当前天气观测数据。
参数:
geohash(字符串,必填): 地理哈希位置标识符(从search_location获取)
返回值: 当前的天气状况包括温度、湿度、风力等。
获取指定地点的天气信息
获取全面的天气信息(便捷工具)。
参数:
location(字符串,必填):郊区名称或邮政编码
返回值: 位置信息、每日预报和当前观测数据
发展
运行测试
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
手动测试服务器
你可以通过直接运行服务器来测试它:
python
python server.py
Docker:
docker run -i --rm au-weather-mcp
服务器将启动并通过标准输入输出进行通信。您可以发送MCP协议消息来测试这些工具。
使用 Docker 构建和运行
# Build the image
docker build -t au-weather-mcp .
# Run the server
docker run -i --rm au-weather-mcp
# Or using docker compose
docker compose build
docker compose run --rm au-weather-mcp
数据源
这个服务器从气象局的公共API中获取数据,地址为 https://api.weather.bom.gov.au/v1。
许可证
麻省理工学院(MIT)
做出贡献
欢迎贡献!请随时提交问题或拉取请求。