X(Twitter) V2 MCP Server
@NexusX-MCP
An MCP server implementation that provides tools for interacting with the [Twitter/X API v2](https://docs.x.com/x-api/introduction).
Overview
What is X(Twitter) V2 MCP Server?
The X(Twitter) V2 MCP Server is an MCP server implementation that provides tools for interacting with the Twitter/X API v2. It allows AI assistants to retrieve tweets, post new content, reply to tweets, quote tweets, and perform other actions programmatically.
How to use X(Twitter) V2 MCP Server?
Install dependencies with npm i, build with npm run build, and run with npx @modelcontextprotocol/inspector node dist/index.js. Configure authentication via environment variables: TWITTER_API_KEY, TWITTER_API_KEY_SECRET, TWITTER_ACCESS_TOKEN, TWITTER_ACCESS_TOKEN_SECRET.
Key features of X(Twitter) V2 MCP Server
- Retrieve tweets from a specific user’s timeline.
- Post new tweets with optional image attachment.
- Reply to and quote existing tweets.
- Like, follow, and unfollow users.
- Search tweets and get trending topics by location.
- Manage Twitter lists (create, add/remove members, list owned).
Use cases of X(Twitter) V2 MCP Server
- An AI assistant automatically posts scheduled updates to a brand’s timeline.
- A customer‑service bot replies to user mentions or direct requests.
- A content curator searches for trending topics and quotes relevant tweets.
- A social‑media manager schedules replies and follows/unfollows accounts.
- A community bot creates and manages curated Twitter lists.
FAQ from X(Twitter) V2 MCP Server
How do I authenticate the server with X API?
You need to obtain API credentials from the X Developer Dashboard and set the environment variables TWITTER_API_KEY, TWITTER_API_KEY_SECRET, TWITTER_ACCESS_TOKEN, and TWITTER_ACCESS_TOKEN_SECRET.
What tools does the server provide?
The server provides tools for retrieving tweets by user ID or tweet ID, fetching user mentions, posting tweets, replying to tweets, quoting tweets, liking, following/unfollowing users, searching tweets, getting trending topics, and managing lists.
Are all tool parameters required?
No, many tools accept optional parameters, such as paginationToken, exclude, maxResults, imageBase64, description, isPrivate, and woeid. Default values are used when optional parameters are omitted (e.g., maxResults defaults to 10, woeid defaults to 1 for worldwide).
How do I find trending topics for a specific location?
Use the get_trending_topics tool and optionally provide a woeid (Where On Earth ID). The default is 1 (worldwide). Obtain WOEIDs from external sources; the server does not include a lookup tool.
Does the server require any runtime environment?
It requires Node.js and npm. The server is built with TypeScript and runs as a standard MCP server. No external database or additional services are required beyond the X API credentials.