x-feed-mcp

x-feed-mcp

A least-privilege, read-only MCP server that returns recent tweets from a set of tracked X (Twitter) accounts via a single tool.

Category
访问服务器

README

x-feed-mcp

A least-privilege, read-only Model Context Protocol server that returns recent tweets from a set of tracked X (Twitter) accounts.

It exposes one tool, get_recent_tweets, and nothing else:

  • It can read the most recent tweets from a set of handles, using a logged-in session.
  • It cannot post, reply, like, follow, DM, read your home timeline, or write anything. Only reading tracked handles is implemented.

The tracked handles are passed dynamically by the caller on each call, so the set can grow over time without redeploying. It authenticates with a cookie-derived API key (via rettiwt-api), no paid X API tier, and, importantly, no automated password login: you log in by hand once and encode the resulting cookies.

Honest limitations (read before relying on it)

  • Against X's Terms of Service. Programmatic access via session cookies breaks X's ToS. Use a dedicated throwaway account, never your personal one; expect it to be flagged/banned eventually.
  • Cookies expire. The session dies periodically (days to weeks, sooner if flagged). When it does, the tool returns a clear "session expired" error and you must log in again, regenerate X_API_KEY, and update it. Low-maintenance, not zero-maintenance.
  • Brittle upstream. It depends on X's internal endpoints via rettiwt-api; X changes break it until the library updates.

If you need durability, prefer official RSS/news feeds. This server is the pragmatic option when you specifically want to read a curated set of X accounts and accept the upkeep.

Requirements

  • Node.js 20+.
  • A dedicated X account, logged in.

Configuration

Variable Required Description
X_API_KEY Yes base64 of your account cookies (auth_token, ct0, twid). See below.
X_HANDLES No Optional static fallback set of handles (comma/space separated, @ optional) used only when a call omits handles. Usually left unset so handles are passed dynamically.

For remote (HTTP) deployment, also: MCP_TRANSPORT=http, MCP_AUTH_TOKEN (bearer secret), optional PORT, and optional keepalive (KEEPALIVE_URL / RENDER_EXTERNAL_URL, KEEPALIVE_MINUTES).

Generating X_API_KEY

Log into your dedicated account, open the browser console, and run:

btoa("auth_token=YOUR_AUTH_TOKEN;ct0=YOUR_CT0;twid=YOUR_TWID;")

Get each value from DevTools → Application → Cookies → https://x.com (auth_token ~40 chars, ct0 long, twid looks like u%3D<userid>). The console prints a long base64 string, that is your X_API_KEY (a few hundred characters). It grants full access to that account, so keep it to the throwaway and never commit it.

The tool: get_recent_tweets

Field Type Required Description
handles string[] Optional if X_HANDLES is set Handles to fetch (with or without @). Pass the current set here to keep it dynamic.
count number No How many merged tweets to return, newest first (1-100). Default 30.
includeReplies boolean No Include @-replies. Default false (replies are usually noise for a digest).

Handles are fetched in small batches (X caps from: operators per search query), merged, de-duplicated, and sorted newest-first. Output is a compact text list of author, timestamp, text, and URL.

Remote deployment (HTTP transport)

Run as an always-on service and add it to Claude as a custom connector. The /mcp endpoint requires a bearer token (MCP_AUTH_TOKEN), reachable as an Authorization: Bearer header or as /mcp/<token> in the path for connector UIs that only take a URL. GET /health is unauthenticated (health check + keepalive). A render.yaml blueprint is included; set secrets in the host dashboard, never in the file.

Local development

npm install
npm run build
npm test                                   # unit + HTTP tests (no network)
npm run test:feed                          # live: default handles
npm run test:feed -- 20 @sama @OpenAI      # live: count + explicit handles
npm run test:users -- @sama @AnthropicAI   # live: probe specific handles

The live scripts hit real X endpoints and need a valid X_API_KEY.

Security

See SECURITY.md. The cookie key is read only from the environment, never logged, and grants full access to the connected account, keep it on a dedicated throwaway. Revoking it (log the account out of all sessions) immediately disables this integration.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选