Get the FREE Ultimate OpenClaw Setup Guide →

agent-twitter-client

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.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ryanmac-agent-twitter-client-mcp npx -y agent-twitter-client-mcp \
  --env AUTH_METHOD="cookies" \
  --env 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"]"

How to use

This MCP server exposes a Twitter integration that lets AI models fetch tweets, post tweets, manage user profiles, and interact with Grok through Twitter. It uses the agent-twitter-client-mcp package to provide a range of tools such as get_user_tweets, get_tweet_by_id, search_tweets, send_tweet, like_tweet, retweet, quote_tweet, get_user_profile, follow_user, get_followers, get_following, grok_chat, and health_check. Agents can also run interactive demo scripts and test the MCP via the provided CLI interface. Authentication can be handled via cookie-based authentication (recommended), username/password, or Twitter API credentials, allowing flexible integration depending on your security requirements. When using Grok, you can continue conversations with conversation IDs and access web search results and citations via Grok integration, subject to the version requirement noted in the docs.

How to install

Prerequisites:\n- Node.js and npm installed on your system (Node.js v16+ is typical for many MCPs).\n- Git (optional, for cloning the repo).\n\nInstall locally (preferred for development):\n1) Install the MCP package in your project:\nbash\nnpm install agent-twitter-client-mcp\n\n2) Run the MCP server:\nbash\nnpx agent-twitter-client-mcp\n\n\nInstall globally (optional):\nbash\nnpm install -g agent-twitter-client-mcp\n# Then run the server with:\nagent-twitter-client-mcp\n\n\nConfiguration steps:\n1) Create a .env file (or set environment variables in your hosting environment) to specify authentication methods and credentials as described in the Authentication Methods section of the README.\n2) If you plan to expose the MCP via Docker or Docker Compose, configure port mapping as needed (default port is 3000).

Additional notes

Tips and common issues:\n- For cookie-based authentication, ensure you have valid Twitter cookies (auth_token, ct0, twid) and include Domain=.twitter.com for each cookie.\n- When using Grok, ensure you have agent-twitter-client v0.0.19 or higher as required by the Grok integration notes.\n- If you change the port, remember to update environment variables or Docker Compose configurations accordingly (PORT, MCP_HOST_PORT, MCP_CONTAINER_PORT).\n- The MCP supports both interactive demos and programmatic usage via the Available Tools listed in the README.\n- For testing, use the built-in test interface (npx agent-twitter-client-mcp-test or npm run test:interface) to validate each function before production use.

Related MCP Servers

Sponsor this space

Reach thousands of developers