
MCP server for Twitter interaction with tweet retrieval and posting capabilities.
MCP server for Twitter interaction with tweet retrieval and posting capabilities.
An MCP (Model Context Protocol) server that provides tools for interacting with Twitter using the agent-twitter-client library.
npm install # or yarn install
.env
file in the root directory with your Twitter credentials:TWITTER_USERNAME=your_twitter_username
TWITTER_PASSWORD=your_twitter_password
[email protected] (optional)
TWITTER_2FA_SECRET=your_2fa_secret (optional)
# Optional API credentials (used as fallback)
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
You can run the server using the FastMCP CLI tools:
# For development and testing in the terminal npx fastmcp dev # For visual inspection with the MCP Inspector npx fastmcp inspect
Retrieves a tweet by its ID.
Parameters:
tweetId
(string): The ID of the tweet to retrieveExample:
getTweet({"tweetId": "1734609533274853865"})
Posts a new tweet to Twitter.
Parameters:
text
(string): The text content of the tweet to sendExample:
sendTweet({"text": "Hello World from MCP!"})
This server is built using:
To build the TypeScript code:
npx tsc
MIT