Twitter MCP Server
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Uses environment variables from .env files to store Twitter API credentials securely
Uses npm for dependency management and running build/development scripts
Uses TypeScript for implementation of parameter validation and error handling
Twitter MCP Server
A Model Context Protocol server implementation for Twitter API integration.
Setup
- Clone the repository
- Install dependencies:
npm install
- Copy
.env.example
to.env
and fill in your Twitter API credentials - Build the project:
npm run build
- Start the server:
npm start
Environment Variables
Required Twitter API credentials in .env
:
Available Tools
Tweet Operations
postTweet
: Post a new tweetCopypostTweetWithMedia
: Post a tweet with media attachmentCopygetTweetById
: Get a specific tweet by IDCopyreplyToTweet
: Reply to an existing tweetCopydeleteTweet
: Delete a tweetCopy
Search & Analytics
searchTweets
: Search for tweetsCopygetHashtagAnalytics
: Get analytics for a hashtagCopy
User Operations
getUserInfo
: Get user informationCopygetUserTimeline
: Get user's tweetsCopygetFollowers
: Get user's followersCopygetFollowing
: Get accounts a user followsCopy
Engagement
likeTweet
: Like a tweetCopyunlikeTweet
: Unlike a tweetCopyretweet
: Retweet a tweetCopyundoRetweet
: Undo a retweetCopygetRetweets
: Get users who retweeted a tweetCopygetLikedTweets
: Get tweets liked by a userCopy
List Management
createList
: Create a new listCopyaddUserToList
: Add a user to a listCopyremoveUserFromList
: Remove a user from a listCopygetListMembers
: Get members of a listCopy
Error Handling
All tools return standardized error responses:
- Missing parameters:
Missing required parameter: parameter_name
- API errors: Error message from Twitter API
- Not found errors: Appropriate "not found" message for the resource
Response Format
All successful responses follow this format:
Development
- Build:
npm run build
- Start:
npm start
- Watch mode:
npm run dev
Status: Working perfectly Response: Returns tweet ID Latest test: Success
Status: Working perfectly Response: Returns complete tweet data Latest test: Success
Status: Working perfectly Response: Confirmation of action Latest test: Success
Status: Working perfectly Response: Confirmation of action Latest test: Success
Status: Working perfectly Response: Returns reply tweet ID Latest test: Success
Status: Working perfectly Response: Complete user profile data Latest test: Success
Status: Working perfectly Response: Confirmation of action Latest test: Success
Status: Working perfectly Response: Confirmation of list creation Latest test: Success
Status: Working perfectly Response: Returns both owned and member lists Latest test: Success
Status: Error 400 Error: Invalid Request parameters Fix needed: Parameter validation
Status: Error 400 Error: Invalid Request parameters Fix needed: Query parameter formatting
Status: Error 400 Error: Invalid Request parameters Fix needed: Parameter validation
- Error Handling:
This server cannot be installed
Enables interaction with Twitter through a Model Context Protocol, allowing large language models to post tweets, search for tweets, and reply to tweets.