/** * 小红书 MCP 客户端(MCP Streamable HTTP / JSON-RPC 薄客户端)。 * * 为什么是 MCP 而不是 Playwright 直驱(2026-10-22 实测): * - 小红书 creator 端的登录态**一半在浏览器内存的 localStorage**,cookies.json 只有 16 条 cookie * - 用同一份 cookie 起 Playwright(headless 与 headed 都试过)⇒ 一律被重定向到 /login * - MCP 服务也没开 CDP 端口(只有 :18060),没法 attach 它的浏览器 * - 且官方明确:**同一账号不允许在多个网页端登录**,两边各自登录会互踢 * ⇒ 结论:小红书这条通道**由 MCP 服务独占浏览器**,mpub 当客户端调它的工具; * mpub 自己保留渲染/文案/配图/闸门/回查/记账的掌控权。 */ export interface XhsToolInfo { name: string; description?: string; inputSchema?: { type?: string; properties?: Record; required?: string[]; }; annotations?: { readOnlyHint?: boolean; destructiveHint?: boolean; title?: string; }; } export interface XhsToolResult { content: { type: string; text?: string; }[]; isError?: boolean; structuredContent?: unknown; } export declare class XhsMcpClient { private readonly url; private readonly token?; constructor(url?: string, token?: string | undefined); private headers; /** 健康检查(服务在不在、是不是本地那套) */ health(): Promise<{ ok: boolean; detail: string; data?: unknown; }>; private rpc; listTools(): Promise; callTool(name: string, args?: Record): Promise; } /** 工具返回值统一解包:优先 structuredContent,其次 content[0].text(能 JSON 就解析) */ export declare function unwrapToolResult(res: XhsToolResult): unknown; export declare function isWriteTool(name: string, info?: XhsToolInfo): boolean;