Twitter/X MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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.
Related MCP server: Spectre
Tools
Category | Tool | Description | Auth Required |
Read |
| Search tweets by keyword or hashtag | No |
| Read your home timeline | Yes | |
| Read your saved bookmarks | Yes | |
| Get a user's profile info | No | |
| Get tweets from a specific user | No | |
| Get trending topics | No | |
| Read your notifications | Yes | |
Write |
| Post a new tweet | Yes |
| Reply to a tweet | Yes | |
| Like a tweet | Yes | |
| 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 chromiumAdd 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
Twitter blocks headless browsers. The server runs Chromium with DISPLAY=:99 (Xvfb) by default for server environments. On desktop, it uses your normal display.
# Server/VPS setup
export DISPLAY=:99
Xvfb :99 -screen 0 1920x1080x24 &Keepalive
A keepalive script prevents session expiry by loading Twitter periodically:
# Add to crontab (every 30 min)
*/30 * * * * DISPLAY=:99 python3 /path/to/twitter-mcp/twitter_keepalive.pyUsage Examples
"Search Twitter for AI agent news"
-> Latest tweets matching query, with engagement stats
"Read my feed"
-> Your home timeline, newest first
"Show my bookmarks"
-> Your saved/bookmarked tweets
"Post: Just shipped a new MCP server!"
-> Tweet posted, returns URL
"What's trending?"
-> Top trending topics with tweet counts
"Get @elonmusk's recent tweets"
-> Latest tweets from the userArchitecture
LLM / MCP Client
|
MCP Protocol (stdio)
|
server.py ── registers 11 tools
|
+----+----+--------+
| | |
tools_ tools_ tools_
read.py feed.py write.py
| | |
+----+----+--------+
|
browser_session.py
(persistent Chromium via Playwright)
|
~/.twitter-mcp/chrome-profile/
(cookies + session state)Project Structure
server.py # MCP server, tool registration
tools_read.py # Search, user profile, user tweets, trending
tools_feed.py # Feed, bookmarks, notifications
tools_write.py # Post, reply, like, retweet
browser_session.py # Playwright session management, persistent Chrome profile
twitter_keepalive.py # Session keepalive cron script
api_server.py # Optional REST API wrapperComparison
Feature | Twitter MCP | Twitter API (Basic) | Twitter API (Pro) | Apify Scrapers |
Cost | Free | $100/mo | $5,000/mo | Per-run fees |
Auth | Browser login | OAuth + API key | OAuth + API key | API key |
Post tweets | Yes | Yes | Yes | No |
Read feed | Yes | Limited | Yes | Yes |
Bookmarks | Yes | No | Yes | No |
Search | Yes | Limited | Yes | Yes |
Rate limits | Browser-level | Strict | Strict | Per-plan |
MCP native | Yes | No | No | No |
Setup time | 2 min | 30+ min | Application | 10 min |
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server from TwitterAPI.io that gives AI agents read-only access to Twitter/X data. 12 tools: tweet search with X operators, user profiles, a user's latest tweets, followers and followings, replies, quotes, retweeters, mentions and trends. Connect at https://mcp.twitterapi.io/mcp with a TwitterAPI.io API key or account sign-in; usage is paid per result returned. Separately, TwitterAPI.io also offers x402 pay-per-call HTTP endpoints (tweet search, user info, a user's latest tweets) paid in USDC on Base or Solana with no account or API key; see https://docs.twitterapi.io/x402-pay-per-call. The MCP server itself uses an API key or sign-in.
X (formerly Twitter) posts, profiles, and search for AI agents. Free key, self-minted, no signup.
Read public X (Twitter) data and verify follows, reposts, replies and quotes. 14 read-only tools.
Publish and schedule tweets and threads on X (Twitter) from your AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLM agents to interact with Twitter (X) for searching tweets, posting content with images, analyzing engagement, and extracting topics using the Twitter API.-
- AlicenseCqualityBmaintenanceEnables 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.113111 PyPI12MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to fully automate X/Twitter interactions including searching, posting, engaging, and managing multiple accounts without paid API keys.MIT
- AlicenseNot gradedqualityCmaintenanceProvides 19+ tools for AI agents to interact with X/Twitter, including search, posting, analysis, and monitoring capabilities.23 npm3MIT