Twitter Client MCP

by mzkrasner

175 downloads
Not rated
GitHub

About

A Model Context Protocol (MCP) server for secure Twitter client integration using the ElizaOS agent-twitter-client library

Details

Author
mzkrasner
Downloads
175
Categories
Other

- Get profile information by username or for the authenticated user.
- Retrieve a specific tweet by ID or list tweets from a user.
- Post new tweets, like tweets, and retweet tweets.
- Search for tweets with configurable modes (top, latest, photos, videos).
- Search for Twitter profiles by query.
- View a user’s followers, who they follow, and follow new accounts.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Twitter Client MCP
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install dependencies with npm install, and build with npm run build. Set the required environment variables (TWITTER_USERNAME, TWITTER_PASSWORD, TWITTER_EMAIL) and optionally API v2 credentials. Run locally with npm start or use npx to execute directly from GitHub. Configure as a command-type MCP server in your client (e.g., Cursor) pointing to the built index.js, or define it in a .cursor/mcp.json file.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "twitter client mcp": {
            "twitter-client-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "github:mzkrasner/twitter-client-mcp"
                ],
                "env": {
                    "TWITTER_USERNAME": "your_username",
                    "TWITTER_PASSWORD": "your_password",
                    "TWITTER_EMAIL": "your_email@example.com"
                }
            }
        }
    }
}

McpServers

{
    "twitter-client-mcp": {
        "command": "npx",
        "args": [
            "-y",
            "github:mzkrasner/twitter-client-mcp"
        ],
        "env": {
            "TWITTER_USERNAME": "your_username",
            "TWITTER_PASSWORD": "your_password",
            "TWITTER_EMAIL": "your_email@example.com"
        }
    }
}

Twitter Client MCP

A Model Context Protocol (MCP) server that provides secure access to Twitter functionality through the agent-twitter-client library.

Features

The Twitter Client MCP provides the following capabilities:

- Profile Operations
- Get profile information by username
- Get the authenticated user's profile

- Tweet Operations
- Get a specific tweet by ID
- Get tweets from a user
- Send new tweets
- Like tweets
- Retweet tweets

- Search Operations
- Search for tweets
- Search for profiles

- Relationship Operations
- Get followers of a user
- Get users that a user is following
- Follow a user

Security ⚠️

> IMPORTANT: TWITTER CREDENTIAL PROTECTION

This MCP server requires Twitter credentials to operate. To protect these sensitive credentials:

1. NEVER share your credentials
2. NEVER run commands that display your credentials
3. NEVER allow the LLM to execute shell commands directly without your approval

Multiple Layers of Protection

This server implements several layers of security to keep your credentials safe:

1. Credential Isolation

- Your credentials are only loaded during initialization - After loading, credentials are immediately removed from environment variables - Credentials are never logged or transmitted to the LLM

2. Memory Protection

- Secure memory allocation using sodium-native - Memory locking to prevent swapping to disk - Zero-out memory buffers after use

3. Access Prevention

- Secure environment variable handling - Strict validation of required environment variables - Console output sanitization to prevent leaking secrets

Setup

1. Clone the repository
2. Install dependencies:

   npm install

3. Build the project:
   npm run build

Required Environment Variables

The Twitter Client MCP requires the following environment variables:

TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
TWITTER_EMAIL=your_email@example.com

Optionally, you can add Twitter API v2 credentials for advanced functionality:

TWITTER_API_KEY=your_api_key
TWITTER_API_SECRET_KEY=your_api_secret
TWITTER_ACCESS_TOKEN=your_access_token
TWITTER_ACCESS_TOKEN_SECRET=your_access_secret

Tools

The server exposes the following MCP tools:

| Tool Name | Description | Parameters |
|-----------|-------------|------------|
| profileByUsername | Get a Twitter profile by username | username: String |
| myProfile | Get the authenticated user's profile | check: Boolean |
| getTweet | Get a specific tweet by ID | tweetId: String |
| getUserTweets | Get tweets from a Twitter user | username: String, count?: Number |
| sendTweet | Post a new tweet | text: String, inReplyToId?: String |
| likeTweet | Like a tweet | tweetId: String |
| retweet | Retweet a tweet | tweetId: String |
| searchTweets | Search for tweets | query: String, count?: Number, searchMode?: String ('top', 'latest', 'photos', 'videos') |
| searchProfiles | Search for Twitter profiles | query: String, count?: Number |
| getFollowers | Get a list of users following a Twitter user | username: String, count?: Number |
| getFollowing | Get a list of users that a Twitter user is following | username: String, count?: Number |
| followUser | Follow a Twitter user | username: String |

Usage

Running Locally

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.