twscrape-twitter-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@twscrape-twitter-mcp read this tweet: https://x.com/example/status/1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
twscrape-twitter-mcp
An MCP server that reads X (Twitter): posts, threads, replies, quotes, and search. It wraps twscrape and uses your own logged-in session, so there's no paid X API and no developer account. Tools return clean markdown shaped for an agent to read, including image, video, and GIF URLs and any external links in a post.
Works with any MCP client over the two standard transports — local stdio and hosted Streamable HTTP.
Tools
Tool | Returns |
| One post as markdown. |
| Root post + the author's self-thread + top replies. |
| Replies to a post. |
| Quote-tweets (best-effort, search-based). |
| A user's recent posts, newest first. Set |
| Search results. Supports |
| A user's profile as markdown: bio, location, follower/following/tweet counts, join date. |
Related MCP server: x-mcp
Install
uv tool install twscrape-twitter-mcp # or: pipx install twscrape-twitter-mcpThen authenticate once (next section) and verify:
twscrape-twitter-mcp smoke # reads one public tweet end-to-endAuthenticate
Reads run against your own X session. Pick one path:
1. Launch a dedicated browser (recommended). Opens a separate Chrome/Brave profile with a DevTools port, you sign in to X once, and the session is captured. It does not touch your daily browser or automate X's login flow.
twscrape-twitter-mcp login --launch-browser chrome # or: brave2. Attach to a dedicated browser profile. Only use this when you already run an isolated Chromium profile with a debug port. Browser debugging exposes browser data, and recent Chrome versions do not enable it for the default profile.
# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222 --user-data-dir=/tmp/x-mcp-browser
# Linux: google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/x-mcp-browser
# Windows: "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir=%TEMP%\x-mcp-browser
twscrape-twitter-mcp login --attach # add --cdp-url for a non-default port3. Headless / CI (raw cookies). A server can't open your desktop browser, so
add a session from auth_token + ct0 cookies. Run this without cookie flags to
enter values through hidden prompts, rather than leaving secrets in shell history:
twscrape-twitter-mcp initThe captured session is reused across restarts. Run login --launch-browser chrome again when it expires,
or to add burner sessions for rate-limit rotation. twscrape-twitter-mcp accounts
lists the pool.
Use burner accounts, not your main — see Legal.
Connect your client
The server runs locally over stdio. Most MCP clients take a JSON block like this:
{
"mcpServers": {
"x": {
"command": "twscrape-twitter-mcp",
"args": ["serve", "--transport", "stdio"]
}
}
}Client-specific equivalents:
claude mcp add x --scope user -- twscrape-twitter-mcp serve --transport stdioAdd the JSON block above to claude_desktop_config.json
(Settings → Developer → Edit Config).
[mcp_servers.x]
command = "twscrape-twitter-mcp"
args = ["serve", "--transport", "stdio"]{
"mcpServers": {
"x": {
"command": "twscrape-twitter-mcp",
"args": ["serve", "--transport", "stdio"]
}
}
}{
"servers": {
"x": {
"command": "twscrape-twitter-mcp",
"args": ["serve", "--transport", "stdio"]
}
}
}For a hosted private instance (see Deploy), point a preconfigured client at the HTTP endpoint with a bearer token. This is static bearer auth, not an OAuth sign-in flow.
{
"mcpServers": {
"x": {
"url": "https://YOUR-APP.example.com/mcp",
"headers": { "Authorization": "Bearer YOUR_TOKEN" }
}
}
}Then ask, e.g. "read this thread: <url>".
Deploy
Run the server always-on and reachable over HTTP (POST /mcp). It ships as a
container; Cloudflare Workers won't work because twscrape is Python with native
deps.
A headless container can't open your desktop browser, so authenticate locally
first (login --attach writes storage_state.json under
TWSCRAPE_TWITTER_MCP_HOME), then ship that session to the host — copy the file to
the mounted volume, or run the cookie-based init over SSH. The server reloads a
persisted session on boot.
Always set a token when exposing HTTP — anyone who can reach the endpoint can use your X session:
export TWSCRAPE_TWITTER_MCP_AUTH_TOKEN=$(openssl rand -hex 32)fly launch --no-deploy
fly volumes create twscrape_twitter_mcp_data --size 1
fly secrets set TWSCRAPE_TWITTER_MCP_AUTH_TOKEN=$(openssl rand -hex 32)
fly deploy
# seed a session onto the volume through hidden prompts:
fly ssh console -C "twscrape-twitter-mcp init"Point Railway at this repo (it reads railway.json + Dockerfile), add a volume
mounted at /data, set TWSCRAPE_TWITTER_MCP_AUTH_TOKEN, and seed a session via
the Railway shell with twscrape-twitter-mcp init.
Clients send Authorization: Bearer <token>.
Configuration
Env var | Default | Purpose |
|
| Where the sqlite account pool lives. Point at a volume in prod. |
|
| Override the pool path directly. |
| (unset) | Required bearer token for HTTP transport. |
| (unset) | Global proxy for every account. |
|
| Browser DevTools endpoint for |
|
| Default timeline and search result count (1–100). |
|
| HTTP port (Railway injects this). |
How it works
The hard part of reading X — GraphQL signing, the x-client-transaction-id
header, TLS fingerprinting — lives entirely in twscrape, which is pinned.
This package is a read-only MCP layer on top and never
touches that machinery. When X changes something and reads break, the fix is a
version bump, not reverse-engineering.
Limits
X can expire, rate-limit, or suspend the account behind your session.
Protected, deleted, geo-blocked, or otherwise restricted posts may not be readable.
Quote-tweet coverage is search-based and incomplete.
Search results depend on X's current search behavior and can vary by session.
It does not decrypt browser cookie stores — use browser attach or cookie
init.
Legal
Reading X with your own logged-in session may violate X's Terms of Service, and accounts used for scraping can be rate-limited or suspended. Use burner accounts, not your main. Provided as-is for research and personal use; you are responsible for how you use it.
License
MIT.
Credits
The hard scraping work is twscrape by
vladkens. This is a read-only MCP layer on top — go star it.
Available Tools
8 toolsauth_statusARead-only
Check whether this server has an active X session, without exposing cookies.
Inputs: no named parameters. Returns: result
read_quotesARead-only
Read quote-tweets of an X post (best-effort, via search:quoted_tweet_id). Coverage is partial, X does not expose a complete quotes endpoint.
Inputs: url_or_id (required), limit. Returns: result
read_repliesARead-only
Read the replies to an X post as markdown.
Inputs: url_or_id (required), limit. Returns: result
read_threadARead-only
Read a full X thread as markdown: the root post, the author's self-thread, and top replies. Pass any tweet in the thread.
Inputs: url_or_id (required), max_replies, include_replies. Returns: result
read_tweetARead-only
Read a single X post by URL or numeric id. Returns clean markdown.
Inputs: url_or_id (required). Returns: result
searchARead-only
Search X and return matching posts as markdown.
product: "Latest" | "Top" | "Media". Supports X operators, e.g. from:user, to:user, has:media, -is:retweet, min_faves:100, since:2026-01-01.
Inputs: query (required), limit, product. Returns: result
user_profileARead-only
Read an X user's profile by handle. Returns clean markdown.
Pass the handle with or without a leading @.
Inputs: username (required). Returns: result
user_timelineARead-only
Read a user's recent posts as markdown, newest first.
Pass the handle with or without a leading @. Set include_replies=True to include the user's replies alongside their standalone posts.
Inputs: username (required), limit, include_replies. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct aspect of X data: auth status, individual tweets, user profiles, threads, replies, quotes, timelines, and search. Even though read_thread and read_replies both involve replies, their scopes are clearly differentiated.
The naming is mostly consistent with snake_case and a read_* prefix for the data access tools, but auth_status, user_profile, user_timeline, and search follow a different pattern. This minor inconsistency does not hinder usability.
Eight tools provide a well-scoped coverage for a read-only Twitter client. Each tool serves a clear purpose and the count is within the ideal range for a focused server.
The tool set covers the core read workflows: tweets, profiles, threads, replies, quotes, timelines, and search. Minor gaps exist, such as no ability to fetch a user's followers/following or to paginate through large result sets, but these are reasonable for the stated purpose.
Maintenance
Related MCP Connectors
Official MCP server for twitterapis.com. Twitter/X search, users, DMs, Grok, monitoring and writes.
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Official twitterapi.io hosted MCP: Twitter/X tweets, users, followers, trends. OAuth or API key.
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.
Related MCP Servers
- AlicenseBqualityDmaintenanceMCP server for interacting with the X platform (Twitter) via MCP clients like Claude, Cursor AI, and Windsurf AI.206MIT
- FlicenseNot gradedqualityBmaintenanceRead-only MCP server for public X/Twitter search and retrieval via twitter.2-38.com-
- AlicenseBqualityDmaintenanceRead-only X/Twitter research MCP server using xAI's Responses API. Supports OAuth login for X Premium users and falls back to API key authentication.5MIT
- AlicenseAqualityBmaintenanceMCP server for the Twitter/X API, enabling search, user profiles, tweets, followers, and more via natural language.94716 npm7MIT