Metadata-Version: 2.4
Name: weatherwork-consumer-mcp
Version: 0.3.1
Summary: WeatherWork Consumer MCP Server — 基于 weathercn API 的消费者天气工具集
Project-URL: Homepage, https://github.com/weatherwork/consumer-mcp
Project-URL: Repository, https://github.com/weatherwork/consumer-mcp
Project-URL: Documentation, https://github.com/weatherwork/consumer-mcp#readme
Author: WeatherWork
License: MIT
Keywords: forecast,mcp,model-context-protocol,weather,weathercn
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Requires-Python: >=3.11
Requires-Dist: mcp>=1.0.0
Description-Content-Type: text/markdown

# WeatherWork Consumer MCP

基于 [weathercn](https://platform.weathercn.com) API 的消费者天气 MCP 服务，提供 **17 个工具**（地名解析、实况、预报、预警、空气质量、分钟降水、生活指数、台风、天文、潮汐等）。

## 安装

```bash
pip install weatherwork-consumer-mcp
```

从本目录源码安装（开发）：

```bash
cd weatherwork-consumer-mcp
pip install -e .
```

## 配置密钥

**openAPI 标准模式**（推荐普通用户）：

```bash
export WEATHERCN_OPENAPI_KEY="your_openapi_key"
```

**JV 高阶模式**（商务授权）：

```bash
export WEATHERCN_API_KEY="your_api_key"
export WEATHERCN_API_SECRET="your_api_secret"
```

> 设置了 `WEATHERCN_OPENAPI_KEY` 时优先走 openAPI；未设置则使用 JV 凭证。详见 `.env.example`。

## 运行

安装后可直接启动 MCP（stdio）：

```bash
weatherwork-consumer-mcp
```

## 接入 Claude Desktop

编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`：

```json
{
  "mcpServers": {
    "weatherwork": {
      "command": "weatherwork-consumer-mcp",
      "env": {
        "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
      }
    }
  }
}
```

## 接入 Cursor

`.cursor/mcp.json` 示例：

```json
{
  "mcpServers": {
    "weatherwork": {
      "command": "weatherwork-consumer-mcp",
      "env": {
        "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
      }
    }
  }
}
```

## 工具列表

| 工具 | 说明 |
|------|------|
| `resolve_location` | 地名解析与消歧义 |
| `get_weather_alerts` | 气象预警（透传，勿解读） |
| `get_current_weather` | 当前实况 |
| `get_weather_forecast` | 逐日预报 |
| `get_hourly_forecast` | 逐小时预报 |
| `get_activity_advice` | 生活指数与活动建议 |
| `get_air_quality` | 空气质量 |
| `get_minute_precipitation` | 分钟级降水（GCJ-02 坐标） |
| `get_typhoon_*` | 台风（JV） |
| `get_astronomy_*` | 天文（JV） |
| `get_tidal_*` | 潮汐（JV） |

## 本地测试

```bash
pip install -e .
export WEATHERCN_OPENAPI_KEY="..."
python tests/test_tools.py
```

## 发布到 PyPI（维护者）

```bash
pip install build twine
python -m build
twine upload dist/*
```

## 目录结构

```
weatherwork-consumer-mcp/
├── pyproject.toml
├── README.md
├── .env.example
├── SYSTEM_PROMPT.md
├── tests/test_tools.py
└── src/weatherwork_consumer_mcp/
    ├── server.py          # MCP 入口
    ├── config.py
    ├── generate_url.py
    └── tools/             # 17 个工具实现
```

## 环境要求

- Python 3.11+
- 依赖：`mcp>=1.0.0`
