mcpField
P
pp-google-business-profile

pp-google-business-profile

github.com/mvanhorn营销与增长2.1k92 次安装今天更新
代码仓库

关于 pp-google-business-profile

pp-google-business-profile 是供运营人员管理 Google Business Profile 资源的 CLI 技能。它结合 API 操作与本地 SQLite 归档,支持搜索、分组分析、数据新鲜度检查和变更监控。

主要功能

  1. 01管理账号和地点
  2. 02将资源归档到本地 SQLite
  3. 03搜索已同步的商家资料数据
  4. 04执行资源分组分析
  5. 05监控地点变更

适用场景

  1. 01按文本线索搜索归档地点
  2. 02按门店代码统计地点数量
  3. 03在运营决策前检查归档新鲜度
  4. 04监测与地点相关的变更

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/mvanhorn/printing-press-library --skill pp-google-business-profile

安装后在 Claude Code 中输入/pp-google-business-profile确认已加载。

详细介绍

Google Business Profile — Printing Press 命令行工具

前提条件:安装命令行工具

此技能依赖 google-business-profile-pp-cli 二进制文件。调用此技能中的任何命令前,必须确认命令行工具已安装。 如果尚未安装,请先安装:

  1. 使用 Printing Press 安装程序安装:
    npx -y @mvanhorn/printing-press-library install google-business-profile --cli-only
    
  2. 验证:google-business-profile-pp-cli --version
  3. 确保 $GOPATH/bin(或 $HOME/go/bin)位于 $PATH 中。

如果 npx 安装失败(未安装 Node、处于离线状态等),则改为直接使用 Go 安装(需要 Go 1.26.6 或更高版本):

go install github.com/mvanhorn/printing-press-library/library/marketing/google-business-profile/cmd/google-business-profile-pp-cli@latest

如果安装后 --version 报告“command not found”,说明安装步骤未将二进制文件放入 $PATH。验证成功之前,请勿继续执行此技能中的命令。

使用 Google Business Profile 命令行工具管理 API 资源,然后在本地归档,以便快速搜索、分组分析和验证推出情况。此工具专为运营工作流设计,在这类工作流中,重复读取和可审计性与原始端点覆盖范围同样重要。

独特功能

其他任何用于此 API 的工具都不具备以下功能。

本地运营工作流
  • workflow archive — 构建 Google Business Profile 资源的本地 SQLite 归档,让 Agent 无需每次回答问题时都重新调用 API,也能检查账号和地点。

    让 Agent 能基于已同步的快照回答后续问题,而不必为了重复的列表调用消耗配额和时间。

    google-business-profile-pp-cli workflow archive --agent
    
  • workflow status — 显示本地归档在各资源表中的最新情况和同步状态,让运营人员了解离线回答是否仍然可信。

    避免 Agent 根据过时的归档给出陈旧的运营建议。

    google-business-profile-pp-cli workflow status --agent
    
  • search — 使用 FTS5 搜索本地同步的 Business Profile 数据,适用于没有原生 API 搜索路径或无法进行实时身份验证的情况。

    无需为每个 API 接口编写自定义筛选条件,即可快速查找已同步记录。

    google-business-profile-pp-cli search "Toronto" --data-source local --type locations --limit 20 --json
    
  • analytics — 对已同步数据运行分组分析,统计资源数量并呈现分布模式,无需先导出到电子表格。

    让命令行工具成为轻量级报表界面,便于开展地点清单和质量保证工作。

    google-business-profile-pp-cli analytics --type locations --group-by storeCode --limit 25 --json
    
监控与验证
  • tail — 轮询 API 并输出 NDJSON 变更事件,让运营人员近乎实时地监视与地点相关的活动。

    让命令行工具不仅可用于一次性 API 调用,也适用于主动监控。

    google-business-profile-pp-cli tail --resource locations --interval 30s --follow=false --agent
    

操作示例

归档后搜索地点线索
google-business-profile-pp-cli workflow archive --agent && google-business-profile-pp-cli search "Main Street" --data-source local --type locations --limit 10 --json

刷新本地存储,然后立即搜索地点名称、城市或其他文本线索。

