Skip to main content
Glama

x-public-post

只读 MCP:给 Agent 一个 get_post(url),按 x.com / twitter.com 的 status 链接一条公开帖。默认无 Cookie。

公开两跳打头(FxTwitter,Syndication 备用),工具面只有读一条;帖文标 untrusted,不能当系统指令。

status URL
    → FxTwitter(长帖更常能拿全文)
    → Syndication(备用)
    → 仅当设置了 TWSCRAPE_DB_PATH 才走本机 twscrape

亮点

  • 最小工具面。 只有 get_post;不搜索、不时间线、不发帖。失败走 MCP isError(短码如 invalid_url),preview 降级仍是成功 JSON,避免模型把 error.message 当帖文。

  • 默认零 Cookie。 公开 hop 不读浏览器 Profile。会话库只收本机路径,未配置则不 import twscrape。

  • 长文优先全文。 FxTwitter 打头;Syndication 不当前置阻塞。只缓存 text_status=complete(5 分钟、最多 256 条);preview / 错误不缓存。

  • 不可信输出。 正文、媒体 URL、引用与短链固定 untrusted / source_trust: untrusted_web_content。上游 JSON 已有的 quoted / reply / alt / expanded_url 才映射,零额外 HTTP。媒体只给 URL,MCP 不下载。

  • 护上游。post_id 单飞;全链路约 12s;外部请求最多 2 个并发。

  • 可选人机出口。 x-public-post-get 走同一条 read_post,JSON 或 Markdown(同一套成功字段:正文、引用、链接、图/视频 URL)。

Related MCP server: Spectre

明确不做

  • 不搜索、不时间线、不发帖;不加第二个 MCP 工具。

  • 不在 MCP 里下载图片或视频。

  • 不默认读浏览器 Cookie / Chrome Profile。

启用(clone 之后)

Python 3.10+。先装包装到当前环境:

python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"

复制 .cursor/mcp.json.example.cursor/mcp.json(本机文件不进 git)。示例已指向本仓 .venv 的 Windows 解释器;macOS / Linux 把 command 改成 .venv/bin/python。若 Cursor 解析相对路径失败,再改成绝对路径,保留 args

{
  "mcpServers": {
    "x-public-post": {
      "command": ".venv/Scripts/python.exe",
      "args": ["-m", "x_public_post.server"]
    }
  }
}

在 Cursor Settings → MCP 启用 x-public-post(首次可能要批准)。让 Agent 调用 get_post,传入 https://x.com/.../status/...(可用 ?s=20)。尖括号包裹、markdown 链接、句末句号也可以。

读失败时不要把成功 JSON 里的字段当帖文。只有 URL 不像帖链接时才改链接再试;不要对同一 URL 连打。

可选 CLI(同一条 read_post):

.\.venv\Scripts\x-public-post-get.exe "https://x.com/author/status/123"
.\.venv\Scripts\x-public-post-get.exe "https://x.com/author/status/123" --export md

何时才配会话

只有公开两跳经常失败、又要 GraphQL 补全时才配。用专用小号,按 会话配置 在本机终端写入 accounts.db。在 MCP 设置里加路径(不是 Cookie):

TWSCRAPE_DB_PATH = C:\Users\<你>\AppData\Local\x-public-post\accounts.db

不要把 Cookie 贴进聊天、.env 或 git。

开发

.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
.\.venv\Scripts\python.exe -m pytest

匿名适配器样例在 tests/fixtures/(preview、引用帖、404),测试不打真实 X。

文档

文档

内容

架构设计

入口、编排、适配器链、缓存与失败通道

模块说明

源码与测试落点

diagrams

Archify 交互图(JSON 规格 + 交付 HTML)

License:MIT

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables reading public X (Twitter) content like profiles, tweets, and search results via a stealth browser, without official API costs.
    11
    MIT
  • A
    license
    C
    quality
    A
    maintenance
    Enables AI agents to search, read user profiles, timelines, media, follow threads, track trends, and manage accounts on X/Twitter via GraphQL, without browser automation or paid API keys.
    100
    10
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI agents to read, post, search, and engage with Twitter/X content, including AI-powered reply drafting and analytics.
    17
    MIT