内容
# XTCMoment MCP Server
[English](#english) | [中文](#chinese)
---
## English
An MCP (Model Context Protocol) server for querying and retrieving moments (好友圈动态) from xtc smartwatch devices via ADB.
### Features
- **Real-time data fetching** — Pull moment database directly from device via ADB
- **Image retrieval** — Download images from moment posts and return as viewable content
- **Video frame extraction** — Download videos and extract frames as individual images using ffmpeg
- **Comment queries** — Retrieve comments with user info and reply relationships
- **Force refresh** — Trigger app data refresh before querying
### Tools
| Tool | Description |
|------|-------------|
| `fetch_moment_by_timescope` | Query moments within a time range (Unix ms timestamps) |
| `fetch_latest_moment` | Get the latest 50 moments |
| `force_refresh_moments` | Force-refresh the moment feed on device |
| `get_images_by_moment_id` | Get images for a specific moment by momentId |
| `get_video_as_images_by_moment_id` | Download a video and return its frames as images |
| `get_comments_by_moment_id` | Get comments for a specific moment |
### Requirements
- Python 3.10+
- Android device with xtc moment app installed, connected via ADB (with root/su access)
- ffmpeg (for video frame extraction)
### Installation
```bash
pip install -r requirements.txt
```
### Usage
```bash
python src/main.py
```
The server starts on stdio, ready to be used with any MCP-compatible client (e.g., Claude Desktop).
### Device Setup
The server interacts with the device via ADB. Ensure:
1. ADB debugging is enabled on the device
2. Device is connected (`adb devices` shows it)
3. The device has `su` access for database extraction
---
## Chinese
一个基于 MCP(模型上下文协议)的服务器,通过 ADB 从 xtc 智能手表设备实时拉取和查询好友圈动态数据。
### 功能
- **实时数据拉取** — 通过 ADB 直接从设备拉取数据库
- **图片获取** — 下载动态中的图片并以可视内容返回
- **视频逐帧提取** — 下载视频并使用 ffmpeg 逐帧提取为图片
- **评论查询** — 获取评论列表,含评论人信息及回复关系
- **强制刷新** — 查询前主动刷新设备端数据
### 工具列表
| 工具 | 说明 |
|------|------|
| `fetch_moment_by_timescope` | 按时间范围查询好友圈动态(Unix 毫秒时间戳) |
| `fetch_latest_moment` | 获取最新的 50 条动态 |
| `force_refresh_moments` | 强制刷新设备上的好友圈数据 |
| `get_images_by_moment_id` | 根据动态 ID 获取图片列表 |
| `get_video_as_images_by_moment_id` | 下载视频并逐帧提取为图片返回 |
| `get_comments_by_moment_id` | 根据动态 ID 获取评论列表 |
### 环境要求
- Python 3.10+
- 已安装 xtc 好友圈应用的 Android 设备,通过 ADB 连接(需要 root/su 权限)
- ffmpeg(用于视频帧提取)
### 安装
```bash
pip install -r requirements.txt
```
### 运行
```bash
python src/main.py
```
服务器通过 stdio 启动,可与任何兼容 MCP 的客户端配合使用(如 Claude Desktop)。
### 设备配置
服务器通过 ADB 与设备通信。请确保:
1. 设备已启用 ADB 调试
2. 设备已连接(`adb devices` 可看到)
3. 设备拥有 `su` 权限(用于提取数据库)