按本地字段统计地点数量
google-business-profile-pp-cli analytics --type locations --group-by storeCode --limit 25 --json

直接从已同步的归档中快速获取分组计数,无需先将记录导出到其他工具。

命令参考

accounts — 管理账号

  • google-business-profile-pp-cli accounts accept — 接受指定邀请。
  • google-business-profile-pp-cli accounts create — 在指定上级账号下,使用指定名称和类型创建账号。
  • google-business-profile-pp-cli accounts create-admins — 邀请指定用户成为指定账号的管理员。
  • google-business-profile-pp-cli accounts decline — 拒绝指定邀请。
  • google-business-profile-pp-cli accounts delete — 从指定账号中移除指定管理员。
  • google-business-profile-pp-cli accounts get — 获取指定账号。
  • google-business-profile-pp-cli accounts list — 列出经过身份验证的用户的所有账号。
  • google-business-profile-pp-cli accounts list-admins — 列出指定账号的管理员。
  • google-business-profile-pp-cli accounts list-invitations — 列出指定账号的待处理邀请。
  • google-business-profile-pp-cli accounts patch — 更新指定账号管理员的管理员信息。

attributes — 管理属性

  • google-business-profile-pp-cli attributes — 返回具有给定主要类别和国家/地区的地点可用的属性列表。

business-profile-performance-locations — 管理商家资料效果地点

  • google-business-profile-pp-cli business-profile-performance-locations fetch-multi-daily-metrics-time-series — 返回给定时间范围内与指定每日指标相关的每个日期的值。
  • google-business-profile-pp-cli business-profile-performance-locations get-daily-metrics-time-series — 返回给定时间范围内与指定每日指标相关的每个日期的值。
  • google-business-profile-pp-cli business-profile-performance-locations list — 返回用于在搜索或地图中查找商家的搜索关键字。

categories — 管理类别

  • google-business-profile-pp-cli categories batch-get — 返回与提供的语言和 GConcept ID 对应的商家类别列表。
  • google-business-profile-pp-cli categories list — 返回商家类别列表。搜索会匹配类别名称,但不会匹配类别 ID。

chains — 管理连锁品牌

  • google-business-profile-pp-cli chains get — 获取指定的连锁品牌。如果连锁品牌不存在,则返回 NOT_FOUND。
  • google-business-profile-pp-cli chains search — 根据连锁品牌名称搜索连锁品牌。

google_locations — 管理 Google 地点

  • google-business-profile-pp-cli google-locations search — 搜索所有与指定请求匹配的可能地点。

locations — 管理地点

  • google-business-profile-pp-cli locations <name> — 将地点从用户拥有的账号转移到同一用户管理的另一个账号。

my-business-business-accounts — 管理我的商家业务账号

  • google-business-profile-pp-cli my-business-business-accounts create — 创建一个由已登录用户拥有的新地点。
  • google-business-profile-pp-cli my-business-business-accounts list — 列出指定账号的地点。

