mixpanel-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMixpanel Automation via Rube MCP
通过Rube MCP实现Mixpanel自动化
Automate Mixpanel product analytics through Composio's Mixpanel toolkit via Rube MCP.
通过Composio的Mixpanel工具包,借助Rube MCP实现Mixpanel产品分析的自动化。
Prerequisites
前提条件
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active Mixpanel connection via with toolkit
RUBE_MANAGE_CONNECTIONSmixpanel - Always call first to get current tool schemas
RUBE_SEARCH_TOOLS
- 必须已连接Rube MCP(需提供RUBE_SEARCH_TOOLS)
- 通过并使用
RUBE_MANAGE_CONNECTIONS工具包完成Mixpanel的激活连接mixpanel - 请始终先调用以获取当前工具模式
RUBE_SEARCH_TOOLS
Setup
设置步骤
Get Rube MCP: Add as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
https://rube.app/mcp- Verify Rube MCP is available by confirming responds
RUBE_SEARCH_TOOLS - Call with toolkit
RUBE_MANAGE_CONNECTIONSmixpanel - If connection is not ACTIVE, follow the returned auth link to complete Mixpanel authentication
- Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加作为MCP服务器。无需API密钥——只需添加端点即可使用。
https://rube.app/mcp- 确认可响应,以此验证Rube MCP是否可用
RUBE_SEARCH_TOOLS - 调用并指定工具包为
RUBE_MANAGE_CONNECTIONSmixpanel - 如果连接状态未处于ACTIVE(激活),请按照返回的授权链接完成Mixpanel认证
- 在运行任何工作流之前,确认连接状态显示为ACTIVE
Core Workflows
核心工作流
1. Aggregate Event Data
1. 聚合事件数据
When to use: User wants to count events, get totals, or track event trends over time
Tool sequence:
- - List projects to get project ID [Prerequisite]
MIXPANEL_GET_ALL_PROJECTS - - Get event counts and aggregations [Required]
MIXPANEL_AGGREGATE_EVENT_COUNTS
Key parameters:
- : Event name or array of event names to aggregate
event - /
from_date: Date range in 'YYYY-MM-DD' formatto_date - : Time granularity ('minute', 'hour', 'day', 'week', 'month')
unit - : Aggregation type ('general', 'unique', 'average')
type - : Filter expression for event properties
where
Pitfalls:
- Date format must be 'YYYY-MM-DD'; other formats cause errors
- Event names are case-sensitive; use exact names from your Mixpanel project
- filter uses Mixpanel expression syntax (e.g.,
where)properties["country"] == "US" - Maximum date range may be limited depending on your Mixpanel plan
适用场景:用户需要统计事件数量、获取总数或跟踪事件随时间的趋势
工具执行顺序:
- - 列出项目以获取项目ID【前提步骤】
MIXPANEL_GET_ALL_PROJECTS - - 获取事件统计和聚合结果【必需步骤】
MIXPANEL_AGGREGATE_EVENT_COUNTS
关键参数:
- :要聚合的单个事件名称或事件名称数组
event - /
from_date:日期范围,格式为'YYYY-MM-DD'to_date - :时间粒度('minute'、'hour'、'day'、'week'、'month')
unit - :聚合类型('general'、'unique'、'average')
type - :事件属性的过滤表达式
where
注意事项:
- 日期格式必须为'YYYY-MM-DD',其他格式会导致错误
- 事件名称区分大小写,请使用Mixpanel项目中的精确名称
- 过滤条件使用Mixpanel表达式语法(例如:
where)properties["country"] == "US" - 根据你的Mixpanel套餐,最大日期范围可能会受到限制
2. Run Segmentation Queries
2. 运行用户细分查询
When to use: User wants to break down events by properties for detailed analysis
Tool sequence:
- - Run segmentation analysis [Required]
MIXPANEL_QUERY_SEGMENTATION
Key parameters:
- : Event name to segment
event - /
from_date: Date range in 'YYYY-MM-DD' formatto_date - : Property to segment by (e.g.,
on)properties["country"] - : Time granularity
unit - : Count type ('general', 'unique', 'average')
type - : Filter expression
where - : Maximum number of segments to return
limit
Pitfalls:
- The parameter uses Mixpanel property expression syntax
on - Property references must use format
properties["prop_name"] - Segmentation on high-cardinality properties returns capped results; use
limit - Results are grouped by the segmentation property and time unit
适用场景:用户需要按属性拆分事件以进行详细分析
工具执行顺序:
- - 运行用户细分分析【必需步骤】
MIXPANEL_QUERY_SEGMENTATION
关键参数:
- :要进行细分的事件名称
event - /
from_date:日期范围,格式为'YYYY-MM-DD'to_date - :用于细分的属性(例如:
on)properties["country"] - :时间粒度
unit - :统计类型('general'、'unique'、'average')
type - :过滤表达式
where - :返回的最大细分数量
limit
注意事项:
- 参数使用Mixpanel属性表达式语法
on - 属性引用必须使用格式
properties["prop_name"] - 对高基数属性进行细分会返回上限结果,请使用参数限制
limit - 结果会按细分属性和时间单位进行分组
3. Analyze Funnels
3. 分析转化漏斗
When to use: User wants to track conversion funnels and identify drop-off points
Tool sequence:
- - List saved funnels to find funnel ID [Prerequisite]
MIXPANEL_LIST_FUNNELS - - Execute funnel analysis [Required]
MIXPANEL_QUERY_FUNNEL
Key parameters:
- : ID of the saved funnel to query
funnel_id - /
from_date: Date rangeto_date - : Time granularity
unit - : Filter expression
where - : Property to segment funnel by
on - : Conversion window in days
length
Pitfalls:
- is required; resolve via LIST_FUNNELS first
funnel_id - Funnels must be created in Mixpanel UI first; API only queries existing funnels
- Conversion window () defaults vary; set explicitly for accuracy
length - Large date ranges with segmentation can produce very large responses
适用场景:用户需要跟踪转化漏斗并识别流失点
工具执行顺序:
- - 列出已保存的漏斗以获取漏斗ID【前提步骤】
MIXPANEL_LIST_FUNNELS - - 执行漏斗分析【必需步骤】
MIXPANEL_QUERY_FUNNEL
关键参数:
- :要查询的已保存漏斗ID
funnel_id - /
from_date:日期范围to_date - :时间粒度
unit - :过滤表达式
where - :用于细分漏斗的属性
on - :转化窗口(天数)
length
注意事项:
- 为必填项,请先通过LIST_FUNNELS获取
funnel_id - 漏斗必须先在Mixpanel界面中创建,API仅支持查询现有漏斗
- 转化窗口()的默认值可能不同,请显式设置以确保准确性
length - 带有细分的大日期范围查询可能会产生非常大的响应结果
4. Manage User Profiles
4. 管理用户画像
When to use: User wants to query or update user profiles in Mixpanel
Tool sequence:
- - Search and filter user profiles [Required]
MIXPANEL_QUERY_PROFILES - - Update multiple user profiles [Optional]
MIXPANEL_PROFILE_BATCH_UPDATE
Key parameters:
- : Filter expression for profile properties (e.g.,
where)properties["plan"] == "premium" - : Array of property names to include in results
output_properties - : Page number for pagination
page - : Session ID for consistent pagination (from first response)
session_id - For batch update: array of profile updates with and property operations
$distinct_id
Pitfalls:
- Profile queries return paginated results; use from first response for consistent paging
session_id - uses Mixpanel expression syntax for profile properties
where - BATCH_UPDATE applies operations (,
$set,$unset,$add) to profiles$append - Batch update has a maximum number of profiles per request; chunk larger updates
- Profile property names are case-sensitive
适用场景:用户需要查询或更新Mixpanel中的用户画像
工具执行顺序:
- - 搜索并过滤用户画像【必需步骤】
MIXPANEL_QUERY_PROFILES - - 批量更新多个用户画像【可选步骤】
MIXPANEL_PROFILE_BATCH_UPDATE
关键参数:
- :用户画像属性的过滤表达式(例如:
where)properties["plan"] == "premium" - :要包含在结果中的属性名称数组
output_properties - :分页页码
page - :用于保持分页一致性的会话ID(来自首次响应)
session_id - 批量更新:包含和属性操作的用户画像更新数组
$distinct_id
注意事项:
- 用户画像查询返回分页结果,请使用首次响应中的以保持分页一致性
session_id - 使用Mixpanel的用户画像属性表达式语法
where - BATCH_UPDATE支持对用户画像执行操作(、
$set、$unset、$add)$append - 单次批量更新请求的用户画像数量有上限,请将较大的更新任务拆分为多个请求
- 用户画像属性名称区分大小写
5. Manage Cohorts
5. 管理用户群组
When to use: User wants to list or analyze user cohorts
Tool sequence:
- - List all saved cohorts [Required]
MIXPANEL_COHORTS_LIST
Key parameters:
- No required parameters; returns all accessible cohorts
- Response includes cohort ,
id,name,descriptioncount
Pitfalls:
- Cohorts are created and managed in Mixpanel UI; API provides read access
- Cohort IDs are numeric; use exact ID from list results
- Cohort counts may be approximate for very large cohorts
- Cohorts can be used as filters in other queries via expressions
where
适用场景:用户需要列出或分析用户群组
工具执行顺序:
- - 列出所有已保存的用户群组【必需步骤】
MIXPANEL_COHORTS_LIST
关键参数:
- 无必填参数;返回所有可访问的用户群组
- 响应包含用户群组的、
id、name、descriptioncount
注意事项:
- 用户群组需在Mixpanel界面中创建和管理;API仅提供读取权限
- 用户群组ID为数字,请使用列表结果中的精确ID
- 对于非常大的用户群组,其数量可能为近似值
- 用户群组可通过表达式用作其他查询的过滤条件
where
6. Run JQL and Insight Queries
6. 运行JQL和洞察查询
When to use: User wants to run custom JQL queries or insight analyses
Tool sequence:
- - Execute a custom JQL (JavaScript Query Language) query [Optional]
MIXPANEL_JQL_QUERY - - Run a saved insight query [Optional]
MIXPANEL_QUERY_INSIGHT
Key parameters:
- For JQL: containing the JQL JavaScript code
script - For Insight: of the saved insight
bookmark_id - : Project context for the query
project_id
Pitfalls:
- JQL uses JavaScript-like syntax specific to Mixpanel
- JQL queries have execution time limits; optimize for efficiency
- Insight must reference an existing saved insight
bookmark_id - JQL is a legacy feature; check Mixpanel documentation for current availability
适用场景:用户需要运行自定义JQL查询或洞察分析
工具执行顺序:
- - 执行自定义JQL(JavaScript Query Language)查询【可选步骤】
MIXPANEL_JQL_QUERY - - 运行已保存的洞察查询【可选步骤】
MIXPANEL_QUERY_INSIGHT
关键参数:
- JQL查询:包含JQL JavaScript代码的参数
script - 洞察查询:已保存洞察的
bookmark_id - :查询的项目上下文
project_id
注意事项:
- JQL使用Mixpanel特类JavaScript的语法
- JQL查询有执行时间限制,请优化以提升效率
- 洞察查询的必须指向已保存的洞察
bookmark_id - JQL是遗留功能,请查看Mixpanel文档确认当前可用性
Common Patterns
通用模式
ID Resolution
ID解析
Project name -> Project ID:
1. Call MIXPANEL_GET_ALL_PROJECTS
2. Find project by name in results
3. Extract project idFunnel name -> Funnel ID:
1. Call MIXPANEL_LIST_FUNNELS
2. Find funnel by name
3. Extract funnel_id项目名称 -> 项目ID:
1. 调用MIXPANEL_GET_ALL_PROJECTS
2. 在结果中按名称查找项目
3. 提取项目id漏斗名称 -> 漏斗ID:
1. 调用MIXPANEL_LIST_FUNNELS
2. 按名称查找漏斗
3. 提取funnel_idMixpanel Expression Syntax
Mixpanel表达式语法
Used in and parameters:
whereon- Property reference:
properties["property_name"] - Equality:
properties["country"] == "US" - Comparison:
properties["age"] > 25 - Boolean:
properties["is_premium"] == true - Contains:
"search_term" in properties["name"] - AND/OR:
properties["country"] == "US" and properties["plan"] == "pro"
用于和参数:
whereon- 属性引用:
properties["property_name"] - 相等判断:
properties["country"] == "US" - 比较判断:
properties["age"] > 25 - 布尔值:
properties["is_premium"] == true - 包含判断:
"search_term" in properties["name"] - 逻辑与/或:
properties["country"] == "US" and properties["plan"] == "pro"
Pagination
分页
- Event queries: Follow date-based pagination by adjusting date ranges
- Profile queries: Use number and
pagefor consistent resultssession_id - Funnel/cohort lists: Typically return complete results without pagination
- 事件查询:通过调整日期范围实现基于日期的分页
- 用户画像查询:使用页码和
page保持结果一致性session_id - 漏斗/用户群组列表:通常返回完整结果,无需分页
Known Pitfalls
已知注意事项
Date Formats:
- Always use 'YYYY-MM-DD' format
- Date ranges are inclusive on both ends
- Data freshness depends on Mixpanel ingestion delay (typically minutes)
Expression Syntax:
- Property references always use format
properties["name"] - String values must be quoted:
properties["status"] == "active" - Numeric values are unquoted:
properties["count"] > 10 - Boolean values: /
true(lowercase)false
Rate Limits:
- Mixpanel API has rate limits per project
- Large segmentation queries may time out; reduce date range or segments
- Use batch operations where available to minimize API calls
Response Parsing:
- Response data may be nested under key
data - Event data is typically grouped by date and segment
- Numeric values may be returned as strings; parse explicitly
- Empty date ranges return empty objects, not empty arrays
日期格式:
- 请始终使用'YYYY-MM-DD'格式
- 日期范围两端均为闭区间(包含起始和结束日期)
- 数据新鲜度取决于Mixpanel的 ingestion 延迟(通常为数分钟)
表达式语法:
- 属性引用必须使用格式
properties["name"] - 字符串值必须加引号:
properties["status"] == "active" - 数值无需加引号:
properties["count"] > 10 - 布尔值:/
true(小写)false
速率限制:
- Mixpanel API针对每个项目设有速率限制
- 大型细分查询可能超时,请缩小日期范围或细分数量
- 尽可能使用批量操作以减少API调用次数
响应解析:
- 响应数据可能嵌套在键下
data - 事件数据通常按日期和细分进行分组
- 数值可能以字符串形式返回,请显式解析
- 空日期范围返回空对象,而非空数组
Quick Reference
快速参考
| Task | Tool Slug | Key Params |
|---|---|---|
| List projects | MIXPANEL_GET_ALL_PROJECTS | (none) |
| Aggregate events | MIXPANEL_AGGREGATE_EVENT_COUNTS | event, from_date, to_date, unit |
| Segmentation | MIXPANEL_QUERY_SEGMENTATION | event, on, from_date, to_date |
| List funnels | MIXPANEL_LIST_FUNNELS | (none) |
| Query funnel | MIXPANEL_QUERY_FUNNEL | funnel_id, from_date, to_date |
| Query profiles | MIXPANEL_QUERY_PROFILES | where, output_properties, page |
| Batch update profiles | MIXPANEL_PROFILE_BATCH_UPDATE | (profile update objects) |
| List cohorts | MIXPANEL_COHORTS_LIST | (none) |
| JQL query | MIXPANEL_JQL_QUERY | script |
| Query insight | MIXPANEL_QUERY_INSIGHT | bookmark_id |
| 任务 | 工具标识 | 关键参数 |
|---|---|---|
| 列出项目 | MIXPANEL_GET_ALL_PROJECTS | 无 |
| 聚合事件 | MIXPANEL_AGGREGATE_EVENT_COUNTS | event, from_date, to_date, unit |
| 用户细分 | MIXPANEL_QUERY_SEGMENTATION | event, on, from_date, to_date |
| 列出漏斗 | MIXPANEL_LIST_FUNNELS | 无 |
| 查询漏斗 | MIXPANEL_QUERY_FUNNEL | funnel_id, from_date, to_date |
| 查询用户画像 | MIXPANEL_QUERY_PROFILES | where, output_properties, page |
| 批量更新用户画像 | MIXPANEL_PROFILE_BATCH_UPDATE | 用户画像更新对象数组 |
| 列出用户群组 | MIXPANEL_COHORTS_LIST | 无 |
| JQL查询 | MIXPANEL_JQL_QUERY | script |
| 查询洞察 | MIXPANEL_QUERY_INSIGHT | bookmark_id |