文档目录
用 MCP 连接 AI 助手
更新于 2026年11月17日
管理员在 Velotrak 后台创建令牌。客户端向追踪器源站的 POST /mcp 发送 Authorization: Bearer vtmcp_…。编辑和删除会先返回 diff,并等待同一次调用带上 diff_token。Free 的令牌只读。
创建令牌
只有管理员能创建 MCP 令牌(GET、POST 和 DELETE /api/mcp-tokens)。明文令牌只显示一次。它以 vtmcp_ 开头。服务器保存 SHA-256 哈希、权限 JSON、创建者和过期时间。省略 days 时,过期时间是 90 天。最长 365 天。省略权限时,令牌是 {"reports":{"read":true}}。
创建者必须一直是活动的管理员。停用该用户或改变其角色后,令牌无法通过认证。数据库里的行可以还在。Free 和 Pro 允许一个未过期的令牌(按活动管理员创建者计数)。Team 存的是不限制的上限。定价页把 Team 写成每位队友一个令牌;程序实际执行的授权是不限制。见套餐。
把客户端指到 POST https://<你的主机>/mcp。路径在站点根上,不在 /admin/ 下面。请求头是 Authorization: Bearer <令牌>。服务器宣布的协议版本是 2025-03-26。
权限和确认
权限形如 { "<领域>": { "read": true, "write": true } }。后台把领域分成:活动、Offer、落地页、Flow、流量源、联盟、域名、报表和日志;告警、备份、迁移、系统和用户管理;以及敏感领域:集成、授权和落地页文件。* 不覆盖敏感领域,也从不授予标成 explicit-only 的工具(改品牌、恢复备份和清除演示数据都在其中)。对某个领域没有写权限的令牌看到的是打过码的凭据。
写工具需要 Pro 或以上(mcp_write)。Free 上会被拒绝,例外是 activate_license。破坏性调用不会在第一次请求时执行。响应包含 requires_confirmation、一个 diff_token,以及 expires_in_seconds 为 600。用同一工具、同一参数再发一次,并带上这个 diff_token。
工具列表
下面的表在构建时从追踪器源码的 Registry() 生成。定价页和首页仍写 90 个工具。这张表是注册表和 CI 检查与服务器实际注册的工具保持一致的那份名单。有一个后台路由没有对应工具:PATCH /api/integrations/{id} 用来更新集成,注册表里只有创建、删除、列表和 sync_costs。
MCP 工具
| 功能 | REST | 工具 |
|---|---|---|
| Click log | GET /api/logs/clicks | get_click_log |
| Conversion log | GET /api/logs/conversions | get_conversion_log |
| Postback log | GET /api/logs/postbacks | get_postback_log |
| Outbound log | GET /api/logs/outbound | get_outbound_log |
| Report query | POST /api/reports/query | report_query |
| Dashboard summary | GET /api/dashboard | dashboard_summary |
| Export report csv | POST /api/reports/export | export_report_csv |
| List report views | GET /api/reports/views | list_report_views |
| Save report view | POST /api/reports/views | save_report_view |
| Delete report view | DELETE /api/reports/views/{id} | delete_report_view |
| Clone campaign | POST /api/campaigns/{id}/clone | clone_campaign |
| Clone offer | POST /api/offers/{id}/clone | clone_offer |
| Clone flow | POST /api/flows/{id}/clone | clone_flow |
| Campaigns: list | GET /api/campaigns | list_campaigns |
| get_campaign | GET /api/campaigns/{id} | get_campaign |
| create_campaign | POST /api/campaigns | create_campaign |
| update_campaign | PATCH /api/campaigns/{id} | update_campaign |
| delete_campaign | DELETE /api/campaigns/{id} | delete_campaign |
| Offers: list | GET /api/offers | list_offers |
| get_offer | GET /api/offers/{id} | get_offer |
| create_offer | POST /api/offers | create_offer |
| update_offer | PATCH /api/offers/{id} | update_offer |
| delete_offer | DELETE /api/offers/{id} | delete_offer |
| Landers: list | GET /api/landers | list_landers |
| get_lander | GET /api/landers/{id} | get_lander |
| create_lander | POST /api/landers | create_lander |
| update_lander | PATCH /api/landers/{id} | update_lander |
| delete_lander | DELETE /api/landers/{id} | delete_lander |
| Sources: list | GET /api/traffic-sources | list_traffic_sources |
| get_traffic_source | GET /api/traffic-sources/{id} | get_traffic_source |
| create_traffic_source | POST /api/traffic-sources | create_traffic_source |
| update_traffic_source | PATCH /api/traffic-sources/{id} | update_traffic_source |
| delete_traffic_source | DELETE /api/traffic-sources/{id} | delete_traffic_source |
| Networks: list | GET /api/networks | list_networks |
| get_network | GET /api/networks/{id} | get_network |
| create_network | POST /api/networks | create_network |
| update_network | PATCH /api/networks/{id} | update_network |
| delete_network | DELETE /api/networks/{id} | delete_network |
| rotate_network_key | POST /api/networks/{id}/rotate-key | rotate_network_key |
| Domains: list | GET /api/domains | list_domains |
| get_domain | GET /api/domains/{id} | get_domain |
| create_domain | POST /api/domains | create_domain |
| update_domain | PATCH /api/domains/{id} | update_domain |
| delete_domain | DELETE /api/domains/{id} | delete_domain |
| Flows: list | GET /api/flows | list_flows |
| get_flow | GET /api/flows/{id} | get_flow |
| create_flow | POST /api/flows | create_flow |
| update_flow | PATCH /api/flows/{id} | update_flow |
| delete_flow | DELETE /api/flows/{id} | delete_flow |
| Get flow doc | GET /api/flows/{id}/doc | get_flow_doc |
| Set flow doc | PUT /api/flows/{id}/doc | set_flow_doc |
| Simulate flow | POST /api/flows/{id}/simulate | simulate_flow |
| List lander files | GET /api/landers/{id}/files | list_lander_files |
| Read lander file | GET /api/landers/{id}/files/{path} | read_lander_file |
| Write lander file | PUT /api/landers/{id}/files/{path} | write_lander_file |
| Delete lander file | DELETE /api/landers/{id}/files/{path} | delete_lander_file |
| Lander preview link | POST /api/landers/{id}/preview-link | get_lander_preview_link |
| License status | GET /api/license | license_status |
| Activate license | POST /api/license/activate | activate_license |
| License heartbeat | POST /api/license/heartbeat | license_heartbeat |
| List integrations | GET /api/integrations | list_integrations |
| Create integration | POST /api/integrations | create_integration |
| Delete integration | DELETE /api/integrations/{id} | delete_integration |
| Sync costs | POST /api/integrations/{id}/sync | sync_costs |
| Enter manual campaign spend | POST /api/campaigns/{id}/cost | record_campaign_cost |
| List manual campaign spend | GET /api/campaigns/{id}/cost | list_campaign_cost |
| Check domain | POST /api/domains/{id}/check | check_domain |
| List alerts | GET /api/alerts | list_alerts |
| Create alert | POST /api/alerts | create_alert |
| Update alert | PUT /api/alerts/{id} | update_alert |
| Delete alert | DELETE /api/alerts/{id} | delete_alert |
| List alert events | GET /api/alerts/events | list_alert_events |
| List backups | GET /api/backups | list_backups |
| Create backup | POST /api/backups | create_backup |
| Restore backup | POST /api/backups/restore | restore_backup |
| System health | GET /healthz | system_health |
| List users | GET /api/users | list_users |
| Audit log | GET /api/audit | audit_log |
| Get branding | GET /api/bootstrap | get_branding |
| List bot rules | GET /api/bot-rules | list_bot_rules |
| Get custom metrics | GET /api/settings/custom-metrics | get_custom_metrics |
| Set custom metrics | PUT /api/settings/custom-metrics | set_custom_metrics |
| Get update status | GET /api/system/update | get_update_status |
| Check for update | POST /api/system/update/check | check_for_update |
| Download update | POST /api/system/update/download | download_update |
| Create bot rule | POST /api/bot-rules | create_bot_rule |
| Delete bot rule | DELETE /api/bot-rules/{id} | delete_bot_rule |
| Set branding | PUT /api/settings/branding | set_branding |
| Migration: export config | GET /api/export | export_config |
| Migration: import config | POST /api/import | import_config |
| Migration: list templates | GET /api/templates | list_templates |
| Migration: apply template | POST /api/templates/apply | apply_template |
| Migration: generate demo | POST /api/demo/generate | generate_demo |
| Migration: clear demo | POST /api/demo/clear | clear_demo |