X Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited X Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
一个基于 Node.js 的 X/Twitter MCP Server,提供用户资料查询、推文搜索、推文详情获取、单条媒体下载、批量媒体下载等能力。
当前工具集:
x_get_user_profilex_get_tweetsx_search_tweetsx_get_tweet_detailx_download_mediax_download_all_media/media 时间线中的媒体stdio 方式挂载到 MCP Hostx.com建议环境:
HTTP_PROXY / HTTPS_PROXYsrc/: TypeScript 源码dist/: 构建产物downloads/: 下载的媒体文件cookies.txt: Netscape 格式 Cookie 文件.env.example: 环境变量示例注意:
downloads/cookies.txtcookies.txt.bak-*.env这些文件都已经加入 .gitignore,不会上传到远端仓库。
npm install项目支持两种方式提供登录态,优先级如下:
X_COOKIEcookies.txt复制示例文件:
cp .env.example .env把浏览器里的 Cookie 粘进去:
X_COOKIE=auth_token=xxx; ct0=xxx; ...cookies.txt把浏览器导出的 Netscape Cookie 文件保存为项目根目录的 cookies.txt。
代码会自动读取:
auth_tokenct0这两个字段缺一不可。
支持的环境变量如下:
X_COOKIE=auth_token=xxx; ct0=xxx; ...
X_BEARER_TOKEN=
DOWNLOAD_DIR=./downloads
HTTP_TIMEOUT=30000
REQUEST_DELAY=2000
DEBUG=true
HTTP_PROXY=http://127.0.0.1:7897
HTTPS_PROXY=http://127.0.0.1:7897
NODE_USE_ENV_PROXY=1说明:
X_COOKIE: 必填,除非你使用 cookies.txtX_BEARER_TOKEN: 可选,当前默认走 X Web 接口DOWNLOAD_DIR: 下载目录,默认 ./downloadsHTTP_TIMEOUT: 请求超时,毫秒REQUEST_DELAY: 拉取时间线时的请求间隔DEBUG: 打开调试日志HTTP_PROXY / HTTPS_PROXY: 访问 X 所需代理NODE_USE_ENV_PROXY=1: 让 Node fetch 使用代理环境变量直接以 TypeScript 运行:
npm run dev等价命令:
npx tsx src/index.ts启动成功后会在标准错误输出看到:
X Scraper MCP Server 已启动 (stdio 模式)构建:
npm run build构建后用 Node 启动:
npm run start等价命令:
node dist/index.js注意:
stdio MCP Server,不会监听 HTTP 端口npm install
npm run build确认构建产物存在:
ls dist/index.js常见路径:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\\Claude\\claude_desktop_config.json如果文件不存在,可以手动创建。
把下面这段加入 claude_desktop_config.json:
{
"mcpServers": {
"x-mcp": {
"command": "node",
"args": [
"/absolute/path/to/x-mcp/dist/index.js"
],
"env": {
"X_COOKIE": "auth_token=xxx; ct0=xxx; ...",
"HTTP_PROXY": "http://127.0.0.1:7897",
"HTTPS_PROXY": "http://127.0.0.1:7897",
"NODE_USE_ENV_PROXY": "1"
}
}
}
}说明:
command 建议直接用 nodeargs 指向本项目的 dist/index.jsX_COOKIE,改为在项目根目录放 cookies.txtx.com 需要代理,把 HTTP_PROXY / HTTPS_PROXY / NODE_USE_ENV_PROXY 一起带上重启后,Claude Desktop 会自动拉起这个本地 MCP Server。
如果接入正常,终端手动运行时会看到:
X Scraper MCP Server 已启动 (stdio 模式)Codex 这边用的是 ~/.codex/config.toml。
npm install
npm run build打开:
~/.codex/config.toml加入下面这段:
[mcp_servers.x-mcp]
command = "node"
args = ["/absolute/path/to/x-mcp/dist/index.js"]
[mcp_servers.x-mcp.env]
X_COOKIE = "auth_token=xxx; ct0=xxx; ..."
HTTP_PROXY = "http://127.0.0.1:7897"
HTTPS_PROXY = "http://127.0.0.1:7897"
NODE_USE_ENV_PROXY = "1"如果你的 Node 版本支持 --use-env-proxy,也可以把 args 改成:
args = ["--use-env-proxy", "/absolute/path/to/x-mcp/dist/index.js"]如果你不想在配置文件里写 Cookie,也可以删掉 X_COOKIE,改为在项目根目录提供 cookies.txt。
如果本机 codex 命令可用,也可以直接执行:
codex mcp add x-mcp -- node /absolute/path/to/x-mcp/dist/index.js执行完后,再去 ~/.codex/config.toml 里补环境变量。
重启后新的会话里就能看到 x-mcp 工具。
如果 Claude 或 Codex 挂载后不可用,优先检查:
npm run builddist/index.js 路径是否写对X_COOKIE 或 cookies.txt 是否有效x.com安装依赖:
npm install开发模式启动:
npm run dev构建:
npm run build生产启动:
npm run start下载某账号 /media 时间线前 50 个媒体文件:
npx tsx src/download-user-media.ts example_user 50检查 /media 时间线分页结构:
npx tsx src/inspect-user-media.ts example_userx_get_user_profile获取用户资料。
参数:
username: 用户名,不带 @x_get_tweets获取用户最新推文。
参数:
usernamecountinclude_retweetsx_search_tweets搜索推文。
参数:
querycountx_get_tweet_detail获取单条推文详情。
参数:
tweet_urlx_download_media下载单条推文中的媒体。
参数:
tweet_urlmedia_type: all / photo / video / gifx_download_all_media扫描最近若干条推文并下载其中媒体。
参数:
usernamecountmedia_typeHTTP 404: Query not foundX Web GraphQL 的 queryId 会变化。当前实现已经加入动态发现机制,但如果再次失效,需要重新检查前端 bundle 中的最新操作 ID。
检查:
command / args 是否正确dist/index.js 是否存在npm run build检查:
x.comHTTP_PROXY / HTTPS_PROXYct0 和 auth_token 是否都存在手工启动:
npm run dev如果需要代理:
HTTP_PROXY=http://127.0.0.1:7897 \
HTTPS_PROXY=http://127.0.0.1:7897 \
NODE_USE_ENV_PROXY=1 \
npm run dev推荐远端:
git remote add origin https://github.com/mhqamx/X-MCP.git如果已存在远端则更新:
git remote set-url origin https://github.com/mhqamx/X-MCP.git~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.