Skip to main content
Glama
README.md
# QZone MCP Server for AstrBot

让 [AstrBot](https://github.com/AstrBotDevs/AstrBot) 接入 QQ 空间,AI 可以在聊天时**自主发说说、查看评论、回复评论、点赞**。

## 功能

| 工具 | 说明 |
|------|------|
| `post_shuoshuo` | 发说说(AI 自主触发,无需指令) |
| `get_my_shuoshuo_list` | 查看说说列表 |
| `get_shuoshuo_detail` | 查看说说详情 + 评论 |
| `add_comment` | 评论说说 |
| `reply_comment` | 回复评论 |
| `like_post` | 点赞 / 取消点赞 |
| `delete_post` | 删除说说 |

## 快速开始

### 1. 获取 QQ 空间 Cookie

浏览器打开 https://i.qq.com 登录 → F12 → Console → 输入 `document.cookie` → 复制输出

粘贴到 `cookies.txt` 文件中。

### 2. 放入 AstrBot data 目录

```
.../data/qzone_mcp/
├── server.py
├── requirements.txt
└── cookies.txt
```

### 3. 配置 MCP

在 AstrBot 的 `mcp_server.json` 中添加:

```json
{
    "mcpServers": {
        "qq空间": {
            "command": "python",
            "args": ["/AstrBot/data/qzone_mcp/server.py"]
        }
    }
}
```

### 4. 修复 Persona

AstrBot 默认 persona 的 `tools` 为 `[]` 会拦截 MCP 工具,需要改为 `null`。

**Docker**:
```bash
docker exec astrbot python3 -c "
import sqlite3
conn = sqlite3.connect('/AstrBot/data/data_v4.db')
conn.execute(\"UPDATE personas SET tools = NULL WHERE persona_id = 'default'\")
conn.commit()
print('Done')
"
```

**pip / Desktop**:打开 WebUI → Persona → default → 清空工具列表 → 保存。

### 5. 重启

```bash
docker restart astrbot
```

## 依赖

- Python >= 3.12
- `mcp`
- `requests`
- `json5`

## 致谢

QZone API 端点基于 [astrbot_plugin_qzone_ultra](https://github.com/diaomin66/astrbot_plugin_qzone_ultra) 逆向。

## License

MIT

Maintenance

ActivityStale
ResponsivenessNo issues