Skip to main content
Glama
taazkareem

Twitter MCP Server

by taazkareem

Twitter MCP Server

A powerful Twitter integration for AI agents that leverages the Model Context Protocol (MCP) standard, providing a comprehensive set of Twitter functionality through a clean and consistent interface.

Overview

This server provides access to Twitter's features through MCP tools, allowing seamless integration with AI assistants and other MCP-compatible clients. It's built on top of the agent-twitter-client library and provides robust error handling, rate limiting, and consistent response formatting.

Related MCP server: MCP Twitter

Features

Basic Reading

  • Get tweets from users with media support

  • Fetch user profiles with detailed information

  • Search tweets by hashtags or keywords

  • Filter search results by latest/top

  • Rate limiting (max 50 tweets per request)

User Interactions

  • Like/Unlike tweets

  • Retweet/Undo retweet

  • Post tweets with:

    • Text content

    • Media attachments (images, videos)

    • Reply functionality

    • Quote tweet capability

Advanced Features

  • Get user relationships (followers/following)

  • Fetch trending topics

  • Access different timeline types:

    • Home timeline

    • Following timeline

    • User timeline

  • List management (fetch list tweets)

Media & Advanced Interactions

  • Media handling:

    • Image upload (JPEG, PNG, GIF)

    • Video upload (MP4)

    • Alt text support

  • Thread creation

  • Follow/Unfollow users

Tools

Reading Tools

  • get_tweets - Fetch recent tweets from a user

  • get_profile - Get a user's profile information

  • search_tweets - Search for tweets by hashtag or keyword

Interaction Tools

  • like_tweet - Like or unlike a tweet

  • retweet - Retweet or undo retweet

  • post_tweet - Post a new tweet with optional media

  • create_thread - Create a Twitter thread

Timeline Tools

  • get_timeline - Get tweets from different timeline types

  • get_list_tweets - Get tweets from a Twitter list

  • get_trends - Get current trending topics

User Management Tools

  • get_user_relationships - Get followers or following list

  • follow_user - Follow or unfollow a user

Installation

  1. Install dependencies:

npm install
  1. Build the server:

npm run build
  1. Configure environment variables:

# Required: Twitter Account Credentials (for user authentication)
TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
TWITTER_EMAIL=your_email

# Twitter API Authentication (Optional)
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
  1. Add the server config to your MCP client:

On MacOS:

~/Library/Application Support/Claude/claude_desktop_config.json

On Windows:

%APPDATA%/Claude/claude_desktop_config.json

Configuration:

{
  "mcpServers": {
    "twitter-mcp-server": {
      "command": "/path/to/twitter-mcp-server/build/index.js"
    }
  }
}

Development

For development with auto-rebuild:

npm run watch

Debugging

Since MCP servers communicate over stdio, you can use the MCP Inspector for debugging:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

Error Handling

The server implements comprehensive error handling:

  • Input validation for all parameters

  • Rate limiting protection

  • Detailed error messages

  • Proper error propagation

  • Logging for debugging

Response Format

All tools return responses in a consistent format:

{
  content: [{
    type: "text",
    text: string // JSON stringified response or error message
  }]
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details

Related MCP Connectors

  • X (formerly Twitter) posts, profiles, and search for AI agents. Free key, self-minted, no signup.

  • X/Twitter reads, search, monitors and posting. Pay-per-call in USDC — no signup, no API keys.

  • Your agent needs X/Twitter data — who follows a competitor, what a community is posting, who quoted that tweet, what is trending in Japan. Normally that means applying for an X developer account, passing app review, and managing a quota per endpoint. **What you can ask for** • "Who follows @stripe, and which of them are verified?" • "Pull every reply and quote on this tweet and summarise what people object to." • "List this community's moderators and its posts this week." • "What is trending in Japan right now?" • "Give me the full thread context behind this link, including the long-form article." **How to use it** Point any MCP client at https://mcp.aisa.one/twitter-api/mcp and sign in with OAuth — there is no key to create or paste. 29 read tools: users (profile, about, batch lookup by id, search, followers, verified followers, followings, follow check), tweets (timeline, latest, mentions, advanced search, replies, quotes, retweeters, thread context, articles), communities, lists, Spaces and trends. **Why this rather than the source** No developer account to apply for, no app review, no per-endpoint quota to manage. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Ask for a handle's followers here, then ask the same agent for that brand's search traffic, its backlinks, or the people to contact — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/social/mcp for X plus Instagram, Reddit, Pinterest and YouTube; https://mcp.aisa.one/gtm/mcp for those plus Similarweb and Apollo.

  • Read-only public Twitter data and TweetAPI docs for AI agents. Not affiliated with X Corp.

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    Enables interaction with Twitter through a Model Context Protocol, allowing large language models to post tweets, search for tweets, and reply to tweets.
    53
    8 npm
    25
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI models and applications to interact directly with Twitter/X, providing capabilities to create posts, reply to tweets, retrieve user data, and manage account actions.
    13 npm
    11
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables AI assistants to interact with Twitter functionality using cookie-based authentication, allowing for timeline access, tweet management, user information retrieval, and search capabilities.
    16
    -