X (Twitter)
About
Enables interaction with Twitter through a Model Context Protocol, allowing large language models to post tweets, search for tweets, and reply to tweets.
Details
- Author
- crazyrabbitltc
- Repository
- crazyrabbitLTC/mcp-twitter-server
- GitHub stars
- 13
- Downloads
- 765
- License
- MIT License
- Categories
- Productivity, Developer Tools, Design, AI, Community, Media, Search, API, Frontend, Automation, Project Management, Other, Communication
Jump to
- 53 Total Tools - 33 Twitter API + 20 enhanced SocialData.tools research capabilities
- Advanced Analytics - Thread analysis, network mapping, sentiment analysis, viral tracking
- Bypasses API Restrictions - Enhanced research tools work without Pro tier requirements
- Professional Error Handling - Clear upgrade guidance and graceful API key handling
- 5 Workflow Prompts - Pre-built automation templates
- 6 Dynamic Resources - Real-time API documentation and status
- Full MCP Compliance - Tools, prompts, and resources support
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
X (Twitter)Command (node, npx, python, etc.)nodeArguments-
Argument 1
/path/to/twitter-server/dist/index.js
Environment-
X_API_KEY
your_api_key -
X_API_SECRET
your_api_secret -
X_ACCESS_TOKEN
your_access_token -
X_ACCESS_TOKEN_SECRET
your_access_token_secret
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
1. Clone and Install
git clone <repository-url>
cd twitter-server
npm install
2. Environment Setup
cp .env.example .env
SOCIALDATA_API_KEY="" echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "advancedTweetSearch", "arguments": {"query": "test"}}}' | node dist/index.js
source .env
1. Check error messages - Our enhanced error handling provides clear guidance
2. Review API documentation - X (Twitter) Developer Portal
3. Test with working tools first - Verify basic setup
4. Check environment variables - Ensure all credentials are set
---
postTweet
Post new tweets. Parameters: text (string) - Your tweet content (up to 280 characters).
getTweetById
Retrieve specific tweets. Parameters: tweetId (string) - The ID of the tweet; tweetFields (array) - Optional fields to include.
replyToTweet
Reply to tweets. Parameters: tweetId (string) - The ID of the tweet to reply to; text (string) - Your reply content.
deleteTweet
Delete your tweets. Parameters: tweetId (string) - The ID of the tweet you want to delete.
likeTweet
Like a tweet. Parameters: tweetId (string) - The ID of the tweet to like.
unlikeTweet
Unlike a tweet. Parameters: tweetId (string) - The ID of the tweet to unlike.
retweet
Retweet a tweet. Parameters: tweetId (string) - The ID of the tweet to retweet.
undoRetweet
Undo a retweet. Parameters: tweetId (string) - The ID of the tweet to undo retweet.
getUserInfo
Get user profiles. Parameters: username (string) - The username of the user; fields (array) - Optional fields to include.
getUserTimeline
Get user tweets. Parameters: username (string) - The username of the user whose tweets to retrieve.
followUser
Follow a user. Parameters: username (string) - The username of the user to follow.
unfollowUser
Unfollow a user. Parameters: username (string) - The username of the user to unfollow.
createList
Create X (Twitter) lists. Parameters: name (string) - The name of the list; description (string) - A description of the list.
getUserLists
Get user's lists. Parameters: username (string) - The username of the user whose lists to retrieve.
addUserToList
Manage list members by adding a user. Parameters: listId (string) - The ID of the list; username (string) - The username of the user to add.
removeUserFromList
Manage list members by removing a user. Parameters: listId (string) - The ID of the list; username (string) - The username of the user to remove.
getListMembers
Get list members. Parameters: listId (string) - The ID of the list to retrieve members from.
advancedTweetSearch
Complex queries with operators, bypasses API tier restrictions. Parameters: query (string) - The search query; maxResults (integer) - The maximum number of results to return.
historicalTweetSearch
Access historical tweets beyond standard API limits. Parameters: query (string) - The search query; maxResults (integer) - The maximum number of results to return.
trendingTopicsSearch
Real-time trend analysis and popular content discovery. Parameters: none.
bulkUserProfiles
Multi-user profile analysis in single requests. Parameters: usernames (array) - An array of usernames to retrieve profiles for.
userGrowthAnalytics
User growth pattern analysis over time. Parameters: username (string) - The username of the user to analyze.
userInfluenceMetrics
Engagement scoring and influence calculations. Parameters: username (string) - The username of the user to analyze.
getFullThread
Reconstruct complete Twitter threads with engagement metrics. Parameters: tweetId (string) - The ID of the tweet to reconstruct.
getConversationTree
Map conversation structure including replies and quotes. Parameters: tweetId (string) - The ID of the tweet to analyze.
getThreadMetrics
Thread performance analysis and engagement distribution. Parameters: tweetId (string) - The ID of the tweet to analyze.
findMutualConnections
Discover mutual connections via interactions. Parameters: username (string) - The username of the user to analyze.
analyzeFollowerDemographics
Follower patterns and demographic analysis. Parameters: username (string) - The username of the user to analyze.
mapInfluenceNetwork
Influence mapping and connection strength analysis. Parameters: username (string) - The username of the user to analyze.
getHashtagTrends
Hashtag performance tracking over time with trend analysis. Parameters: hashtag (string) - The hashtag to analyze.
analyzeSentiment
Sentiment analysis with keyword frequency tracking. Parameters: query (string) - The text to analyze; sampleSize (integer) - The number of samples to analyze.
trackVirality
Viral spread patterns and engagement velocity analysis. Parameters: tweetId (string) - The ID of the tweet to analyze.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"x (twitter)": {
"env": {
"X_API_KEY": "your_api_key",
"X_API_SECRET": "your_api_secret",
"X_ACCESS_TOKEN": "your_access_token",
"X_ACCESS_TOKEN_SECRET": "your_access_token_secret"
},
"args": [
"/path/to/twitter-server/dist/index.js"
],
"command": "node"
}
}
}
Linux
{
"env": {
"X_API_KEY": "your_api_key",
"X_API_SECRET": "your_api_secret",
"X_ACCESS_TOKEN": "your_access_token",
"X_ACCESS_TOKEN_SECRET": "your_access_token_secret"
},
"args": [
"/path/to/twitter-server/dist/index.js"
],
"command": "node"
}
Macos
{
"env": {
"X_API_KEY": "your_api_key",
"X_API_SECRET": "your_api_secret",
"X_ACCESS_TOKEN": "your_access_token",
"X_ACCESS_TOKEN_SECRET": "your_access_token_secret"
},
"args": [
"/path/to/twitter-server/dist/index.js"
],
"command": "node"
}
Windows
{
"env": {
"X_API_KEY": "your_api_key",
"X_API_SECRET": "your_api_secret",
"X_ACCESS_TOKEN": "your_access_token",
"X_ACCESS_TOKEN_SECRET": "your_access_token_secret"
},
"args": [
"/c",
"node",
"/path/to/twitter-server/dist/index.js"
],
"command": "cmd"
}
X (Twitter) MCP Server
A comprehensive Model Context Protocol server implementation for X (Twitter) API integration with professional workflow automation, enhanced error handling, and real-time documentation.
π Features
- 53 Total Tools - 33 Twitter API + 20 enhanced SocialData.tools research capabilities
- Advanced Analytics - Thread analysis, network mapping, sentiment analysis, viral tracking
- Bypasses API Restrictions - Enhanced research tools work without Pro tier requirements
- Professional Error Handling - Clear upgrade guidance and graceful API key handling
- 5 Workflow Prompts - Pre-built automation templates
- 6 Dynamic Resources - Real-time API documentation and status
- Full MCP Compliance - Tools, prompts, and resources support
π Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
- X (Twitter) API credentials (Basic tier minimum - $200/month)
Local Installation
1. Clone and Install
git clone <repository-url>
cd twitter-server
npm install
2. Environment Setup
cp .env.example .env
# Edit .env with your credentials
Required Environment Variables:
# Twitter API credentials (Required)
X_API_KEY=your_api_key_here
X_API_SECRET=your_api_secret_here
X_ACCESS_TOKEN=your_access_token_here
X_ACCESS_TOKEN_SECRET=your_access_token_secret_here
# SocialData.tools API key (Optional - enables enhanced research tools)
SOCIALDATA_API_KEY=your_socialdata_api_key_here
SOCIALDATA_BASE_URL=https://api.socialdata.tools # Optional, uses default if not set
3. Build and Run
npm run build
npm start
4. Test the Server
# Test with JSON-RPC calls
source .env && echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node dist/index.js
# Test specific tool
source .env && echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "getUserInfo", "arguments": {"username": "elonmusk"}}}' | node dist/index.js
π X (Twitter) API Setup
Required Credentials
Add these to your .env file:
X_API_KEY=your_api_key_here
X_API_SECRET=your_api_secret_here
X_ACCESS_TOKEN=your_access_token_here
X_ACCESS_TOKEN_SECRET=your_access_token_secret_here
API Access Levels
| Tier | Cost | Working Tools | Limited Tools |
|------|------|---------------|---------------|
| Basic | $200/month | 18/22 tools | searchTweets, getHashtagAnalytics |
| Pro | $5,000/month | All 22 tools | None |
π οΈ Available Tools (53 Total)
π¦ Twitter API Tools (33 tools)
β Tweet Operations (All Working)
-postTweet - Post new tweets
- getTweetById - Retrieve specific tweets
- replyToTweet - Reply to tweets
- deleteTweet - Delete your tweets
β Engagement (All Working)
-likeTweet / unlikeTweet - Like/unlike tweets
- retweet / undoRetweet - Retweet/undo retweets
- getRetweets - Get retweet users
β User Management (Most Working)
-getUserInfo - Get user profiles β
- getUserTimeline - Get user tweets β
- followUser / unfollowUser - Follow/unfollow users β
- getFollowers - Get followers β οΈ (403 - requires special permissions)
- getFollowing - Get following β οΈ (403 - requires special permissions)
β List Management (All Working)
-createList - Create X (Twitter) lists
- getUserLists - Get user's lists
- addUserToList / removeUserFromList - Manage list members
- getListMembers - Get list members
β οΈ Search & Analytics (Limited)
-searchTweets - Search tweets (requires Pro tier - $5,000/month)
- getHashtagAnalytics - Hashtag analytics (requires Pro tier)
- getLikedTweets - Get liked tweets (API access issue)
π SocialData.tools Enhanced Research (20 tools)
Note: These tools gracefully handle missing API keys with helpful setup instructions
π Advanced Search (6 tools)
-advancedTweetSearch - Complex queries with operators, bypasses API tier restrictions
- historicalTweetSearch - Access historical tweets beyond standard API limits
- trendingTopicsSearch - Real-time trend analysis and popular content discovery
- bulkUserProfiles - Multi-user profile analysis in single requests
- userGrowthAnalytics - User growth pattern analysis over time
- userInfluenceMetrics - Engagement scoring and influence calculations
π§΅ Thread & Conversation Analysis (3 tools)
-getFullThread - Reconstruct complete Twitter threads with engagement metrics
- getConversationTree - Map conversation structure including replies and quotes
- getThreadMetrics - Thread performance analysis and engagement distribution
π Network Analysis (3 tools)
-findMutualConnections - Discover mutual connections via interactions
- analyzeFollowerDemographics - Follower patterns and demographic analysis
- mapInfluenceNetwork - Influence mapping and connection strength analysis
π Advanced Analytics (3 tools)
-getHashtagTrends - Hashtag performance tracking over time with trend analysis
- analyzeSentiment - Sentiment analysis with keyword frequency tracking
- trackVirality - Viral spread patterns and engagement velocity analysis
π± Direct Messages & Moderation (5 tools)
- Various DM and user moderation toolsπ API Keys Setup
Twitter API (Required)
Get these from Twitter Developer Portal:X_API_KEY=your_api_key_here
X_API_SECRET=your_api_secret_here
X_ACCESS_TOKEN=your_access_token_here
X_ACCESS_TOKEN_SECRET=your_access_token_secret_here
SocialData.tools API (Optional)
Enables 20 enhanced research tools that bypass Twitter API limitations:1. Sign up at SocialData.tools
2. Get your API key from the dashboard
3. Add to .env file:
SOCIALDATA_API_KEY=your_socialdata_api_key_here
Without SocialData API key: Enhanced research tools will show helpful setup instructions instead of errors.
π§ͺ Testing SocialData.tools Integration
Test Enhanced Research Tools
```bashSign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





