Agent Twitter

A Model Context Protocol (MCP) server that integrates with X using the @elizaOS `agent-twitter-client` package, allowing AI models to interact with Twitter without direct API access.
  • typescript

23

GitHub Stars

typescript

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": {
    "ryanmac-agent-twitter-client-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "agent-twitter-client-mcp"
      ],
      "env": {
        "AUTH_METHOD": "cookies or credentials or api (as configured)",
        "TWITTER_EMAIL": "user@example.com",
        "TWITTER_API_KEY": "YOUR_API_KEY",
        "TWITTER_COOKIES": "[\"auth_token=YOUR_AUTH_TOKEN; Domain=.twitter.com\", \"ct0=YOUR_CT0_VALUE; Domain=.twitter.com\", \"twid=u%3DYOUR_USER_ID; Domain=.twitter.com\"]",
        "TWITTER_PASSWORD": "your_password",
        "TWITTER_USERNAME": "your_username",
        "TWITTER_2FA_SECRET": "YOUR_2FA_SECRET",
        "TWITTER_ACCESS_TOKEN": "YOUR_ACCESS_TOKEN",
        "TWITTER_API_SECRET_KEY": "YOUR_API_SECRET_KEY",
        "TWITTER_ACCESS_TOKEN_SECRET": "YOUR_ACCESS_TOKEN_SECRET"
      }
    }
  }
}

You can run an MCP server that bridges AI models with Twitter actions via the agent-twitter-client-mcp integration. It lets you fetch tweets, post tweets, manage users, and even chat with Grok through Twitter, all without embedding Twitter credentials in your model code.

How to use

You interact with the Twitter MCP by running the MCP server locally or remotely and then issuing commands through an MCP client. You can fetch tweets from specific users, get tweets by ID, search tweets, post new tweets (with text or media), create polls, and like, retweet, or quote tweets. You can also retrieve user profiles, follow users, and list followers or people you are following. When you enable Grok, you can chat with Grok via Twitter and access real‑time data and search results as part of the conversation. Use the standard client commands to start and direct actions; the server handles the Twitter API calls and returns responses.

How to install

Prerequisites: Node.js 18+ and npm must be available on your system.

Option A: Install globally and run directly.

# Install globally
npm install -g agent-twitter-client-mcp

# Run the MCP server
agent-twitter-client-mcp

Option B: Install locally in a project and run with npx.

# Install locally in a project
npm install agent-twitter-client-mcp

# Run with npx (from the project directory)
npx agent-twitter-client-mcp

Configuration and setup notes

Create credentials and choose an authentication method to configure the MCP. You can authenticate via cookies (recommended), username/password, or Twitter API credentials. When using Grok, ensure you have agent-twitter-client v0.0.19 or higher.

Example configuration for running through Claude Desktop shows using a local MCP command with environment variables indicating the chosen authentication method and credentials.

Demo and testing

You can experiment with the included demo scripts to explore tweet searches, profiles, Grok chats, and more. Start with the interactive demo menu or run specific demo scripts to verify functionality.

# Run the interactive demo menu (from the demo directory)
./run-demo.sh

# Run a specific demo script
./run-demo.sh --script tweet-search.js

Advanced usage and Grok

Grok integration allows real‑time conversations and access to Twitter data through Grok. Note that Grok requires agent-twitter-client v0.0.19+ and appropriate authentication. You can set up Grok via cookies or credentials, then execute Grok conversations and fetch live data as part of your prompts.

Example Grok usage flows include talking with Grok to explain concepts, and continuing conversations with Grok about more advanced topics or real‑time trends.

Troubleshooting and health

If you encounter issues, perform a health check to verify authentication status, API connectivity, and memory usage, then inspect server logs for error details.

Common issues involve authentication (cookie format, expired cookies, 2FA, or API key permissions), rate limits, and Cloudflare protection for certain login methods. Review the relevant sections for authentication, rate limits, and Grok requirements to resolve these problems.

Available tools

get_user_tweets

Fetch tweets from a specific user by username and optional count.

get_tweet_by_id

Retrieve a single tweet by its ID.

search_tweets

Search tweets by a query string and optional result count.

send_tweet

Post a new tweet with text content.

send_tweet_with_poll

Post a tweet that includes a poll with multiple options.

like_tweet

Like a tweet by its ID.

retweet

Retweet a tweet by its ID.

quote_tweet

Quote a tweet by its ID and add your own text.

get_user_profile

Get a user’s profile information by username.

follow_user

Follow a user by username.

get_followers

Get a list of followers for a user.

get_following

Get the list of users that a user is following.

grok_chat

Chat with Grok via Twitter and continue conversations with IDs.

health_check

Check the health of the Twitter MCP server.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational