home / mcp / twitter noauth mcp server

Twitter NoAuth MCP Server

Provides Twitter API access with core actions like searching, posting, and replying, using token refresh.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "baryhuang-mcp-twitter-noauth": {
      "command": "mcp-server-twitter-noauth",
      "args": []
    }
  }
}

You can run the MCP Twitter NoAuth server to access Twitter API operations without storing credentials locally. It enables searching tweets, fetching user timelines and replies, posting tweets, and replying to tweets, while handling token refreshes automatically. This setup is ideal for headless, remote deployments where credential storage is separated from the server logic.

How to use

Use an MCP client to interact with the Twitter MCP server by invoking its tools for search, fetch, post, and reply actions. You will provision tokens per call or via a token refresh workflow, then pass the tokens as part of your tool calls. The server focuses on Twitter operations and manages token refreshing when needed.

How to install

Prerequisites: Python 3.10 or higher. You may also use Docker if you prefer containerized deployment.

# Clone the repository
git clone https://github.com/baryhuang/mcp-twitter-noauth.git
cd mcp-twitter-noauth

# Install dependencies
pip install -e .

Configuration and usage notes

Server execution uses a dedicated MCP entry point. The server can run locally as a stdio process, allowing your MCP client to start it and communicate through standard input/output. The following runtime command starts the server as a standalone process.

mcp-server-twitter-noauth

Additional considerations

Token management is handled through a dedicated token refresh workflow. You can provide an initial access token and refresh token, or refresh tokens alone if the access token has expired. The server returns a new access token and its expiration time to use for subsequent calls.

Security note: Keep all Twitter API credentials secure and pass them only through trusted MCP client calls. This server is designed to minimize credential exposure by decoupling credential storage from the server logic.

Troubleshooting and tips

If you encounter token expiration, trigger the token refresh workflow again to obtain a new access token before continuing with API calls.

For Docker-based deployment, you can run the same server image in a container and connect your MCP client to the container’s IO streams.

Examples of supported actions

- Search tweets using Twitter API and return matching tweets with metadata like creation time and author.

- Get recent tweets from a specific user.

- Post a new tweet and optionally reply to existing tweets.

- Retrieve recent replies by a user and refresh tokens as needed.

Available tools

search_tweets

Search tweets using the Twitter API and return matching tweet data including text, time, and author.

get_user_tweets

Fetch recent tweets from a specified user by user_id, returning a list of tweets.

get_user_replies

Fetch recent replies made by a specific user, returning corresponding tweets and metadata.

post_tweet

Post a new tweet with the provided text content.

reply_tweet

Post a reply to an existing tweet identified by tweet_id with the given text.

refresh_tokens

Refresh the access token using the refresh token, client_id, and client_secret to obtain a new access token.

automatic_token_refresh

Automatically refresh access tokens when they expire and provide the new token to subsequent requests.