mixpanel-automation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Mixpanel 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
    RUBE_MANAGE_CONNECTIONS
    with toolkit
    mixpanel
  • Always call
    RUBE_SEARCH_TOOLS
    first to get current tool schemas
  • 必须已连接Rube MCP(需提供RUBE_SEARCH_TOOLS)
  • 通过
    RUBE_MANAGE_CONNECTIONS
    并使用
    mixpanel
    工具包完成Mixpanel的激活连接
  • 请始终先调用
    RUBE_SEARCH_TOOLS
    以获取当前工具模式

Setup

设置步骤

Get Rube MCP: Add
https://rube.app/mcp
as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
  1. Verify Rube MCP is available by confirming
    RUBE_SEARCH_TOOLS
    responds
  2. Call
    RUBE_MANAGE_CONNECTIONS
    with toolkit
    mixpanel
  3. If connection is not ACTIVE, follow the returned auth link to complete Mixpanel authentication
  4. Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加
https://rube.app/mcp
作为MCP服务器。无需API密钥——只需添加端点即可使用。
  1. 确认
    RUBE_SEARCH_TOOLS
    可响应,以此验证Rube MCP是否可用
  2. 调用
    RUBE_MANAGE_CONNECTIONS
    并指定工具包为
    mixpanel
  3. 如果连接状态未处于ACTIVE(激活),请按照返回的授权链接完成Mixpanel认证
  4. 在运行任何工作流之前,确认连接状态显示为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:
  1. MIXPANEL_GET_ALL_PROJECTS
    - List projects to get project ID [Prerequisite]
  2. MIXPANEL_AGGREGATE_EVENT_COUNTS
    - Get event counts and aggregations [Required]
Key parameters:
  • event
    : Event name or array of event names to aggregate
  • from_date
    /
    to_date
    : Date range in 'YYYY-MM-DD' format
  • unit
    : Time granularity ('minute', 'hour', 'day', 'week', 'month')
  • type
    : Aggregation type ('general', 'unique', 'average')
  • where
    : Filter expression for event properties
Pitfalls:
  • Date format must be 'YYYY-MM-DD'; other formats cause errors
  • Event names are case-sensitive; use exact names from your Mixpanel project
  • where
    filter uses Mixpanel expression syntax (e.g.,
    properties["country"] == "US"
    )
  • Maximum date range may be limited depending on your Mixpanel plan
适用场景:用户需要统计事件数量、获取总数或跟踪事件随时间的趋势
工具执行顺序
  1. MIXPANEL_GET_ALL_PROJECTS
    - 列出项目以获取项目ID【前提步骤】
  2. MIXPANEL_AGGREGATE_EVENT_COUNTS
    - 获取事件统计和聚合结果【必需步骤】
关键参数
  • event
    :要聚合的单个事件名称或事件名称数组
  • from_date
    /
    to_date
    :日期范围,格式为'YYYY-MM-DD'
  • unit
    :时间粒度('minute'、'hour'、'day'、'week'、'month')
  • type
    :聚合类型('general'、'unique'、'average')
  • where
    :事件属性的过滤表达式
