X WebMCP
Use this skill to operate X through the built-in --site x bridge preset in @webmcp-bridge/local-mcp.
For generic bridge setup patterns or non-X sites, switch to $webmcp-bridge.
Prerequisites
- -
uxc is installed and available in PATH. - INLINECODE5 is installed and available in
PATH. - Network access to
https://x.com. - On a fresh machine, or under an isolated
HOME, install Playwright browsers first with npx playwright install. - X is auth-sensitive. Expect
bootstrap_then_attach behavior when the profile is not signed in yet.
Core Workflow
- 1. Ensure the fixed X link exists:
-
command -v x-webmcp-cli
- if missing or pointed at the wrong profile, run
skills/x-webmcp/scripts/ensure-links.sh
- 2. Inspect the bridge and tool schema before calling tools:
-
x-webmcp-cli -h
-
x-webmcp-cli timeline.home.list -h
-
x-webmcp-cli grok.chat -h
-
x-webmcp-cli article.publishMarkdown -h
- 3. Check authentication state first when the profile is new or looks stale:
-
x-webmcp-cli bridge.session.status
-
x-webmcp-cli auth.get
- if the session is not ready, start bootstrap or switch to headed:
-
x-webmcp-cli bridge.session.bootstrap
-
x-webmcp-cli bridge.session.mode.set '{"mode":"headed"}'
-
x-webmcp-cli bridge.open
- 4. Use read tools for timelines, conversations, and profiles:
-
x-webmcp-cli timeline.home.list limit=10
-
x-webmcp-cli search.tweets.list '{"query":"playwright","mode":"latest","limit":10}'
-
x-webmcp-cli tweet.get '{"url":"https://x.com/.../status/..."}'
-
x-webmcp-cli tweet.conversation.get '{"id":"2033895522382319922","limit":10}'
-
x-webmcp-cli user.get username=jack
- 5. Use write tools only after reading help and confirming user intent:
-
x-webmcp-cli tweet.create '{"text":"hello from webmcp","dryRun":true}'
-
x-webmcp-cli tweet.reply '{"id":"2033895522382319922","text":"reply text","dryRun":true}'
-
x-webmcp-cli article.publishMarkdown '{"markdownPath":"/abs/path/post.md","dryRun":true}'
- 6. Use Grok through the same authenticated X session:
-
x-webmcp-cli grok.chat '{"prompt":"Summarize this thread","timeoutMs":180000}'
- for uploads, pass absolute local file paths in
attachmentPaths
- 7. Parse JSON output only:
- success path:
.ok == true, consume
.data
- failure path:
.ok == false, inspect
.error.code and INLINECODE36
Default Target
The built-in preset uses:
CODEBLOCK0
The default profile path is:
CODEBLOCK1
Refresh the link with:
CODEBLOCK2
Guardrails
- - Keep the X profile isolated from other sites.
- X uses
bootstrap_then_attach; do not expect page tools to work until the managed profile is authenticated. - Prefer explicit
bridge.session.mode.set over relaunching the command to change runtime mode. - INLINECODE39 and article publishing can take a long time. Increase
timeoutMs instead of retrying aggressively. - For local uploads such as
attachmentPaths, markdownPath, or coverImagePath, always use absolute filesystem paths. - Use
dryRun for destructive or public write tools first when available. - If the user closes the visible X window manually, the headed owner session ends. Run
x-webmcp-cli bridge.open again if you still need a visible session on the same profile.
References
- - Common command patterns:
-
references/usage-patterns.md
- INLINECODE47
X WebMCP
使用此技能通过 @webmcp-bridge/local-mcp 中内置的 --site x 桥接预设来操作 X。
如需通用桥接设置模式或非 X 站点,请切换到 $webmcp-bridge。
前置条件
- - uxc 已安装并位于 PATH 中。
- npx 已安装并位于 PATH 中。
- 可访问 https://x.com 的网络连接。
- 在新机器或隔离的 HOME 环境下,先使用 npx playwright install 安装 Playwright 浏览器。
- X 对认证敏感。当配置文件尚未登录时,预期会出现 bootstrapthenattach 行为。
核心工作流程
- 1. 确保固定的 X 链接存在:
- command -v x-webmcp-cli
- 如果缺失或指向错误的配置文件,运行 skills/x-webmcp/scripts/ensure-links.sh
- 2. 在调用工具前检查桥接和工具模式:
- x-webmcp-cli -h
- x-webmcp-cli timeline.home.list -h
- x-webmcp-cli grok.chat -h
- x-webmcp-cli article.publishMarkdown -h
- 3. 当配置文件是新的或看起来过时时,首先检查认证状态:
- x-webmcp-cli bridge.session.status
- x-webmcp-cli auth.get
- 如果会话未就绪,启动引导或切换到有头模式:
- x-webmcp-cli bridge.session.bootstrap
- x-webmcp-cli bridge.session.mode.set {mode:headed}
- x-webmcp-cli bridge.open
- 4. 使用读取工具获取时间线、对话和个人资料:
- x-webmcp-cli timeline.home.list limit=10
- x-webmcp-cli search.tweets.list {query:playwright,mode:latest,limit:10}
- x-webmcp-cli tweet.get {url:https://x.com/.../status/...}
- x-webmcp-cli tweet.conversation.get {id:2033895522382319922,limit:10}
- x-webmcp-cli user.get username=jack
- 5. 仅在阅读帮助并确认用户意图后使用写入工具:
- x-webmcp-cli tweet.create {text:hello from webmcp,dryRun:true}
- x-webmcp-cli tweet.reply {id:2033895522382319922,text:reply text,dryRun:true}
- x-webmcp-cli article.publishMarkdown {markdownPath:/abs/path/post.md,dryRun:true}
- 6. 通过同一已认证的 X 会话使用 Grok:
- x-webmcp-cli grok.chat {prompt:Summarize this thread,timeoutMs:180000}
- 对于上传,在 attachmentPaths 中传递绝对本地文件路径
- 7. 仅解析 JSON 输出:
- 成功路径:.ok == true,使用 .data
- 失败路径:.ok == false,检查 .error.code 和 .error.message
默认目标
内置预设使用:
bash
--site x
默认配置文件路径为:
bash
~/.uxc/webmcp-profile/x
使用以下命令刷新链接:
bash
skills/x-webmcp/scripts/ensure-links.sh
防护措施
- - 保持 X 配置文件与其他站点隔离。
- X 使用 bootstrapthenattach;在托管配置文件通过认证之前,不要期望页面工具能正常工作。
- 优先使用显式的 bridge.session.mode.set,而不是重新启动命令来更改运行时模式。
- grok.chat 和文章发布可能需要较长时间。增加 timeoutMs 而不是激进地重试。
- 对于本地上传,如 attachmentPaths、markdownPath 或 coverImagePath,始终使用绝对文件系统路径。
- 对于破坏性或公开的写入工具,如果可用,请先使用 dryRun。
- 如果用户手动关闭可见的 X 窗口,有头所有者会话将结束。如果仍需要在同一配置文件上使用可见会话,请再次运行 x-webmcp-cli bridge.open。
参考
- references/usage-patterns.md
- scripts/ensure-links.sh