my-business-business-locations — 管理我的商家业务地点

  • google-business-profile-pp-cli my-business-business-locations delete — 删除地点。如果无法使用 API 删除此地点,并且它在 `google.mybusiness. 中被标记为不可删除,
  • google-business-profile-pp-cli my-business-business-locations get-google-updated — 获取地点在 Google 地图和搜索中实时显示的属性。
  • google-business-profile-pp-cli my-business-business-locations patch — 更新指定地点。

my-business-lodging-locations — 管理我的商家住宿地点

  • google-business-profile-pp-cli my-business-lodging-locations get-google-updated — 返回特定地点经 Google 更新后的住宿信息。
  • google-business-profile-pp-cli my-business-lodging-locations get-lodging — 返回特定地点的住宿信息。
  • google-business-profile-pp-cli my-business-lodging-locations update-lodging — 更新特定地点的住宿信息。

my-business-notifications-accounts — 管理我的商家通知账号

  • google-business-profile-pp-cli my-business-notifications-accounts get-notification-setting — 返回账号的 pubsub 通知设置。
  • google-business-profile-pp-cli my-business-notifications-accounts update-notification-setting — 设置账号的 pubsub 通知设置,告知 Google 应将 pubsub 通知发送到哪个主题。

my-business-place-locations — 管理我的商家地点

  • google-business-profile-pp-cli my-business-place-locations create — 创建与指定地点关联的操作链接,并返回该链接。
  • google-business-profile-pp-cli my-business-place-locations delete — 删除指定地点的操作链接。
  • google-business-profile-pp-cli my-business-place-locations get — 获取指定的操作链接。
  • google-business-profile-pp-cli my-business-place-locations list — 列出指定地点的操作链接。
  • google-business-profile-pp-cli my-business-place-locations patch — 更新指定的操作链接并返回该链接。

my-business-q-locations — 管理我的商家问答地点

  • google-business-profile-pp-cli my-business-q-locations create — 为指定地点添加问题。
  • google-business-profile-pp-cli my-business-q-locations delete — 删除当前用户提出的特定问题。
  • google-business-profile-pp-cli my-business-q-locations delete-answersdelete — 删除当前用户对某个问题撰写的回答。
  • google-business-profile-pp-cli my-business-q-locations list — 返回指定地点的问题分页列表,以及其中部分问题的回答。
  • google-business-profile-pp-cli my-business-q-locations list-answers — 返回指定问题的回答分页列表。
  • google-business-profile-pp-cli my-business-q-locations patch — 更新当前用户提出的特定问题。
  • google-business-profile-pp-cli my-business-q-locations upsert — 为指定问题创建回答,或更新用户已撰写的现有回答。

my-business-verifications-locations — 管理我的商家验证地点

  • google-business-profile-pp-cli my-business-verifications-locations complete — 完成处于 PENDING 状态的验证。仅非 AUTO 验证方式需要执行此操作。
  • google-business-profile-pp-cli my-business-verifications-locations fetch-verification-options — 以指定语言返回某个地点所有符合条件的验证选项。
  • google-business-profile-pp-cli my-business-verifications-locations get-voice-of-merchant-state — 获取 VoiceOfMerchant 状态。
  • google-business-profile-pp-cli my-business-verifications-locations list — 按创建时间排序,列出某个地点的验证记录。
  • google-business-profile-pp-cli my-business-verifications-locations verify — 启动某个地点的验证流程。

place_action_type_metadata — 管理地点操作类型元数据

  • google-business-profile-pp-cli place-action-type-metadata — 返回某个地点或国家/地区可用的地点操作类型列表。

verification_tokens — 管理验证令牌

  • google-business-profile-pp-cli verification-tokens — 根据提供的地点数据生成令牌,以验证该地点。
查找合适的命令

如果你知道要做什么,但不知道哪个命令可以完成,请直接询问 CLI:

google-business-profile-pp-cli which "<capability in your own words>"

which 会根据自然语言能力查询,从此 CLI 精选的功能索引中找出最匹配的命令。退出码 0 表示至少找到一个匹配项;退出码 2 表示没有可信的匹配项,此时请改用 --help 或尝试更具体的查询。

身份验证设置

使用 google-business-profile-pp-cli login 通过 OAuth2 进行身份验证,让 CLI 能够为 Google Business Profile API 创建并刷新访问令牌。只有在你已有短期访问令牌且需要以非交互方式运行时,才使用 GOOGLE_BUSINESS_PROFILE_OAUTH2 环境变量作为备用方式。

运行 google-business-profile-pp-cli doctor 以验证设置。

Agent 模式

在任何命令后添加 --agent。它会展开为:--json --compact --no-input --no-color --yes。

  • 可通过管道传递 — JSON 输出到 stdout,错误输出到 stderr

  • 可筛选 — --select 保留部分字段。点分路径可深入嵌套结构;数组会逐项遍历。对于冗长 API,缩小上下文至关重要:

    google-business-profile-pp-cli accounts list --agent --select id,name,status
    
  • 可预览 — --dry-run 显示请求,但不发送

  • 支持离线 — 有本地 SQLite 存储时,同步/搜索命令可以使用该存储

  • 非交互式 — 绝不提示,每项输入都是一个标志

  • 明确重试策略 — 仅当已存在的创建操作应视为成功时使用 --idempotent;仅当删除目标不存在也应视为成功时使用 --ignore-missing

响应封装

从本地存储或 API 读取的命令会将输出封装在来源信息中:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

解析 .results 获取数据,并查看 .meta.source 以确定数据来自实时来源还是本地存储。只有当 stdout 是终端且未设置任何机器格式标志(--json、--csv、--compact、--quiet、--plain、--select)时,才会将便于人类阅读的 N results (live) 摘要打印到 stderr;管道/Agent 使用者和显式指定格式的运行会在 stdout 输出纯 JSON。

Agent 反馈

当你(或 Agent)发现此 CLI 有不妥之处时,请记录下来:

google-business-profile-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
google-business-profile-pp-cli feedback --stdin < notes.txt
google-business-profile-pp-cli feedback list --json --limit 10

条目会在本地保存到 ~/.local/share/google-business-profile-pp-cli/feedback.jsonl。除非设置了 GOOGLE_BUSINESS_PROFILE_FEEDBACK_ENDPOINT,并且传入了 --send 或设置了 GOOGLE_BUSINESS_PROFILE_FEEDBACK_AUTO_SEND=true,否则绝不会通过 POST 发送。默认行为仅保存在本地。

写下让你感到意外的地方,而不是提交错误报告。简短、具体、一行即可:这部分会不断累积价值。

输出交付

每条命令都接受 --deliver <sink>。输出会发送到指定的目标,同时输出到 stdout,或取代 stdout 输出,这样 Agent 无需手动通过管道传递即可路由命令结果。支持以下三种目标:

目标效果
stdout默认;仅写入 stdout
file:<path>将输出原子性地写入 <path>(临时文件 + 重命名)
webhook:<url>将输出正文 POST 到该 URL(使用 --compact 时为 application/json 或 application/x-ndjson)

不支持的方案会被拒绝,并返回列出受支持方案的结构化错误。Webhook 请求失败时会返回非零状态码,并在 stderr 记录 URL 和 HTTP 状态码。

命名配置

配置是一组已保存的标志值,可在多次调用间重复使用。当定时运行的 Agent 每次都以相同配置调用同一命令时,可以使用配置——这是 HeyGen 的“Beacon”模式。

google-business-profile-pp-cli profile save briefing --json
google-business-profile-pp-cli --profile briefing accounts list
google-business-profile-pp-cli profile list --json
google-business-profile-pp-cli profile show briefing
google-business-profile-pp-cli profile delete briefing --yes

显式标志始终优先于配置值;配置值优先于默认值。agent-context 会在 available_profiles 下列出所有可用配置,便于进行自检的 Agent 在运行时发现它们。

退出码

代码含义
0成功
2用法错误(参数错误)
3未找到资源
4需要身份验证
5API 错误(上游问题)
7请求过于频繁(等待后重试)
10配置错误

参数解析

解析 $ARGUMENTS:

  1. 为空、help 或 --help → 显示 google-business-profile-pp-cli --help 输出
  2. 以 install 开头 → 以 mcp 结尾 → 安装 MCP;否则 → 参见上文的先决条件
  3. 其他任何内容 → 直接使用(作为带 --agent 的 CLI 命令执行)

安装 MCP 服务

  1. 安装 MCP 服务:
    go install github.com/mvanhorn/printing-press-library/library/marketing/google-business-profile/cmd/google-business-profile-pp-mcp@latest
    
  2. 在 Claude Code 中注册:
    claude mcp add google-business-profile-pp-mcp -- google-business-profile-pp-mcp
    
  3. 验证:claude mcp list

直接使用

  1. 检查是否已安装:which google-business-profile-pp-cli 如果未找到,则提供安装选项(参见本技能顶部的先决条件)。
  2. 根据上文的独特功能和命令参考,为用户查询匹配最合适的命令。
  3. 使用 --agent 标志执行:
    google-business-profile-pp-cli <command> [subcommand] [args] --agent
    
  4. 如果存在歧义,请查看子命令帮助:google-business-profile-pp-cli <command> --help。

评论

支持 Markdown