- Home
- MCP servers
- javascript
19
GitHub Stars
javascript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"taazkareem-twitter-mcp-server": {
"command": "/path/to/twitter-mcp-server/build/index.js",
"args": [],
"env": {
"TWITTER_EMAIL": "YOUR_EMAIL",
"TWITTER_API_KEY": "YOUR_API_KEY",
"TWITTER_PASSWORD": "YOUR_PASSWORD",
"TWITTER_USERNAME": "YOUR_USERNAME",
"TWITTER_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN",
"TWITTER_API_SECRET_KEY": "YOUR_API_SECRET_KEY",
"TWITTER_ACCESS_TOKEN_SECRET": "YOUR_ACCESS_TOKEN_SECRET"
}
}
}
}You deploy this MCP server to access Twitter features through a consistent MCP interface. It exposes reading, posting, and social interactions with robust error handling and rate limiting, so you can build AI assistants that interact with Twitter data and actions reliably.
How to use
You connect to the Twitter MCP Server from any MCP-compatible client. Use the available tools to fetch tweets, profiles, and trends; perform interactions like liking, retweeting, and posting tweets; and manage timelines and lists. You provide credentials and, if needed, API keys, and then send requests through the MCP client to perform actions or retrieve data. All responses follow a consistent format so your agent can parse results and handle errors gracefully.
Typical usage patterns include getting a user’s recent tweets, searching tweets by keywords or hashtags, loading a user’s profile with rich details, and performing actions such as posting a tweet with optional media. You can also navigate different timelines (home, following, user timeline) and obtain current trends to inform conversational flows.
How to install
Prerequisites: you need Node.js and npm installed on your system.
# Install dependencies
npm install
Build the server to produce the executable you will run locally.
# Build the server
npm run build
Set your Twitter credentials and API keys as environment variables. Provide the required values for your account and, if available, the API credentials.
# Required credentials for user authentication
TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
TWITTER_EMAIL=your_email
# Optional API credentials for elevated access (if available)
TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET_KEY=your_api_secret_key
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_token_secret
Configure the MCP server in your client so it can launch locally. The example initializes a stdio-based server that points to the built index.
{
"mcpServers": {
"twitter_mcp_server": {
"command": "/path/to/twitter-mcp-server/build/index.js",
"args": []
}
}
}
Additional configuration and notes
When you run the server, it will communicate over stdio with your MCP client. Use the included environment variables to configure authentication and API access as required by your deployment.
For development and debugging, you can use the MCP Inspector to inspect messages and responses while running the server in debug mode.
Troubleshooting
If you encounter authentication errors, verify that all TWITTER_* variables are set correctly and that any API keys are valid for the Twitter account being accessed.
If rate limiting appears, ensure your client respects the server’s limits and consider spreading requests over time or using specific end-user credentials with appropriate rate allowances.
Security and best practices
Keep credentials secure. Do not expose environment variables in public or shared configurations. Use a secret manager or secure environment file in your deployment.
Regularly rotate API keys and tokens according to your security policy. Monitor logs for unusual activity and enable proper error handling in your MCP client.
Available tools
get_tweets
Fetch recent tweets from a user with options for media inclusion and filtering.
get_profile
Retrieve a user’s profile information with detailed attributes.
search_tweets
Search tweets by hashtag or keyword with various filters.
like_tweet
Like or unlike a tweet.
retweet
Retweet or undo a tweet.
post_tweet
Post a new tweet with optional text and media attachments.
create_thread
Create a Twitter thread of connected tweets.
get_timeline
Get tweets from a specified timeline type (home, following, user).
get_list_tweets
Fetch tweets from a Twitter list.
get_trends
Get current trending topics.
get_user_relationships
Retrieve followers or following lists for a user.
follow_user
Follow or unfollow a user.