home / mcp / twitter mcp server

Twitter MCP Server

Provides post, image posting, and search capabilities for Twitter via MCP in Claude AI.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "genaiwithms-twitter-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@muhammadsiddiq/twitter-mcp"
      ],
      "env": {
        "API_KEY": "your_api_key",
        "ACCESS_TOKEN": "your_access_token",
        "API_SECRET_KEY": "your_api_secret_key",
        "ACCESS_TOKEN_SECRET": "your_access_token_secret"
      }
    }
  }
}

This MCP server lets you interact with Twitter/X directly from Claude AI. You can post tweets, share images, search tweets, and engage in conversations with secure authentication and built-in rate limiting.

How to use

You connect to the Twitter MCP Server from your MCP client (such as Claude) and issue high-level actions like posting a tweet, posting a tweet with an image, or searching tweets. The server handles authentication with Twitter and enforces rate limits, so you can focus on your workflow without managing low-level API details.

How to install

Prerequisites you need before starting are a Node.js 18+ runtime and npm or npx, a Twitter Developer Account with API credentials, and Claude Desktop installed.

Configuration

You configure the MCP server as follows. The server runs through npx and uses your Twitter API credentials. Place the configuration snippet in Claude’s MCP server configuration area or your equivalent MCP client configuration file.

{
  "mcpServers": {
    "twitter": {
      "command": "npx",
      "args": ["-y", "@muhammadsiddiq/twitter-mcp"],
      "env": {
        "API_KEY": "your_api_key",
        "API_SECRET_KEY": "your_api_secret_key",
        "ACCESS_TOKEN": "your_access_token",
        "ACCESS_TOKEN_SECRET": "your_access_token_secret"
      }
    }
  }
}

Usage patterns

Post a plain tweet from Claude by issuing a simple command that sends the text you want to tweet. To include media, ensure the image file is accessible to Claude Desktop and your filesystem access is configured for the MCP server. You can also search Twitter using a query to retrieve matching tweets for analysis.

Filesystem access for images

If you want to post images, configure filesystem access so Claude can read image files on your computer. Grant access to the folders where you store images, then reference absolute or relative paths to those files when composing a tweet with an image.

Post and search examples

Post a text tweet: you provide the content and submit it through Claude. Post with an image: ensure the image is accessible and referenced from your command; the server will upload the image along with your caption. Search tweets: provide a query, and the server returns a list of tweets matching that query and related metadata.

Security and credentials

Keep your Twitter API credentials secure by using environment variables in production and avoiding hard-coded values. Rotate credentials periodically and monitor API usage in the Twitter Developer Portal.

Troubleshooting

Common issues include authentication failures, rate limit messages, and image upload problems. Verify your API credentials, ensure the tokens have the correct permissions, and confirm the image file path and size meet the requirements. If the MCP server cannot be reached from Claude, restart Claude Desktop and check the MCP configuration JSON for proper syntax.

Notes

This MCP server supports posting tweets, posting with images (JPEG, PNG, GIF, WEBP), and searching tweets by query. It uses OAuth 1.0a authentication and includes rate limiting to protect against API abuse.

API reference overview

The server exposes tools to interact with Twitter programmatically: post_tweet for text-only tweets, post_tweet_with_image for tweets with media, and search_tweets to find tweets matching a query. Each tool handles the necessary API calls and formatting of results.

Available tools

post_tweet

Post a text-only tweet through the MCP server using the Twitter API.

post_tweet_with_image

Post a tweet with an attached image. Supports JPEG, PNG, GIF, and WEBP formats.

search_tweets

Search for tweets matching a query and return a list of tweets with metadata.