MT

miles0sage/twitter-mcp

浏览器自动化

本页由 AI 翻译,技术细节请以原文为准。 查看原文

4 stars 4 forks 质量 66 趋势 12MIT

Free Twitter/X MCP server — search, post, read feed, trending — no API key needed. Playwright-based.

概览

No API key needed -- uses persistent browser sessions. Twitter's API costs $100+/month and rate-limits everything. This MCP server uses with a persistent Chrome profile instead -- zero API fees, no rate limit headaches. Your AI agent gets full Twitter access through the Model Context Protocol. Works with Claude Code, Cursor, Windsurf, or any MCP-compatible client. Read-only tools work without authentication. Write tools require a one-time browser login (cookies persist automatically). Add to your MCP config (~/.mcp.json or client settings): This server uses a stored at ~/.twitter-mcp/chrome-profile/. Log in once and your session persists across restarts. Once logged in, cookies are saved to the Chrome profile. All future MCP calls reuse the session automatically. Twitter blocks headless browsers. The server runs Chromium with DISPLAY=:99 (Xvfb) by default for server environments. On desktop, it uses your normal display.

README

以下为原文 README 节选,完整内容请查看原文。

Twitter/X MCP Server

Read, search, and post on Twitter/X from any AI agent. No API key needed – uses persistent browser sessions.


Why This Exists

Twitter’s API costs $100+/month and rate-limits everything. This MCP server uses Playwright browser automation with a persistent Chrome profile instead – zero API fees, no rate limit headaches. Your AI agent gets full Twitter access through the Model Context Protocol.

Works with Claude Code, Cursor, Windsurf, or any MCP-compatible client.


Tools

Category Tool Description Auth Required
Read twitter_search Search tweets by keyword or hashtag No
twitter_feed Read your home timeline Yes
twitter_bookmarks Read your saved bookmarks Yes
twitter_user Get a user’s profile info No
twitter_user_tweets Get tweets from a specific user No
twitter_trending Get trending topics No
twitter_notifications Read your notifications Yes
Write twitter_post Post a new tweet Yes
twitter_reply Reply to a tweet Yes
twitter_like Like a tweet Yes
twitter_retweet Retweet a tweet Yes

No API key needed. Read-only tools work without authentication. Write tools require a one-time browser login (cookies persist automatically).


Quick Start

git clone https://github.com/Miles0sage/twitter-mcp.git
cd twitter-mcp
pip install -r requirements.txt
playwright install chromium

Add to your MCP config (~/.mcp.json or client settings):

{
  "mcpServers": {
    "twitter": {
      "command": "python3",
      "args": ["server.py"],
      "cwd": "/path/to/twitter-mcp"
    }
  }
}

Authentication

This server uses a persistent Chrome profile stored at ~/.twitter-mcp/chrome-profile/. Log in once and your session persists across restarts.

First-time setup

# Opens a real browser -- log in to Twitter/X manually
python3 -c "from browser_session import login; login()"

Once logged in, cookies are saved to the Chrome profile. All future MCP calls reuse the session automatically.

Headless vs non-headless

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "twitter": { "command": "python3", "args": ["server.py"], "cwd": "/path/to/twitter-mcp" } } }