SuperAPI AI Directory

xhs-login

Office & productivity

View repository

Updated 10-15 17:21

About this skill

Execution flow

1. Check login status

Call check_login_status(no parameters), which returns whether already logged in and the username.

  • Logged in → inform the user of the currently logged-in account
  • Not logged in → proceed to step 2

2. Scan QR code to log in

Call get_login_qrcode(no parameters). The MCP tool returns two parts:

  • Text: timeout prompt (including deadline)
  • Image: QR code in PNG format (MCP image content type, Base64 encoded)

Display QR code: The image returned by MCP will be rendered to the user through the client. If the client cannot directly display images (such as a plain text terminal), save the Base64 data as a temporary PNG file, and tell the user the file path so they can open it manually:

# fallback: 保存二维码到临时文件
echo "<base64_data>" | base64 -d > /tmp/xhs-qrcode.png
open /tmp/xhs-qrcode.png   # macOS
xdg-open /tmp/xhs-qrcode.png  # Linux

Prompt the user:

  • Open the Xiaohongshu App and scan the QR code
  • The QR code has a limited validity period; if it expires, it must be obtained again

After scanning is complete, call check_login_status to confirm that login succeeded.

3. Log in again / switch accounts

When the user requests to log in again or switch accounts:

  1. Call delete_cookies(⚠️ requires user confirmation) — clear the current login status
  2. Call get_login_qrcode — obtain a new QR code
  3. Guide the user to scan the QR code

Constraints

  • delete_cookies will clear the login status, and confirmation is required before execution
  • Login requires the user to manually scan the QR code with the mobile App and cannot be completed automatically

Failure handling

Scenario Handling
MCP tool unavailable Guide the user to use /setup-xhs-mcp to complete deployment and connection configuration
QR code timeout Call again get_login_qrcode