SuperAPI AI Directory

supsub-mp

General & other

View repository

Updated 10-16 04:41

About this skill

supsub-mp Skill

Search WeChat Official Accounts (async task, CLI waits synchronously by default for up to 30 seconds), and cancel an in-progress search task. After getting mpId , the next step is supsub sub add --mp-id <mpId>(see supsub-sub skill)—— mp search returned by mpId is a WeChat-native base64 string,cannotbe passed to --source-id(that is supsub's internal positive-integer ID, a different ID space).

Prerequisites

  • Install:curl -fsSL https://raw.githubusercontent.com/SupSub-AI/supsub-cli/master/scripts/install.sh | bash(native install, installs to ~/.local, supports background auto-update); or package manager npm i -g @supsub/cli / pnpm add -g @supsub/cli
  • Already logged in:supsub auth status shows Authenticated (on first use, first supsub auth login)
  • When unauthorized (exit 2 / UNAUTHORIZED), do not stop at "you are not logged in": directly run supsub auth login to open browser authorization for the user (the command will automatically open the browser and block waiting for authorization, so use a sufficiently long timeout, such as 10 minutes; the user only needs to click confirm in the browser and does not need to enter anything in the terminal), and after authorization succeeds, retry the original command. In a browserless / headless environment, fall back to prompting the user SUPSUB_NO_BROWSER=1 supsub auth login。

Commands

Search Official Account (async, auto-poll)

supsub mp search <name>

<name> is the Official Account name keyword (quotes recommended). Internal command flow:

  1. POST /api/mps/search-tasks creates an async task, obtaining searchId。
  2. The CLI polls the task status every 2s,for up to 30 seconds。
  3. The backend will, across multiple polls, one by one return candidate Official Accounts, and the CLI automatically accumulates and deduplicates them.
  4. After receiving finished=true , output all candidates at once as the result.
  5. If not completed within 30 seconds → exit and return searchId, with a hint message.

Fields for each candidate:mpId, name, img, description, isSubscribed。

# 同步搜索(实测约 15-30 秒,工具超时请设到 60s 以上)
supsub mp search "机器之心"

# JSON
supsub mp search "机器之心" -o json

JSON shape (success):{"success":true,"data":[{"mpId":"...","name":"...","img":"...","description":"...","isSubscribed":false}, ...]}

What is returned isa batch of candidates(measured: 10 for "机器之心", 5 for "阮一峰"), not a single exact match. See the account-selection constraints in Agent Usage Notes below.

Not found: exits with MP_NOT_FOUND error (non-zero exit code).

Timeout: exits with MP_SEARCH_TIMEOUT error, and the error body includes data.searchId, with a hint message of the form 30 秒内未完成,可重试 supsub mp search 或取消任务: supsub mp search-cancel <searchId>。

⚠️ Timeout handling: the CLI does not provide a recovery-type query command. When a timeout occurs, the user has only two paths — rerun supsub mp search <name>, or call supsub mp search-cancel <searchId> to cancel that orphan task and then try again.


Cancel a running search task

supsub mp search-cancel <searchId>

<searchId> comes from the previous supsub mp search error data returned in the timeout branch (JSON mode:{"success":false,"error":{"code":"MP_SEARCH_TIMEOUT","data":{"searchId":"..."}}} this kind of shape is handled by dieWith and output() ; in table mode the error string will directly include searchId)。

supsub mp search-cancel sid_abc123
supsub mp search-cancel sid_abc123 -o json

JSON shape: {"success":true,"data":{"message":"已取消"}}

When the task does not exist or has been canceled, exits with TASK_NOT_FOUND error (HTTP 404 → non-zero exit code).


Agent Usage Notes

  • mp search is a synchronously wrapped async task: callers generally do not need to care about searchId, and can just take the result array; only in the 30-second timeout branch do they need to handle searchId。
  • For parsing results, uniformly use -o json. On success, data is Mp[]; on failure, follow the standard ErrorEnvelope(code、message, optional data.searchId)。
  • Search → Subscribe chain (most common):
    # 1. 列出候选,连 name 一起看(实测「机器之心」返回 10 条)
    supsub mp search "机器之心" -o json | jq -r '.data[] | "\(.mpId)\t\(.isSubscribed)\t\(.name)"'
    # 2. 与用户确认选中哪一个后,用 --mp-id 订阅(走 POST /api/mps;type 默认 MP,可省)
    #    可顺带 --group <gid> 一步入组
    supsub sub add --mp-id "MzA3MzI4MjgzMw==" --group 1166
    
  • ⚠️ Never jq '.data[0]' directly take the first item. Measured mp search "机器之心" 's 10 candidates include near-name accounts like "机器之心PRO会员" and "机器之心SOTA模型", as well as completely unrelated accounts like "新智元" and "量子位".You must list the candidates (name + description + isSubscribed) for the user to choose from, and only subscribe after confirmation; especially when there is more than one same-name/near-name account, you must not decide for the user.
  • ⚠️ Do not treat mpId as --source-id:mp search returned by mpId is a WeChat native base64 string (e.g. MzkyNTYzODk0NQ==),supsub sub add --source-id expects supsub's internal positive integer sourceId (from supsub search / sub list), the two belong to different ID spaces. Even if the base64 decodes to a number, the backend will reject it with "information source does not exist". Uniformly use --mp-id。
  • candidate field is mpId / name / img / description / isSubscribed。isSubscribed measured to exist(verified in the dev environment in 2026-07), and you can directly use it to skip already-subscribed accounts, without having to go around supsub search --type MP or compare sub list. If a certain backend version really lacks this field, fall back to comparing sub list。
  • mp search internal fixed polling: interval 2s, total duration 30s (POLL_INTERVAL_MS / POLL_MAX_MS), the CLI does not expose a tuning flag.Measured, one real search takes about 15-30 seconds("机器之心" 27.4s, "阮一峰" 14.7s). Therefore: when calling this command, set the tool timeout to 60s or more, do not use the default value; and before initiating, first tell the user "this step will take about half a minute", do not let the user think it is stuck.
  • The backend returns candidate official accounts in a "streaming" manner: the CLI already deduplicates (by mpId), the caller does not need to deduplicate again.
  • The only legal follow-up actions for the timeout branch are:supsub mp search-cancel <searchId> cancel the orphan task, or re-initiate supsub mp search <name>。
  • Exit codes:0 OK; business errors such as timeout / not found / task does not exist (backend 4xx) are 1;2 UNAUTHORIZED,10 network errors,11 server errors (5xx).