FitConverter 运动数据转换
通过 MCP 协议调用 FitConverter 服务,将运动数据从一个平台转换到另一个平台。
1. 新用户必读
⚠️ 首次使用需要获取 API Key
- 访问 https://api.fitconverter.com/mcp/generate-api-key 获取 API Key
- 告诉我你的 API Key,我会帮你配置
- 或者手动配置 mcporter(见下文)
2. 配置 API Key
方式一:对话中配置(推荐)
直接告诉我你的 API Key:
我的 FitConverter API Key 是 fc_mcp_xxxxxx
我会自动帮你配置。
方式二:手动配置 mcporter
编辑 ~/.mcporter/mcporter.json,添加:
{
"mcpServers": {
"fitconverter": {
"baseUrl": "https://api.fitconverter.com/mcp",
"headers": {
"Authorization": "Bearer 你的API_KEY"
}
}
}
}
3. 使用方式
配置完成后,直接对话即可:
帮我把华为的运动数据转到高驰
我要把 Keep 的记录转到佳明
转换 GPX 文件到 FIT 格式
4. 支持的平台
数据源(type)
- 文件类型:huawei, zepp, xiaomi, vivo, keep, samsung, dongdong, kml, gpx, tcx, fit
- 同步类型:zepp_sync, keep_sync, codoon_sync, joyrun_sync, xingzhe_sync, garmin_sync_coros
目标平台(destination)
coros, garmin, strava, rqrun, huawei, keep, shuzixindong, xingzhe, igpsport, onelap, fit, tcx, gpx, kml
5. Agent 执行流程
5.1 检查配置
- 检查 mcporter 是否已配置 fitconverter 服务器
- 若未配置,引导用户访问 https://api.fitconverter.com/mcp/generate-api-key 获取 API Key
5.2 调用 MCP 工具
# 列出支持的平台
mcporter call fitconverter.list_platforms
# 提交转换任务(需要传入 api_key)
mcporter call fitconverter.submit_conversion --args '{
"api_key": "fc_mcp_xxx",
"type": "huawei",
"destination": "coros",
"address": "user@example.com",
"zip_file": "<Base64编码的文件内容>"
}'
5.3 文件处理
⚠️ 重要:zip_file 参数需要传入 Base64 编码的文件内容,不是文件路径!
处理流程:
- 用户上传 ZIP 文件
- Agent 将文件转换为 Base64
- 调用 MCP submit_conversion 时传入 Base64 内容
对于大文件(>500KB),直接通过 HTTP 请求调用 MCP 端点:
// Node.js 示例
const https = require('https');
const fs = require('fs');
const b64 = fs.readFileSync('file.zip').toString('base64');
const requestData = JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'submit_conversion',
arguments: {
api_key: 'fc_mcp_xxx',
type: 'huawei',
destination: 'coros',
address: 'user@example.com',
zip_file: b64
}
}
});
// 发送 POST 请求到 https://api.fitconverter.com/mcp
// Headers: Authorization: Bearer fc_mcp_xxx, Accept: application/json, text/event-stream
5.4 查询状态
mcporter call fitconverter.get_conversion_status --args '{
"api_key": "fc_mcp_xxx",
"order_id": "fitId_xxx"
}'
6. 返回状态处理
| status | 含义 | 操作 |
|---|---|---|
| payment_required | 需要支付 | 展示二维码,引导用户支付 |
| pending_payment | 等待支付中 | 轮询 get_conversion_status |
| submitted | 提交成功 | 告知用户等待邮件通知 |
| error | 错误 | 返回错误信息 |
7. 支付二维码展示
当返回 qr_image_url 时,使用 message 工具发送图片:
message({
action: "send",
channel: "discord",
target: "user:用户ID",
media: "https://file.fitconverter.com/qr/qr-xxx.png",
caption: "请扫码支付"
})
8. 错误处理
| 错误 | 解决方案 |
|---|---|
| 未配置 API Key | 引导访问 https://api.fitconverter.com/mcp/generate-api-key |
| 不支持的数据源 | 从支持的平台选择:huawei, keep, xiaomi 等 |
| 不支持的目标平台 | 选择目标平台:garmin, coros, strava 等 |
| 请提供有效的邮箱地址 | 输入有效的邮箱地址 |
| 需要提供 ZIP 文件 | 上传 ZIP 文件 |