注意事项
  • 日期格式必须为'YYYY-MM-DD',其他格式会导致错误
  • 事件名称区分大小写,请使用Mixpanel项目中的精确名称
  • where
    过滤条件使用Mixpanel表达式语法(例如:
    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:
  1. MIXPANEL_QUERY_SEGMENTATION
    - Run segmentation analysis [Required]
Key parameters:
  • event
    : Event name to segment
  • from_date
    /
    to_date
    : Date range in 'YYYY-MM-DD' format
  • on
    : Property to segment by (e.g.,
    properties["country"]
    )
  • unit
    : Time granularity
  • type
    : Count type ('general', 'unique', 'average')
  • where
    : Filter expression
  • limit
    : Maximum number of segments to return
Pitfalls:
  • The
    on
    parameter uses Mixpanel property expression syntax
  • Property references must use
    properties["prop_name"]
    format
  • Segmentation on high-cardinality properties returns capped results; use
    limit
  • Results are grouped by the segmentation property and time unit
适用场景:用户需要按属性拆分事件以进行详细分析
工具执行顺序
  1. MIXPANEL_QUERY_SEGMENTATION
    - 运行用户细分分析【必需步骤】
关键参数
  • event
    :要进行细分的事件名称
  • from_date
    /
    to_date
    :日期范围,格式为'YYYY-MM-DD'
  • on
    :用于细分的属性(例如:
    properties["country"]
  • unit
    :时间粒度
  • type
    :统计类型('general'、'unique'、'average')
  • where
    :过滤表达式
  • limit
    :返回的最大细分数量
注意事项
  • on
    参数使用Mixpanel属性表达式语法
  • 属性引用必须使用
    properties["prop_name"]
    格式
  • 对高基数属性进行细分会返回上限结果,请使用
    limit
    参数限制
  • 结果会按细分属性和时间单位进行分组

3. Analyze Funnels

3. 分析转化漏斗

When to use: User wants to track conversion funnels and identify drop-off points
Tool sequence:
  1. MIXPANEL_LIST_FUNNELS
    - List saved funnels to find funnel ID [Prerequisite]
  2. MIXPANEL_QUERY_FUNNEL
    - Execute funnel analysis [Required]
Key parameters:
  • funnel_id
    : ID of the saved funnel to query
  • from_date
    /
    to_date
    : Date range
  • unit
    : Time granularity
  • where
    : Filter expression
  • on
    : Property to segment funnel by
  • length
    : Conversion window in days
Pitfalls:
  • funnel_id
    is required; resolve via LIST_FUNNELS first
  • Funnels must be created in Mixpanel UI first; API only queries existing funnels
  • Conversion window (
    length
    ) defaults vary; set explicitly for accuracy
  • Large date ranges with segmentation can produce very large responses
适用场景:用户需要跟踪转化漏斗并识别流失点
工具执行顺序
  1. MIXPANEL_LIST_FUNNELS
    - 列出已保存的漏斗以获取漏斗ID【前提步骤】
  2. MIXPANEL_QUERY_FUNNEL
    - 执行漏斗分析【必需步骤】
关键参数
  • funnel_id
    :要查询的已保存漏斗ID
  • from_date
    /
    to_date
    :日期范围
  • unit
    :时间粒度
  • where
    :过滤表达式
  • on
    :用于细分漏斗的属性
  • length
    :转化窗口(天数)
注意事项
  • funnel_id
    为必填项,请先通过LIST_FUNNELS获取
  • 漏斗必须先在Mixpanel界面中创建,API仅支持查询现有漏斗
  • 转化窗口(
    length
    )的默认值可能不同,请显式设置以确保准确性
  • 带有细分的大日期范围查询可能会产生非常大的响应结果

4. Manage User Profiles

4. 管理用户画像

When to use: User wants to query or update user profiles in Mixpanel
Tool sequence:
  1. MIXPANEL_QUERY_PROFILES
    - Search and filter user profiles [Required]
  2. MIXPANEL_PROFILE_BATCH_UPDATE
    - Update multiple user profiles [Optional]
Key parameters:
  • where
    : Filter expression for profile properties (e.g.,
    properties["plan"] == "premium"
    )
  • output_properties
    : Array of property names to include in results
  • page
    : Page number for pagination
  • session_id
    : Session ID for consistent pagination (from first response)
  • For batch update: array of profile updates with
    $distinct_id
    and property operations
Pitfalls:
  • Profile queries return paginated results; use
    session_id
    from first response for consistent paging
  • where
    uses Mixpanel expression syntax for profile properties
  • BATCH_UPDATE applies operations (
    $set
    ,
    $unset
    ,
    $add
    ,
    $append
    ) to profiles
  • Batch update has a maximum number of profiles per request; chunk larger updates
  • Profile property names are case-sensitive
适用场景:用户需要查询或更新Mixpanel中的用户画像
工具执行顺序
  1. MIXPANEL_QUERY_PROFILES
    - 搜索并过滤用户画像【必需步骤】
  2. MIXPANEL_PROFILE_BATCH_UPDATE
    - 批量更新多个用户画像【可选步骤】
关键参数
  • where
    :用户画像属性的过滤表达式(例如:
    properties["plan"] == "premium"
  • output_properties
    :要包含在结果中的属性名称数组
  • page
    :分页页码
  • session_id
    :用于保持分页一致性的会话ID(来自首次响应)
  • 批量更新:包含
    $distinct_id
    和属性操作的用户画像更新数组
注意事项
  • 用户画像查询返回分页结果,请使用首次响应中的
    session_id
    以保持分页一致性
  • where
    使用Mixpanel的用户画像属性表达式语法
  • BATCH_UPDATE支持对用户画像执行操作(
    $set
    $unset
    $add
    $append
  • 单次批量更新请求的用户画像数量有上限,请将较大的更新任务拆分为多个请求
  • 用户画像属性名称区分大小写

5. Manage Cohorts

5. 管理用户群组

When to use: User wants to list or analyze user cohorts
Tool sequence:
  1. MIXPANEL_COHORTS_LIST
    - List all saved cohorts [Required]
Key parameters:
  • No required parameters; returns all accessible cohorts
  • Response includes cohort
    id
    ,
    name
    ,
    description
    ,
    count
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
    where
    expressions
适用场景:用户需要列出或分析用户群组
工具执行顺序
  1. MIXPANEL_COHORTS_LIST
    - 列出所有已保存的用户群组【必需步骤】
关键参数
  • 无必填参数;返回所有可访问的用户群组
  • 响应包含用户群组的
    id
    name
    description
    count
注意事项
  • 用户群组需在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:
  1. MIXPANEL_JQL_QUERY
    - Execute a custom JQL (JavaScript Query Language) query [Optional]
  2. MIXPANEL_QUERY_INSIGHT
    - Run a saved insight query [Optional]
Key parameters:
  • For JQL:
    script
    containing the JQL JavaScript code
  • For Insight:
    bookmark_id
    of the saved insight
  • project_id
    : Project context for the query
Pitfalls:
  • JQL uses JavaScript-like syntax specific to Mixpanel
  • JQL queries have execution time limits; optimize for efficiency
  • Insight
    bookmark_id
    must reference an existing saved insight
  • JQL is a legacy feature; check Mixpanel documentation for current availability
适用场景:用户需要运行自定义JQL查询或洞察分析
工具执行顺序
  1. MIXPANEL_JQL_QUERY
    - 执行自定义JQL(JavaScript Query Language)查询【可选步骤】
  2. 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 id
Funnel 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_id

Mixpanel Expression Syntax

Mixpanel表达式语法

Used in
where
and
on
parameters:
  • 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"
用于
where
on
参数:
  • 属性引用:
    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
    page
    number and
    session_id
    for consistent results
  • 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
    properties["name"]
    format
  • String values must be quoted:
    properties["status"] == "active"
  • Numeric values are unquoted:
    properties["count"] > 10
  • Boolean values:
    true
    /
    false
    (lowercase)
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
    data
    key
  • 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

快速参考

TaskTool SlugKey Params
List projectsMIXPANEL_GET_ALL_PROJECTS(none)
Aggregate eventsMIXPANEL_AGGREGATE_EVENT_COUNTSevent, from_date, to_date, unit
SegmentationMIXPANEL_QUERY_SEGMENTATIONevent, on, from_date, to_date
List funnelsMIXPANEL_LIST_FUNNELS(none)
Query funnelMIXPANEL_QUERY_FUNNELfunnel_id, from_date, to_date
Query profilesMIXPANEL_QUERY_PROFILESwhere, output_properties, page
Batch update profilesMIXPANEL_PROFILE_BATCH_UPDATE(profile update objects)
List cohortsMIXPANEL_COHORTS_LIST(none)
JQL queryMIXPANEL_JQL_QUERYscript
Query insightMIXPANEL_QUERY_INSIGHTbookmark_id
任务工具标识关键参数
列出项目MIXPANEL_GET_ALL_PROJECTS
聚合事件MIXPANEL_AGGREGATE_EVENT_COUNTSevent, from_date, to_date, unit
用户细分MIXPANEL_QUERY_SEGMENTATIONevent, on, from_date, to_date
列出漏斗MIXPANEL_LIST_FUNNELS
查询漏斗MIXPANEL_QUERY_FUNNELfunnel_id, from_date, to_date
查询用户画像MIXPANEL_QUERY_PROFILESwhere, output_properties, page
批量更新用户画像MIXPANEL_PROFILE_BATCH_UPDATE用户画像更新对象数组
列出用户群组MIXPANEL_COHORTS_LIST
JQL查询MIXPANEL_JQL_QUERYscript
查询洞察MIXPANEL_QUERY_INSIGHTbookmark_id